diff options
Diffstat (limited to 'services/java')
5 files changed, 36 insertions, 30 deletions
diff --git a/services/java/Android.mk b/services/java/Android.mk index c756d29..e70a6c9 100644 --- a/services/java/Android.mk +++ b/services/java/Android.mk @@ -11,7 +11,7 @@ LOCAL_SRC_FILES := \ LOCAL_MODULE:= services -LOCAL_JAVA_LIBRARIES := android.policy +LOCAL_JAVA_LIBRARIES := android.policy telephony-common LOCAL_NO_EMMA_INSTRUMENT := true LOCAL_NO_EMMA_COMPILE := true diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 7bbc8b5..230f07b 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -77,6 +77,7 @@ import android.util.SparseIntArray; import com.android.internal.net.LegacyVpnInfo; import com.android.internal.net.VpnConfig; import com.android.internal.telephony.Phone; +import com.android.internal.telephony.PhoneConstants; import com.android.server.am.BatteryStatsService; import com.android.server.connectivity.Tethering; import com.android.server.connectivity.Vpn; @@ -1008,7 +1009,7 @@ private NetworkStateTracker makeWimaxStateTracker() { try { if (!ConnectivityManager.isNetworkTypeValid(networkType) || mNetConfigs[networkType] == null) { - return Phone.APN_REQUEST_FAILED; + return PhoneConstants.APN_REQUEST_FAILED; } FeatureUser f = new FeatureUser(networkType, feature, binder); @@ -1027,7 +1028,7 @@ private NetworkStateTracker makeWimaxStateTracker() { uidRules = mUidRules.get(Binder.getCallingUid(), RULE_ALLOW_ALL); } if (networkMetered && (uidRules & RULE_REJECT_METERED) != 0) { - return Phone.APN_REQUEST_FAILED; + return PhoneConstants.APN_REQUEST_FAILED; } NetworkStateTracker network = mNetTrackers[usedNetworkType]; @@ -1039,7 +1040,7 @@ private NetworkStateTracker makeWimaxStateTracker() { if (ni.isAvailable() == false) { if (!TextUtils.equals(feature,Phone.FEATURE_ENABLE_DUN_ALWAYS)) { if (DBG) log("special network not available ni=" + ni.getTypeName()); - return Phone.APN_TYPE_NOT_AVAILABLE; + return PhoneConstants.APN_TYPE_NOT_AVAILABLE; } else { // else make the attempt anyway - probably giving REQUEST_STARTED below if (DBG) { @@ -1088,10 +1089,10 @@ private NetworkStateTracker makeWimaxStateTracker() { } finally { Binder.restoreCallingIdentity(token); } - return Phone.APN_ALREADY_ACTIVE; + return PhoneConstants.APN_ALREADY_ACTIVE; } if (VDBG) log("special network already connecting"); - return Phone.APN_REQUEST_STARTED; + return PhoneConstants.APN_REQUEST_STARTED; } // check if the radio in play can make another contact @@ -1102,7 +1103,7 @@ private NetworkStateTracker makeWimaxStateTracker() { feature); } network.reconnect(); - return Phone.APN_REQUEST_STARTED; + return PhoneConstants.APN_REQUEST_STARTED; } else { // need to remember this unsupported request so we respond appropriately on stop synchronized(this) { @@ -1115,7 +1116,7 @@ private NetworkStateTracker makeWimaxStateTracker() { return -1; } } - return Phone.APN_TYPE_NOT_AVAILABLE; + return PhoneConstants.APN_TYPE_NOT_AVAILABLE; } finally { if (DBG) { final long execTime = SystemClock.elapsedRealtime() - startTime; @@ -2037,7 +2038,7 @@ private NetworkStateTracker makeWimaxStateTracker() { // @see bug/4455071 /** Notify TetheringService if interface name has been changed. */ if (TextUtils.equals(mNetTrackers[netType].getNetworkInfo().getReason(), - Phone.REASON_LINK_PROPERTIES_CHANGED)) { + PhoneConstants.REASON_LINK_PROPERTIES_CHANGED)) { if (isTetheringSupported()) { mTethering.handleTetherIfaceChange(); } diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java index 1b1638a..c23a1d9 100644 --- a/services/java/com/android/server/TelephonyRegistry.java +++ b/services/java/com/android/server/TelephonyRegistry.java @@ -44,6 +44,7 @@ import com.android.internal.telephony.ITelephonyRegistry; import com.android.internal.telephony.IPhoneStateListener; import com.android.internal.telephony.DefaultPhoneNotifier; import com.android.internal.telephony.Phone; +import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.ServiceStateTracker; import com.android.internal.telephony.TelephonyIntents; import com.android.server.am.BatteryStatsService; @@ -622,7 +623,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } Intent intent = new Intent(TelephonyManager.ACTION_PHONE_STATE_CHANGED); - intent.putExtra(Phone.STATE_KEY, DefaultPhoneNotifier.convertCallState(state).toString()); + intent.putExtra(PhoneConstants.STATE_KEY, + DefaultPhoneNotifier.convertCallState(state).toString()); if (!TextUtils.isEmpty(incomingNumber)) { intent.putExtra(TelephonyManager.EXTRA_INCOMING_NUMBER, incomingNumber); } @@ -637,34 +639,35 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { // status bar takes care of that after taking into account all of the // required info. Intent intent = new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED); - intent.putExtra(Phone.STATE_KEY, DefaultPhoneNotifier.convertDataState(state).toString()); + intent.putExtra(PhoneConstants.STATE_KEY, + DefaultPhoneNotifier.convertDataState(state).toString()); if (!isDataConnectivityPossible) { - intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY, true); + intent.putExtra(PhoneConstants.NETWORK_UNAVAILABLE_KEY, true); } if (reason != null) { - intent.putExtra(Phone.STATE_CHANGE_REASON_KEY, reason); + intent.putExtra(PhoneConstants.STATE_CHANGE_REASON_KEY, reason); } if (linkProperties != null) { - intent.putExtra(Phone.DATA_LINK_PROPERTIES_KEY, linkProperties); + intent.putExtra(PhoneConstants.DATA_LINK_PROPERTIES_KEY, linkProperties); String iface = linkProperties.getInterfaceName(); if (iface != null) { - intent.putExtra(Phone.DATA_IFACE_NAME_KEY, iface); + intent.putExtra(PhoneConstants.DATA_IFACE_NAME_KEY, iface); } } if (linkCapabilities != null) { - intent.putExtra(Phone.DATA_LINK_CAPABILITIES_KEY, linkCapabilities); + intent.putExtra(PhoneConstants.DATA_LINK_CAPABILITIES_KEY, linkCapabilities); } - if (roaming) intent.putExtra(Phone.DATA_NETWORK_ROAMING_KEY, true); + if (roaming) intent.putExtra(PhoneConstants.DATA_NETWORK_ROAMING_KEY, true); - intent.putExtra(Phone.DATA_APN_KEY, apn); - intent.putExtra(Phone.DATA_APN_TYPE_KEY, apnType); + intent.putExtra(PhoneConstants.DATA_APN_KEY, apn); + intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType); mContext.sendStickyBroadcast(intent); } private void broadcastDataConnectionFailed(String reason, String apnType) { Intent intent = new Intent(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED); - intent.putExtra(Phone.FAILURE_REASON_KEY, reason); - intent.putExtra(Phone.DATA_APN_TYPE_KEY, apnType); + intent.putExtra(PhoneConstants.FAILURE_REASON_KEY, reason); + intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType); mContext.sendStickyBroadcast(intent); } diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java index 00832ee..5aa3a29 100644 --- a/services/java/com/android/server/connectivity/Tethering.java +++ b/services/java/com/android/server/connectivity/Tethering.java @@ -47,6 +47,7 @@ import android.provider.Settings; import android.util.Log; import com.android.internal.telephony.Phone; +import com.android.internal.telephony.PhoneConstants; import com.android.internal.util.IState; import com.android.internal.util.State; import com.android.internal.util.StateMachine; @@ -1195,7 +1196,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub { boolean retValue = true; if (apnType == ConnectivityManager.TYPE_NONE) return false; if (apnType != mMobileApnReserved) turnOffUpstreamMobileConnection(); - int result = Phone.APN_REQUEST_FAILED; + int result = PhoneConstants.APN_REQUEST_FAILED; String enableString = enableString(apnType); if (enableString == null) return false; try { @@ -1204,14 +1205,14 @@ public class Tethering extends INetworkManagementEventObserver.Stub { } catch (Exception e) { } switch (result) { - case Phone.APN_ALREADY_ACTIVE: - case Phone.APN_REQUEST_STARTED: + case PhoneConstants.APN_ALREADY_ACTIVE: + case PhoneConstants.APN_REQUEST_STARTED: mMobileApnReserved = apnType; Message m = obtainMessage(CMD_CELL_CONNECTION_RENEW); m.arg1 = ++mCurrentConnectionSequence; sendMessageDelayed(m, CELL_CONNECTION_RENEW_MS); break; - case Phone.APN_REQUEST_FAILED: + case PhoneConstants.APN_REQUEST_FAILED: default: retValue = false; break; diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java index ce53499..4ad6140 100755 --- a/services/java/com/android/server/location/GpsLocationProvider.java +++ b/services/java/com/android/server/location/GpsLocationProvider.java @@ -60,6 +60,7 @@ import com.android.internal.app.IBatteryStats; import com.android.internal.location.GpsNetInitiatedHandler; import com.android.internal.location.GpsNetInitiatedHandler.GpsNiNotification; import com.android.internal.telephony.Phone; +import com.android.internal.telephony.PhoneConstants; import java.io.File; import java.io.FileInputStream; @@ -1285,8 +1286,8 @@ public class GpsLocationProvider implements LocationProviderInterface { int result = mConnMgr.startUsingNetworkFeature( ConnectivityManager.TYPE_MOBILE, Phone.FEATURE_ENABLE_SUPL); mAGpsDataConnectionIpAddr = ipaddr; - if (result == Phone.APN_ALREADY_ACTIVE) { - if (DEBUG) Log.d(TAG, "Phone.APN_ALREADY_ACTIVE"); + if (result == PhoneConstants.APN_ALREADY_ACTIVE) { + if (DEBUG) Log.d(TAG, "PhoneConstants.APN_ALREADY_ACTIVE"); if (mAGpsApn != null) { Log.d(TAG, "mAGpsDataConnectionIpAddr " + mAGpsDataConnectionIpAddr); if (mAGpsDataConnectionIpAddr != 0xffffffff) { @@ -1300,12 +1301,12 @@ public class GpsLocationProvider implements LocationProviderInterface { native_agps_data_conn_open(mAGpsApn); mAGpsDataConnectionState = AGPS_DATA_CONNECTION_OPEN; } else { - Log.e(TAG, "mAGpsApn not set when receiving Phone.APN_ALREADY_ACTIVE"); + Log.e(TAG, "mAGpsApn not set when receiving PhoneConstants.APN_ALREADY_ACTIVE"); mAGpsDataConnectionState = AGPS_DATA_CONNECTION_CLOSED; native_agps_data_conn_failed(); } - } else if (result == Phone.APN_REQUEST_STARTED) { - if (DEBUG) Log.d(TAG, "Phone.APN_REQUEST_STARTED"); + } else if (result == PhoneConstants.APN_REQUEST_STARTED) { + if (DEBUG) Log.d(TAG, "PhoneConstants.APN_REQUEST_STARTED"); // Nothing to do here } else { if (DEBUG) Log.d(TAG, "startUsingNetworkFeature failed"); |