Loading src/java/com/android/internal/telephony/CellularNetworkService.java +41 −41 Original line number Original line Diff line number Diff line Loading @@ -32,7 +32,7 @@ import android.telephony.CellIdentityLte; import android.telephony.CellIdentityTdscdma; import android.telephony.CellIdentityTdscdma; import android.telephony.CellIdentityWcdma; import android.telephony.CellIdentityWcdma; import android.telephony.LteVopsSupportInfo; import android.telephony.LteVopsSupportInfo; import android.telephony.NetworkRegistrationState; import android.telephony.NetworkRegistrationInfo; import android.telephony.NetworkService; import android.telephony.NetworkService; import android.telephony.NetworkServiceCallback; import android.telephony.NetworkServiceCallback; import android.telephony.Rlog; import android.telephony.Rlog; Loading Loading @@ -88,9 +88,9 @@ public class CellularNetworkService extends NetworkService { if (callback == null) return; if (callback == null) return; ar = (AsyncResult) message.obj; ar = (AsyncResult) message.obj; int domain = (message.what == GET_CS_REGISTRATION_STATE_DONE) int domain = (message.what == GET_CS_REGISTRATION_STATE_DONE) ? NetworkRegistrationState.DOMAIN_CS ? NetworkRegistrationInfo.DOMAIN_CS : NetworkRegistrationState.DOMAIN_PS; : NetworkRegistrationInfo.DOMAIN_PS; NetworkRegistrationState netState = NetworkRegistrationInfo netState = getRegistrationStateFromResult(ar.result, domain); getRegistrationStateFromResult(ar.result, domain); int resultCode; int resultCode; Loading @@ -102,18 +102,18 @@ public class CellularNetworkService extends NetworkService { try { try { if (DBG) { if (DBG) { log("Calling callback.onGetNetworkRegistrationStateComplete." log("Calling callback.onGetNetworkRegistrationInfoComplete." + "resultCode = " + resultCode + "resultCode = " + resultCode + ", netState = " + netState); + ", netState = " + netState); } } callback.onGetNetworkRegistrationStateComplete( callback.onGetNetworkRegistrationInfoComplete( resultCode, netState); resultCode, netState); } catch (Exception e) { } catch (Exception e) { loge("Exception: " + e); loge("Exception: " + e); } } break; break; case NETWORK_REGISTRATION_STATE_CHANGED: case NETWORK_REGISTRATION_STATE_CHANGED: notifyNetworkRegistrationStateChanged(); notifyNetworkRegistrationInfoChanged(); break; break; default: default: return; return; Loading @@ -129,22 +129,22 @@ public class CellularNetworkService extends NetworkService { switch (halRegState) { switch (halRegState) { case RegState.NOT_REG_MT_NOT_SEARCHING_OP: case RegState.NOT_REG_MT_NOT_SEARCHING_OP: case RegState.NOT_REG_MT_NOT_SEARCHING_OP_EM: case RegState.NOT_REG_MT_NOT_SEARCHING_OP_EM: return NetworkRegistrationState.REG_STATE_NOT_REG_NOT_SEARCHING; return NetworkRegistrationInfo.REG_STATE_NOT_REG_NOT_SEARCHING; case RegState.REG_HOME: case RegState.REG_HOME: return NetworkRegistrationState.REG_STATE_HOME; return NetworkRegistrationInfo.REG_STATE_HOME; case RegState.NOT_REG_MT_SEARCHING_OP: case RegState.NOT_REG_MT_SEARCHING_OP: case RegState.NOT_REG_MT_SEARCHING_OP_EM: case RegState.NOT_REG_MT_SEARCHING_OP_EM: return NetworkRegistrationState.REG_STATE_NOT_REG_SEARCHING; return NetworkRegistrationInfo.REG_STATE_NOT_REG_SEARCHING; case RegState.REG_DENIED: case RegState.REG_DENIED: case RegState.REG_DENIED_EM: case RegState.REG_DENIED_EM: return NetworkRegistrationState.REG_STATE_DENIED; return NetworkRegistrationInfo.REG_STATE_DENIED; case RegState.UNKNOWN: case RegState.UNKNOWN: case RegState.UNKNOWN_EM: case RegState.UNKNOWN_EM: return NetworkRegistrationState.REG_STATE_UNKNOWN; return NetworkRegistrationInfo.REG_STATE_UNKNOWN; case RegState.REG_ROAMING: case RegState.REG_ROAMING: return NetworkRegistrationState.REG_STATE_ROAMING; return NetworkRegistrationInfo.REG_STATE_ROAMING; default: default: return NetworkRegistrationState.REG_STATE_NOT_REG_NOT_SEARCHING; return NetworkRegistrationInfo.REG_STATE_NOT_REG_NOT_SEARCHING; } } } } Loading Loading @@ -173,16 +173,16 @@ public class CellularNetworkService extends NetworkService { // Otherwise, certain services are available only if it's registered on home or roaming // Otherwise, certain services are available only if it's registered on home or roaming // network. // network. if (emergencyOnly) { if (emergencyOnly) { availableServices = new int[] {NetworkRegistrationState.SERVICE_TYPE_EMERGENCY}; availableServices = new int[] {NetworkRegistrationInfo.SERVICE_TYPE_EMERGENCY}; } else if (regState == NetworkRegistrationState.REG_STATE_ROAMING } else if (regState == NetworkRegistrationInfo.REG_STATE_ROAMING || regState == NetworkRegistrationState.REG_STATE_HOME) { || regState == NetworkRegistrationInfo.REG_STATE_HOME) { if (domain == NetworkRegistrationState.DOMAIN_PS) { if (domain == NetworkRegistrationInfo.DOMAIN_PS) { availableServices = new int[] {NetworkRegistrationState.SERVICE_TYPE_DATA}; availableServices = new int[] {NetworkRegistrationInfo.SERVICE_TYPE_DATA}; } else if (domain == NetworkRegistrationState.DOMAIN_CS) { } else if (domain == NetworkRegistrationInfo.DOMAIN_CS) { availableServices = new int[] { availableServices = new int[] { NetworkRegistrationState.SERVICE_TYPE_VOICE, NetworkRegistrationInfo.SERVICE_TYPE_VOICE, NetworkRegistrationState.SERVICE_TYPE_SMS, NetworkRegistrationInfo.SERVICE_TYPE_SMS, NetworkRegistrationState.SERVICE_TYPE_VIDEO NetworkRegistrationInfo.SERVICE_TYPE_VIDEO }; }; } } } } Loading @@ -194,24 +194,24 @@ public class CellularNetworkService extends NetworkService { return ServiceState.rilRadioTechnologyToNetworkType(rilRat); return ServiceState.rilRadioTechnologyToNetworkType(rilRat); } } private NetworkRegistrationState getRegistrationStateFromResult(Object result, int domain) { private NetworkRegistrationInfo getRegistrationStateFromResult(Object result, int domain) { if (result == null) { if (result == null) { return null; return null; } } // TODO: unify when voiceRegStateResult and DataRegStateResult are unified. // TODO: unify when voiceRegStateResult and DataRegStateResult are unified. if (domain == NetworkRegistrationState.DOMAIN_CS) { if (domain == NetworkRegistrationInfo.DOMAIN_CS) { return createRegistrationStateFromVoiceRegState(result); return createRegistrationStateFromVoiceRegState(result); } else if (domain == NetworkRegistrationState.DOMAIN_PS) { } else if (domain == NetworkRegistrationInfo.DOMAIN_PS) { return createRegistrationStateFromDataRegState(result); return createRegistrationStateFromDataRegState(result); } else { } else { return null; return null; } } } } private NetworkRegistrationState createRegistrationStateFromVoiceRegState(Object result) { private NetworkRegistrationInfo createRegistrationStateFromVoiceRegState(Object result) { int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN; int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN; int domain = NetworkRegistrationState.DOMAIN_CS; int domain = NetworkRegistrationInfo.DOMAIN_CS; if (result instanceof android.hardware.radio.V1_0.VoiceRegStateResult) { if (result instanceof android.hardware.radio.V1_0.VoiceRegStateResult) { android.hardware.radio.V1_0.VoiceRegStateResult voiceRegState = android.hardware.radio.V1_0.VoiceRegStateResult voiceRegState = Loading @@ -229,7 +229,7 @@ public class CellularNetworkService extends NetworkService { CellIdentity cellIdentity = CellIdentity cellIdentity = convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity); convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity); return new NetworkRegistrationState(domain, transportType, regState, return new NetworkRegistrationInfo(domain, transportType, regState, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); defaultRoamingIndicator); Loading @@ -249,7 +249,7 @@ public class CellularNetworkService extends NetworkService { CellIdentity cellIdentity = CellIdentity cellIdentity = convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity); convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity); return new NetworkRegistrationState(domain, transportType, regState, return new NetworkRegistrationInfo(domain, transportType, regState, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); defaultRoamingIndicator); Loading @@ -258,8 +258,8 @@ public class CellularNetworkService extends NetworkService { return null; return null; } } private NetworkRegistrationState createRegistrationStateFromDataRegState(Object result) { private NetworkRegistrationInfo createRegistrationStateFromDataRegState(Object result) { int domain = NetworkRegistrationState.DOMAIN_PS; int domain = NetworkRegistrationInfo.DOMAIN_PS; int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN; int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN; if (result instanceof android.hardware.radio.V1_0.DataRegStateResult) { if (result instanceof android.hardware.radio.V1_0.DataRegStateResult) { Loading @@ -276,7 +276,7 @@ public class CellularNetworkService extends NetworkService { LteVopsSupportInfo lteVopsSupportInfo = LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); return new NetworkRegistrationState(domain, transportType, regState, return new NetworkRegistrationInfo(domain, transportType, regState, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, cellIdentity, maxDataCalls, false /* isDcNrRestricted */, cellIdentity, maxDataCalls, false /* isDcNrRestricted */, false /* isNrAvailable */, false /* isEnDcAvailable */, lteVopsSupportInfo); false /* isNrAvailable */, false /* isEnDcAvailable */, lteVopsSupportInfo); Loading @@ -295,7 +295,7 @@ public class CellularNetworkService extends NetworkService { LteVopsSupportInfo lteVopsSupportInfo = LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); return new NetworkRegistrationState(domain, transportType, regState, return new NetworkRegistrationInfo(domain, transportType, regState, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, cellIdentity, maxDataCalls, false /* isDcNrRestricted */, cellIdentity, maxDataCalls, false /* isDcNrRestricted */, false /* isNrAvailable */, false /* isEnDcAvailable */, lteVopsSupportInfo); false /* isNrAvailable */, false /* isEnDcAvailable */, lteVopsSupportInfo); Loading Loading @@ -324,7 +324,7 @@ public class CellularNetworkService extends NetworkService { LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); } } return new NetworkRegistrationState(domain, transportType, regState, return new NetworkRegistrationInfo(domain, transportType, regState, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, cellIdentity, maxDataCalls, nrIndicators.isDcNrRestricted, cellIdentity, maxDataCalls, nrIndicators.isDcNrRestricted, nrIndicators.isNrAvailable, nrIndicators.isEndcAvailable, nrIndicators.isNrAvailable, nrIndicators.isEndcAvailable, Loading Loading @@ -460,21 +460,21 @@ public class CellularNetworkService extends NetworkService { } } @Override @Override public void getNetworkRegistrationState(int domain, NetworkServiceCallback callback) { public void getNetworkRegistrationInfo(int domain, NetworkServiceCallback callback) { if (DBG) log("getNetworkRegistrationState for domain " + domain); if (DBG) log("getNetworkRegistrationInfo for domain " + domain); Message message = null; Message message = null; if (domain == NetworkRegistrationState.DOMAIN_CS) { if (domain == NetworkRegistrationInfo.DOMAIN_CS) { message = Message.obtain(mHandler, GET_CS_REGISTRATION_STATE_DONE); message = Message.obtain(mHandler, GET_CS_REGISTRATION_STATE_DONE); mCallbackMap.put(message, callback); mCallbackMap.put(message, callback); mPhone.mCi.getVoiceRegistrationState(message); mPhone.mCi.getVoiceRegistrationState(message); } else if (domain == NetworkRegistrationState.DOMAIN_PS) { } else if (domain == NetworkRegistrationInfo.DOMAIN_PS) { message = Message.obtain(mHandler, GET_PS_REGISTRATION_STATE_DONE); message = Message.obtain(mHandler, GET_PS_REGISTRATION_STATE_DONE); mCallbackMap.put(message, callback); mCallbackMap.put(message, callback); mPhone.mCi.getDataRegistrationState(message); mPhone.mCi.getDataRegistrationState(message); } else { } else { loge("getNetworkRegistrationState invalid domain " + domain); loge("getNetworkRegistrationInfo invalid domain " + domain); callback.onGetNetworkRegistrationStateComplete( callback.onGetNetworkRegistrationInfoComplete( NetworkServiceCallback.RESULT_ERROR_INVALID_ARG, null); NetworkServiceCallback.RESULT_ERROR_INVALID_ARG, null); } } } } Loading src/java/com/android/internal/telephony/NetworkRegistrationManager.java +13 −13 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,7 @@ import android.telephony.AccessNetworkConstants.TransportType; import android.telephony.CarrierConfigManager; import android.telephony.CarrierConfigManager; import android.telephony.INetworkService; import android.telephony.INetworkService; import android.telephony.INetworkServiceCallback; import android.telephony.INetworkServiceCallback; import android.telephony.NetworkRegistrationState; import android.telephony.NetworkRegistrationInfo; import android.telephony.NetworkService; import android.telephony.NetworkService; import android.telephony.Rlog; import android.telephony.Rlog; import android.telephony.TelephonyManager; import android.telephony.TelephonyManager; Loading Loading @@ -127,24 +127,24 @@ public class NetworkRegistrationManager extends Handler { return (mINetworkService != null) && (mINetworkService.asBinder().isBinderAlive()); return (mINetworkService != null) && (mINetworkService.asBinder().isBinderAlive()); } } public void unregisterForNetworkRegistrationStateChanged(Handler h) { public void unregisterForNetworkRegistrationInfoChanged(Handler h) { mRegStateChangeRegistrants.remove(h); mRegStateChangeRegistrants.remove(h); } } public void registerForNetworkRegistrationStateChanged(Handler h, int what, Object obj) { public void registerForNetworkRegistrationInfoChanged(Handler h, int what, Object obj) { logd("registerForNetworkRegistrationStateChanged"); logd("registerForNetworkRegistrationInfoChanged"); mRegStateChangeRegistrants.addUnique(h, what, obj); mRegStateChangeRegistrants.addUnique(h, what, obj); } } private final Map<NetworkRegStateCallback, Message> mCallbackTable = new Hashtable(); private final Map<NetworkRegStateCallback, Message> mCallbackTable = new Hashtable(); public void getNetworkRegistrationState(@NetworkRegistrationState.Domain int domain, public void getNetworkRegistrationInfo(@NetworkRegistrationInfo.Domain int domain, Message onCompleteMessage) { Message onCompleteMessage) { if (onCompleteMessage == null) return; if (onCompleteMessage == null) return; if (!isServiceConnected()) { if (!isServiceConnected()) { loge("service not connected. Domain = " loge("service not connected. Domain = " + ((domain == NetworkRegistrationState.DOMAIN_CS) ? "CS" : "PS")); + ((domain == NetworkRegistrationInfo.DOMAIN_CS) ? "CS" : "PS")); onCompleteMessage.obj = new AsyncResult(onCompleteMessage.obj, null, onCompleteMessage.obj = new AsyncResult(onCompleteMessage.obj, null, new IllegalStateException("Service not connected.")); new IllegalStateException("Service not connected.")); onCompleteMessage.sendToTarget(); onCompleteMessage.sendToTarget(); Loading @@ -154,9 +154,9 @@ public class NetworkRegistrationManager extends Handler { NetworkRegStateCallback callback = new NetworkRegStateCallback(); NetworkRegStateCallback callback = new NetworkRegStateCallback(); try { try { mCallbackTable.put(callback, onCompleteMessage); mCallbackTable.put(callback, onCompleteMessage); mINetworkService.getNetworkRegistrationState(mPhone.getPhoneId(), domain, callback); mINetworkService.getNetworkRegistrationInfo(mPhone.getPhoneId(), domain, callback); } catch (RemoteException e) { } catch (RemoteException e) { loge("getNetworkRegistrationState RemoteException " + e); loge("getNetworkRegistrationInfo RemoteException " + e); mCallbackTable.remove(callback); mCallbackTable.remove(callback); onCompleteMessage.obj = new AsyncResult(onCompleteMessage.obj, null, e); onCompleteMessage.obj = new AsyncResult(onCompleteMessage.obj, null, e); onCompleteMessage.sendToTarget(); onCompleteMessage.sendToTarget(); Loading Loading @@ -190,7 +190,7 @@ public class NetworkRegistrationManager extends Handler { try { try { service.linkToDeath(mDeathRecipient, 0); service.linkToDeath(mDeathRecipient, 0); mINetworkService.createNetworkServiceProvider(mPhone.getPhoneId()); mINetworkService.createNetworkServiceProvider(mPhone.getPhoneId()); mINetworkService.registerForNetworkRegistrationStateChanged(mPhone.getPhoneId(), mINetworkService.registerForNetworkRegistrationInfoChanged(mPhone.getPhoneId(), new NetworkRegStateCallback()); new NetworkRegStateCallback()); } catch (RemoteException exception) { } catch (RemoteException exception) { // Remote exception means that the binder already died. // Remote exception means that the binder already died. Loading @@ -213,9 +213,9 @@ public class NetworkRegistrationManager extends Handler { private class NetworkRegStateCallback extends INetworkServiceCallback.Stub { private class NetworkRegStateCallback extends INetworkServiceCallback.Stub { @Override @Override public void onGetNetworkRegistrationStateComplete( public void onGetNetworkRegistrationInfoComplete( int result, NetworkRegistrationState state) { int result, NetworkRegistrationInfo state) { logd("onGetNetworkRegistrationStateComplete result " logd("onGetNetworkRegistrationInfoComplete result " + result + " state " + state); + result + " state " + state); Message onCompleteMessage = mCallbackTable.remove(this); Message onCompleteMessage = mCallbackTable.remove(this); if (onCompleteMessage != null) { if (onCompleteMessage != null) { Loading Loading
src/java/com/android/internal/telephony/CellularNetworkService.java +41 −41 Original line number Original line Diff line number Diff line Loading @@ -32,7 +32,7 @@ import android.telephony.CellIdentityLte; import android.telephony.CellIdentityTdscdma; import android.telephony.CellIdentityTdscdma; import android.telephony.CellIdentityWcdma; import android.telephony.CellIdentityWcdma; import android.telephony.LteVopsSupportInfo; import android.telephony.LteVopsSupportInfo; import android.telephony.NetworkRegistrationState; import android.telephony.NetworkRegistrationInfo; import android.telephony.NetworkService; import android.telephony.NetworkService; import android.telephony.NetworkServiceCallback; import android.telephony.NetworkServiceCallback; import android.telephony.Rlog; import android.telephony.Rlog; Loading Loading @@ -88,9 +88,9 @@ public class CellularNetworkService extends NetworkService { if (callback == null) return; if (callback == null) return; ar = (AsyncResult) message.obj; ar = (AsyncResult) message.obj; int domain = (message.what == GET_CS_REGISTRATION_STATE_DONE) int domain = (message.what == GET_CS_REGISTRATION_STATE_DONE) ? NetworkRegistrationState.DOMAIN_CS ? NetworkRegistrationInfo.DOMAIN_CS : NetworkRegistrationState.DOMAIN_PS; : NetworkRegistrationInfo.DOMAIN_PS; NetworkRegistrationState netState = NetworkRegistrationInfo netState = getRegistrationStateFromResult(ar.result, domain); getRegistrationStateFromResult(ar.result, domain); int resultCode; int resultCode; Loading @@ -102,18 +102,18 @@ public class CellularNetworkService extends NetworkService { try { try { if (DBG) { if (DBG) { log("Calling callback.onGetNetworkRegistrationStateComplete." log("Calling callback.onGetNetworkRegistrationInfoComplete." + "resultCode = " + resultCode + "resultCode = " + resultCode + ", netState = " + netState); + ", netState = " + netState); } } callback.onGetNetworkRegistrationStateComplete( callback.onGetNetworkRegistrationInfoComplete( resultCode, netState); resultCode, netState); } catch (Exception e) { } catch (Exception e) { loge("Exception: " + e); loge("Exception: " + e); } } break; break; case NETWORK_REGISTRATION_STATE_CHANGED: case NETWORK_REGISTRATION_STATE_CHANGED: notifyNetworkRegistrationStateChanged(); notifyNetworkRegistrationInfoChanged(); break; break; default: default: return; return; Loading @@ -129,22 +129,22 @@ public class CellularNetworkService extends NetworkService { switch (halRegState) { switch (halRegState) { case RegState.NOT_REG_MT_NOT_SEARCHING_OP: case RegState.NOT_REG_MT_NOT_SEARCHING_OP: case RegState.NOT_REG_MT_NOT_SEARCHING_OP_EM: case RegState.NOT_REG_MT_NOT_SEARCHING_OP_EM: return NetworkRegistrationState.REG_STATE_NOT_REG_NOT_SEARCHING; return NetworkRegistrationInfo.REG_STATE_NOT_REG_NOT_SEARCHING; case RegState.REG_HOME: case RegState.REG_HOME: return NetworkRegistrationState.REG_STATE_HOME; return NetworkRegistrationInfo.REG_STATE_HOME; case RegState.NOT_REG_MT_SEARCHING_OP: case RegState.NOT_REG_MT_SEARCHING_OP: case RegState.NOT_REG_MT_SEARCHING_OP_EM: case RegState.NOT_REG_MT_SEARCHING_OP_EM: return NetworkRegistrationState.REG_STATE_NOT_REG_SEARCHING; return NetworkRegistrationInfo.REG_STATE_NOT_REG_SEARCHING; case RegState.REG_DENIED: case RegState.REG_DENIED: case RegState.REG_DENIED_EM: case RegState.REG_DENIED_EM: return NetworkRegistrationState.REG_STATE_DENIED; return NetworkRegistrationInfo.REG_STATE_DENIED; case RegState.UNKNOWN: case RegState.UNKNOWN: case RegState.UNKNOWN_EM: case RegState.UNKNOWN_EM: return NetworkRegistrationState.REG_STATE_UNKNOWN; return NetworkRegistrationInfo.REG_STATE_UNKNOWN; case RegState.REG_ROAMING: case RegState.REG_ROAMING: return NetworkRegistrationState.REG_STATE_ROAMING; return NetworkRegistrationInfo.REG_STATE_ROAMING; default: default: return NetworkRegistrationState.REG_STATE_NOT_REG_NOT_SEARCHING; return NetworkRegistrationInfo.REG_STATE_NOT_REG_NOT_SEARCHING; } } } } Loading Loading @@ -173,16 +173,16 @@ public class CellularNetworkService extends NetworkService { // Otherwise, certain services are available only if it's registered on home or roaming // Otherwise, certain services are available only if it's registered on home or roaming // network. // network. if (emergencyOnly) { if (emergencyOnly) { availableServices = new int[] {NetworkRegistrationState.SERVICE_TYPE_EMERGENCY}; availableServices = new int[] {NetworkRegistrationInfo.SERVICE_TYPE_EMERGENCY}; } else if (regState == NetworkRegistrationState.REG_STATE_ROAMING } else if (regState == NetworkRegistrationInfo.REG_STATE_ROAMING || regState == NetworkRegistrationState.REG_STATE_HOME) { || regState == NetworkRegistrationInfo.REG_STATE_HOME) { if (domain == NetworkRegistrationState.DOMAIN_PS) { if (domain == NetworkRegistrationInfo.DOMAIN_PS) { availableServices = new int[] {NetworkRegistrationState.SERVICE_TYPE_DATA}; availableServices = new int[] {NetworkRegistrationInfo.SERVICE_TYPE_DATA}; } else if (domain == NetworkRegistrationState.DOMAIN_CS) { } else if (domain == NetworkRegistrationInfo.DOMAIN_CS) { availableServices = new int[] { availableServices = new int[] { NetworkRegistrationState.SERVICE_TYPE_VOICE, NetworkRegistrationInfo.SERVICE_TYPE_VOICE, NetworkRegistrationState.SERVICE_TYPE_SMS, NetworkRegistrationInfo.SERVICE_TYPE_SMS, NetworkRegistrationState.SERVICE_TYPE_VIDEO NetworkRegistrationInfo.SERVICE_TYPE_VIDEO }; }; } } } } Loading @@ -194,24 +194,24 @@ public class CellularNetworkService extends NetworkService { return ServiceState.rilRadioTechnologyToNetworkType(rilRat); return ServiceState.rilRadioTechnologyToNetworkType(rilRat); } } private NetworkRegistrationState getRegistrationStateFromResult(Object result, int domain) { private NetworkRegistrationInfo getRegistrationStateFromResult(Object result, int domain) { if (result == null) { if (result == null) { return null; return null; } } // TODO: unify when voiceRegStateResult and DataRegStateResult are unified. // TODO: unify when voiceRegStateResult and DataRegStateResult are unified. if (domain == NetworkRegistrationState.DOMAIN_CS) { if (domain == NetworkRegistrationInfo.DOMAIN_CS) { return createRegistrationStateFromVoiceRegState(result); return createRegistrationStateFromVoiceRegState(result); } else if (domain == NetworkRegistrationState.DOMAIN_PS) { } else if (domain == NetworkRegistrationInfo.DOMAIN_PS) { return createRegistrationStateFromDataRegState(result); return createRegistrationStateFromDataRegState(result); } else { } else { return null; return null; } } } } private NetworkRegistrationState createRegistrationStateFromVoiceRegState(Object result) { private NetworkRegistrationInfo createRegistrationStateFromVoiceRegState(Object result) { int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN; int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN; int domain = NetworkRegistrationState.DOMAIN_CS; int domain = NetworkRegistrationInfo.DOMAIN_CS; if (result instanceof android.hardware.radio.V1_0.VoiceRegStateResult) { if (result instanceof android.hardware.radio.V1_0.VoiceRegStateResult) { android.hardware.radio.V1_0.VoiceRegStateResult voiceRegState = android.hardware.radio.V1_0.VoiceRegStateResult voiceRegState = Loading @@ -229,7 +229,7 @@ public class CellularNetworkService extends NetworkService { CellIdentity cellIdentity = CellIdentity cellIdentity = convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity); convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity); return new NetworkRegistrationState(domain, transportType, regState, return new NetworkRegistrationInfo(domain, transportType, regState, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); defaultRoamingIndicator); Loading @@ -249,7 +249,7 @@ public class CellularNetworkService extends NetworkService { CellIdentity cellIdentity = CellIdentity cellIdentity = convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity); convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity); return new NetworkRegistrationState(domain, transportType, regState, return new NetworkRegistrationInfo(domain, transportType, regState, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); defaultRoamingIndicator); Loading @@ -258,8 +258,8 @@ public class CellularNetworkService extends NetworkService { return null; return null; } } private NetworkRegistrationState createRegistrationStateFromDataRegState(Object result) { private NetworkRegistrationInfo createRegistrationStateFromDataRegState(Object result) { int domain = NetworkRegistrationState.DOMAIN_PS; int domain = NetworkRegistrationInfo.DOMAIN_PS; int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN; int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN; if (result instanceof android.hardware.radio.V1_0.DataRegStateResult) { if (result instanceof android.hardware.radio.V1_0.DataRegStateResult) { Loading @@ -276,7 +276,7 @@ public class CellularNetworkService extends NetworkService { LteVopsSupportInfo lteVopsSupportInfo = LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); return new NetworkRegistrationState(domain, transportType, regState, return new NetworkRegistrationInfo(domain, transportType, regState, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, cellIdentity, maxDataCalls, false /* isDcNrRestricted */, cellIdentity, maxDataCalls, false /* isDcNrRestricted */, false /* isNrAvailable */, false /* isEnDcAvailable */, lteVopsSupportInfo); false /* isNrAvailable */, false /* isEnDcAvailable */, lteVopsSupportInfo); Loading @@ -295,7 +295,7 @@ public class CellularNetworkService extends NetworkService { LteVopsSupportInfo lteVopsSupportInfo = LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); return new NetworkRegistrationState(domain, transportType, regState, return new NetworkRegistrationInfo(domain, transportType, regState, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, cellIdentity, maxDataCalls, false /* isDcNrRestricted */, cellIdentity, maxDataCalls, false /* isDcNrRestricted */, false /* isNrAvailable */, false /* isEnDcAvailable */, lteVopsSupportInfo); false /* isNrAvailable */, false /* isEnDcAvailable */, lteVopsSupportInfo); Loading Loading @@ -324,7 +324,7 @@ public class CellularNetworkService extends NetworkService { LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); } } return new NetworkRegistrationState(domain, transportType, regState, return new NetworkRegistrationInfo(domain, transportType, regState, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices, cellIdentity, maxDataCalls, nrIndicators.isDcNrRestricted, cellIdentity, maxDataCalls, nrIndicators.isDcNrRestricted, nrIndicators.isNrAvailable, nrIndicators.isEndcAvailable, nrIndicators.isNrAvailable, nrIndicators.isEndcAvailable, Loading Loading @@ -460,21 +460,21 @@ public class CellularNetworkService extends NetworkService { } } @Override @Override public void getNetworkRegistrationState(int domain, NetworkServiceCallback callback) { public void getNetworkRegistrationInfo(int domain, NetworkServiceCallback callback) { if (DBG) log("getNetworkRegistrationState for domain " + domain); if (DBG) log("getNetworkRegistrationInfo for domain " + domain); Message message = null; Message message = null; if (domain == NetworkRegistrationState.DOMAIN_CS) { if (domain == NetworkRegistrationInfo.DOMAIN_CS) { message = Message.obtain(mHandler, GET_CS_REGISTRATION_STATE_DONE); message = Message.obtain(mHandler, GET_CS_REGISTRATION_STATE_DONE); mCallbackMap.put(message, callback); mCallbackMap.put(message, callback); mPhone.mCi.getVoiceRegistrationState(message); mPhone.mCi.getVoiceRegistrationState(message); } else if (domain == NetworkRegistrationState.DOMAIN_PS) { } else if (domain == NetworkRegistrationInfo.DOMAIN_PS) { message = Message.obtain(mHandler, GET_PS_REGISTRATION_STATE_DONE); message = Message.obtain(mHandler, GET_PS_REGISTRATION_STATE_DONE); mCallbackMap.put(message, callback); mCallbackMap.put(message, callback); mPhone.mCi.getDataRegistrationState(message); mPhone.mCi.getDataRegistrationState(message); } else { } else { loge("getNetworkRegistrationState invalid domain " + domain); loge("getNetworkRegistrationInfo invalid domain " + domain); callback.onGetNetworkRegistrationStateComplete( callback.onGetNetworkRegistrationInfoComplete( NetworkServiceCallback.RESULT_ERROR_INVALID_ARG, null); NetworkServiceCallback.RESULT_ERROR_INVALID_ARG, null); } } } } Loading
src/java/com/android/internal/telephony/NetworkRegistrationManager.java +13 −13 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,7 @@ import android.telephony.AccessNetworkConstants.TransportType; import android.telephony.CarrierConfigManager; import android.telephony.CarrierConfigManager; import android.telephony.INetworkService; import android.telephony.INetworkService; import android.telephony.INetworkServiceCallback; import android.telephony.INetworkServiceCallback; import android.telephony.NetworkRegistrationState; import android.telephony.NetworkRegistrationInfo; import android.telephony.NetworkService; import android.telephony.NetworkService; import android.telephony.Rlog; import android.telephony.Rlog; import android.telephony.TelephonyManager; import android.telephony.TelephonyManager; Loading Loading @@ -127,24 +127,24 @@ public class NetworkRegistrationManager extends Handler { return (mINetworkService != null) && (mINetworkService.asBinder().isBinderAlive()); return (mINetworkService != null) && (mINetworkService.asBinder().isBinderAlive()); } } public void unregisterForNetworkRegistrationStateChanged(Handler h) { public void unregisterForNetworkRegistrationInfoChanged(Handler h) { mRegStateChangeRegistrants.remove(h); mRegStateChangeRegistrants.remove(h); } } public void registerForNetworkRegistrationStateChanged(Handler h, int what, Object obj) { public void registerForNetworkRegistrationInfoChanged(Handler h, int what, Object obj) { logd("registerForNetworkRegistrationStateChanged"); logd("registerForNetworkRegistrationInfoChanged"); mRegStateChangeRegistrants.addUnique(h, what, obj); mRegStateChangeRegistrants.addUnique(h, what, obj); } } private final Map<NetworkRegStateCallback, Message> mCallbackTable = new Hashtable(); private final Map<NetworkRegStateCallback, Message> mCallbackTable = new Hashtable(); public void getNetworkRegistrationState(@NetworkRegistrationState.Domain int domain, public void getNetworkRegistrationInfo(@NetworkRegistrationInfo.Domain int domain, Message onCompleteMessage) { Message onCompleteMessage) { if (onCompleteMessage == null) return; if (onCompleteMessage == null) return; if (!isServiceConnected()) { if (!isServiceConnected()) { loge("service not connected. Domain = " loge("service not connected. Domain = " + ((domain == NetworkRegistrationState.DOMAIN_CS) ? "CS" : "PS")); + ((domain == NetworkRegistrationInfo.DOMAIN_CS) ? "CS" : "PS")); onCompleteMessage.obj = new AsyncResult(onCompleteMessage.obj, null, onCompleteMessage.obj = new AsyncResult(onCompleteMessage.obj, null, new IllegalStateException("Service not connected.")); new IllegalStateException("Service not connected.")); onCompleteMessage.sendToTarget(); onCompleteMessage.sendToTarget(); Loading @@ -154,9 +154,9 @@ public class NetworkRegistrationManager extends Handler { NetworkRegStateCallback callback = new NetworkRegStateCallback(); NetworkRegStateCallback callback = new NetworkRegStateCallback(); try { try { mCallbackTable.put(callback, onCompleteMessage); mCallbackTable.put(callback, onCompleteMessage); mINetworkService.getNetworkRegistrationState(mPhone.getPhoneId(), domain, callback); mINetworkService.getNetworkRegistrationInfo(mPhone.getPhoneId(), domain, callback); } catch (RemoteException e) { } catch (RemoteException e) { loge("getNetworkRegistrationState RemoteException " + e); loge("getNetworkRegistrationInfo RemoteException " + e); mCallbackTable.remove(callback); mCallbackTable.remove(callback); onCompleteMessage.obj = new AsyncResult(onCompleteMessage.obj, null, e); onCompleteMessage.obj = new AsyncResult(onCompleteMessage.obj, null, e); onCompleteMessage.sendToTarget(); onCompleteMessage.sendToTarget(); Loading Loading @@ -190,7 +190,7 @@ public class NetworkRegistrationManager extends Handler { try { try { service.linkToDeath(mDeathRecipient, 0); service.linkToDeath(mDeathRecipient, 0); mINetworkService.createNetworkServiceProvider(mPhone.getPhoneId()); mINetworkService.createNetworkServiceProvider(mPhone.getPhoneId()); mINetworkService.registerForNetworkRegistrationStateChanged(mPhone.getPhoneId(), mINetworkService.registerForNetworkRegistrationInfoChanged(mPhone.getPhoneId(), new NetworkRegStateCallback()); new NetworkRegStateCallback()); } catch (RemoteException exception) { } catch (RemoteException exception) { // Remote exception means that the binder already died. // Remote exception means that the binder already died. Loading @@ -213,9 +213,9 @@ public class NetworkRegistrationManager extends Handler { private class NetworkRegStateCallback extends INetworkServiceCallback.Stub { private class NetworkRegStateCallback extends INetworkServiceCallback.Stub { @Override @Override public void onGetNetworkRegistrationStateComplete( public void onGetNetworkRegistrationInfoComplete( int result, NetworkRegistrationState state) { int result, NetworkRegistrationInfo state) { logd("onGetNetworkRegistrationStateComplete result " logd("onGetNetworkRegistrationInfoComplete result " + result + " state " + state); + result + " state " + state); Message onCompleteMessage = mCallbackTable.remove(this); Message onCompleteMessage = mCallbackTable.remove(this); if (onCompleteMessage != null) { if (onCompleteMessage != null) { Loading