diff options
| -rw-r--r-- | api/system-current.txt | 48 | ||||
| -rw-r--r-- | packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java | 6 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java | 8 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java | 8 | ||||
| -rw-r--r-- | telephony/java/android/telephony/INetworkService.aidl | 6 | ||||
| -rw-r--r-- | telephony/java/android/telephony/INetworkServiceCallback.aidl | 4 | ||||
| -rw-r--r-- | telephony/java/android/telephony/NetworkRegistrationInfo.aidl (renamed from telephony/java/android/telephony/NetworkRegistrationState.aidl) | 2 | ||||
| -rw-r--r-- | telephony/java/android/telephony/NetworkRegistrationInfo.java (renamed from telephony/java/android/telephony/NetworkRegistrationState.java) | 94 | ||||
| -rw-r--r-- | telephony/java/android/telephony/NetworkService.java | 72 | ||||
| -rw-r--r-- | telephony/java/android/telephony/NetworkServiceCallback.java | 14 | ||||
| -rw-r--r-- | telephony/java/android/telephony/ServiceState.java | 220 |
11 files changed, 225 insertions, 257 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index d372e89a679a..fcd95166efc6 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6031,8 +6031,8 @@ package android.telephony { field public static final String MBMS_STREAMING_SERVICE_ACTION = "android.telephony.action.EmbmsStreaming"; } - public class NetworkRegistrationState implements android.os.Parcelable { - ctor public NetworkRegistrationState(int, int, int, int, int, boolean, @NonNull int[], @Nullable android.telephony.CellIdentity); + public class NetworkRegistrationInfo implements android.os.Parcelable { + ctor public NetworkRegistrationInfo(int, int, int, int, int, boolean, @NonNull int[], @Nullable android.telephony.CellIdentity); method public int describeContents(); method public int getAccessNetworkTechnology(); method @NonNull public int[] getAvailableServices(); @@ -6046,7 +6046,7 @@ package android.telephony { method public boolean isEmergencyEnabled(); method public boolean isRoaming(); method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationState> CREATOR; + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationInfo> CREATOR; field public static final int DOMAIN_CS = 1; // 0x1 field public static final int DOMAIN_PS = 2; // 0x2 field public static final int REG_STATE_DENIED = 3; // 0x3 @@ -6062,19 +6062,19 @@ package android.telephony { field public static final int SERVICE_TYPE_VOICE = 1; // 0x1 } - public static class NetworkRegistrationState.Builder { - ctor public NetworkRegistrationState.Builder(); - method @NonNull public android.telephony.NetworkRegistrationState build(); - method @NonNull public android.telephony.NetworkRegistrationState.Builder setAccessNetworkTechnology(int); - method @NonNull public android.telephony.NetworkRegistrationState.Builder setAvailableServices(@NonNull int[]); - method @NonNull public android.telephony.NetworkRegistrationState.Builder setCellIdentity(@Nullable android.telephony.CellIdentity); - method @NonNull public android.telephony.NetworkRegistrationState.Builder setDomain(int); - method @NonNull public android.telephony.NetworkRegistrationState.Builder setEmergencyOnly(boolean); - method @NonNull public android.telephony.NetworkRegistrationState.Builder setNrStatus(int); - method @NonNull public android.telephony.NetworkRegistrationState.Builder setRegState(int); - method @NonNull public android.telephony.NetworkRegistrationState.Builder setRejectCause(int); - method @NonNull public android.telephony.NetworkRegistrationState.Builder setRoamingType(int); - method @NonNull public android.telephony.NetworkRegistrationState.Builder setTransportType(int); + public static class NetworkRegistrationInfo.Builder { + ctor public NetworkRegistrationInfo.Builder(); + method @NonNull public android.telephony.NetworkRegistrationInfo build(); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setAccessNetworkTechnology(int); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setAvailableServices(@NonNull int[]); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setCellIdentity(@Nullable android.telephony.CellIdentity); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setDomain(int); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setEmergencyOnly(boolean); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setNrStatus(int); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRegState(int); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRejectCause(int); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setRoamingType(int); + method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setTransportType(int); } public abstract class NetworkService extends android.app.Service { @@ -6087,13 +6087,13 @@ package android.telephony { public abstract class NetworkService.NetworkServiceProvider implements java.lang.AutoCloseable { ctor public NetworkService.NetworkServiceProvider(int); method public abstract void close(); - method public void getNetworkRegistrationState(int, @NonNull android.telephony.NetworkServiceCallback); + method public void getNetworkRegistrationInfo(int, @NonNull android.telephony.NetworkServiceCallback); method public final int getSlotIndex(); - method public final void notifyNetworkRegistrationStateChanged(); + method public final void notifyNetworkRegistrationInfoChanged(); } public class NetworkServiceCallback { - method public void onGetNetworkRegistrationStateComplete(int, @Nullable android.telephony.NetworkRegistrationState); + method public void onGetNetworkRegistrationInfoComplete(int, @Nullable android.telephony.NetworkRegistrationInfo); field public static final int RESULT_ERROR_BUSY = 3; // 0x3 field public static final int RESULT_ERROR_FAILED = 5; // 0x5 field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4 @@ -6268,12 +6268,10 @@ package android.telephony { } public class ServiceState implements android.os.Parcelable { - method @Nullable public android.telephony.NetworkRegistrationState getNetworkRegistrationState(int, int); - method @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates(); - method @Deprecated @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStates(int); - method @Deprecated @Nullable public android.telephony.NetworkRegistrationState getNetworkRegistrationStates(int, int); - method @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStatesForDomain(int); - method @NonNull public java.util.List<android.telephony.NetworkRegistrationState> getNetworkRegistrationStatesForTransportType(int); + method @Nullable public android.telephony.NetworkRegistrationInfo getNetworkRegistrationInfo(int, int); + method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoList(); + method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoListForDomain(int); + method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoListForTransportType(int); field public static final int ROAMING_TYPE_DOMESTIC = 2; // 0x2 field public static final int ROAMING_TYPE_INTERNATIONAL = 3; // 0x3 field public static final int ROAMING_TYPE_NOT_ROAMING = 0; // 0x0 diff --git a/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java b/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java index bcfc412c6f4e..b238ae4a066a 100644 --- a/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java +++ b/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java @@ -72,7 +72,7 @@ import android.os.UserHandle; import android.provider.Settings; import android.telephony.AccessNetworkConstants; import android.telephony.CellSignalStrength; -import android.telephony.NetworkRegistrationState; +import android.telephony.NetworkRegistrationInfo; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.TelephonyManager; @@ -1615,8 +1615,8 @@ public class NetworkMonitor extends StateMachine { return; } // See if the data sub is registered for PS services on cell. - final NetworkRegistrationState nrs = dataSs.getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_PS, + final NetworkRegistrationInfo nrs = dataSs.getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); latencyBroadcast.putExtra( NetworkMonitorUtils.EXTRA_CELL_ID, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index 9734918f624c..e2ac0420395b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -22,7 +22,7 @@ import android.net.NetworkCapabilities; import android.os.Handler; import android.os.Looper; import android.provider.Settings.Global; -import android.telephony.NetworkRegistrationState; +import android.telephony.NetworkRegistrationInfo; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.SignalStrength; @@ -495,7 +495,7 @@ public class MobileSignalController extends SignalController< if (mServiceState == null) return null; int nrStatus = mServiceState.getNrStatus(); - if (nrStatus == NetworkRegistrationState.NR_STATUS_CONNECTED) { + if (nrStatus == NetworkRegistrationInfo.NR_STATUS_CONNECTED) { // Check if the NR 5G is using millimeter wave and the icon is config. if (mServiceState.getNrFrequencyRange() == ServiceState.FREQUENCY_RANGE_MMWAVE) { if (mConfig.nr5GIconMap.containsKey(Config.NR_CONNECTED_MMWAVE)) { @@ -508,11 +508,11 @@ public class MobileSignalController extends SignalController< if (mConfig.nr5GIconMap.containsKey(Config.NR_CONNECTED)) { return mConfig.nr5GIconMap.get(Config.NR_CONNECTED); } - } else if (nrStatus == NetworkRegistrationState.NR_STATUS_NOT_RESTRICTED) { + } else if (nrStatus == NetworkRegistrationInfo.NR_STATUS_NOT_RESTRICTED) { if (mConfig.nr5GIconMap.containsKey(Config.NR_NOT_RESTRICTED)) { return mConfig.nr5GIconMap.get(Config.NR_NOT_RESTRICTED); } - } else if (nrStatus == NetworkRegistrationState.NR_STATUS_RESTRICTED) { + } else if (nrStatus == NetworkRegistrationInfo.NR_STATUS_RESTRICTED) { if (mConfig.nr5GIconMap.containsKey(Config.NR_RESTRICTED)) { return mConfig.nr5GIconMap.get(Config.NR_RESTRICTED); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java index 2baea1ae3b19..5786796d980f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java @@ -7,7 +7,7 @@ import static org.mockito.Mockito.when; import android.net.NetworkCapabilities; import android.os.Looper; -import android.telephony.NetworkRegistrationState; +import android.telephony.NetworkRegistrationInfo; import android.telephony.ServiceState; import android.telephony.TelephonyManager; import android.test.suitebuilder.annotation.SmallTest; @@ -151,7 +151,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest { updateDataConnectionState(TelephonyManager.DATA_CONNECTED, TelephonyManager.NETWORK_TYPE_LTE); ServiceState ss = Mockito.mock(ServiceState.class); - doReturn(NetworkRegistrationState.NR_STATUS_CONNECTED).when(ss).getNrStatus(); + doReturn(NetworkRegistrationInfo.NR_STATUS_CONNECTED).when(ss).getNrStatus(); doReturn(ServiceState.FREQUENCY_RANGE_HIGH).when(ss).getNrFrequencyRange(); mPhoneStateListener.onServiceStateChanged(ss); @@ -165,7 +165,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest { updateDataConnectionState(TelephonyManager.DATA_CONNECTED, TelephonyManager.NETWORK_TYPE_LTE); ServiceState ss = Mockito.mock(ServiceState.class); - doReturn(NetworkRegistrationState.NR_STATUS_CONNECTED).when(ss).getNrStatus(); + doReturn(NetworkRegistrationInfo.NR_STATUS_CONNECTED).when(ss).getNrStatus(); doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(ss).getNrFrequencyRange(); mPhoneStateListener.onServiceStateChanged(ss); @@ -179,7 +179,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest { updateDataConnectionState(TelephonyManager.DATA_CONNECTED, TelephonyManager.NETWORK_TYPE_LTE); ServiceState ss = Mockito.mock(ServiceState.class); - doReturn(NetworkRegistrationState.NR_STATUS_RESTRICTED).when(ss).getNrStatus(); + doReturn(NetworkRegistrationInfo.NR_STATUS_RESTRICTED).when(ss).getNrStatus(); mPhoneStateListener.onServiceStateChanged(mServiceState); verifyDataIndicators(TelephonyIcons.ICON_LTE); diff --git a/telephony/java/android/telephony/INetworkService.aidl b/telephony/java/android/telephony/INetworkService.aidl index 9ef7186e8ae1..67e5650ab359 100644 --- a/telephony/java/android/telephony/INetworkService.aidl +++ b/telephony/java/android/telephony/INetworkService.aidl @@ -25,7 +25,7 @@ oneway interface INetworkService { void createNetworkServiceProvider(int slotId); void removeNetworkServiceProvider(int slotId); - void getNetworkRegistrationState(int slotId, int domain, INetworkServiceCallback callback); - void registerForNetworkRegistrationStateChanged(int slotId, INetworkServiceCallback callback); - void unregisterForNetworkRegistrationStateChanged(int slotId, INetworkServiceCallback callback); + void getNetworkRegistrationInfo(int slotId, int domain, INetworkServiceCallback callback); + void registerForNetworkRegistrationInfoChanged(int slotId, INetworkServiceCallback callback); + void unregisterForNetworkRegistrationInfoChanged(int slotId, INetworkServiceCallback callback); } diff --git a/telephony/java/android/telephony/INetworkServiceCallback.aidl b/telephony/java/android/telephony/INetworkServiceCallback.aidl index 520598ff9144..33b3ac0940b5 100644 --- a/telephony/java/android/telephony/INetworkServiceCallback.aidl +++ b/telephony/java/android/telephony/INetworkServiceCallback.aidl @@ -16,7 +16,7 @@ package android.telephony; -import android.telephony.NetworkRegistrationState; +import android.telephony.NetworkRegistrationInfo; /** * Network service call back interface @@ -24,6 +24,6 @@ import android.telephony.NetworkRegistrationState; */ oneway interface INetworkServiceCallback { - void onGetNetworkRegistrationStateComplete(int result, in NetworkRegistrationState state); + void onGetNetworkRegistrationInfoComplete(int result, in NetworkRegistrationInfo state); void onNetworkStateChanged(); } diff --git a/telephony/java/android/telephony/NetworkRegistrationState.aidl b/telephony/java/android/telephony/NetworkRegistrationInfo.aidl index 98cba7720603..5c803bf69f69 100644 --- a/telephony/java/android/telephony/NetworkRegistrationState.aidl +++ b/telephony/java/android/telephony/NetworkRegistrationInfo.aidl @@ -16,4 +16,4 @@ package android.telephony; -parcelable NetworkRegistrationState; +parcelable NetworkRegistrationInfo; diff --git a/telephony/java/android/telephony/NetworkRegistrationState.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java index 74f200b94510..c31a14edff10 100644 --- a/telephony/java/android/telephony/NetworkRegistrationState.java +++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java @@ -32,11 +32,11 @@ import java.util.Objects; import java.util.stream.Collectors; /** - * Description of a mobile network registration state + * Description of a mobile network registration info * @hide */ @SystemApi -public class NetworkRegistrationState implements Parcelable { +public class NetworkRegistrationInfo implements Parcelable { /** * Network domain * @hide @@ -184,12 +184,12 @@ public class NetworkRegistrationState implements Parcelable { * @param cellIdentity The identity representing a unique cell or wifi AP. Set to null if the * information is not available. */ - public NetworkRegistrationState(@Domain int domain, @TransportType int transportType, - @RegState int regState, - @NetworkType int accessNetworkTechnology, int rejectCause, - boolean emergencyOnly, - @NonNull @ServiceType int[] availableServices, - @Nullable CellIdentity cellIdentity) { + public NetworkRegistrationInfo(@Domain int domain, @TransportType int transportType, + @RegState int regState, + @NetworkType int accessNetworkTechnology, int rejectCause, + boolean emergencyOnly, + @NonNull @ServiceType int[] availableServices, + @Nullable CellIdentity cellIdentity) { mDomain = domain; mTransportType = transportType; mRegState = regState; @@ -204,13 +204,15 @@ public class NetworkRegistrationState implements Parcelable { } /** - * Constructor for voice network registration states. + * Constructor for voice network registration info. * @hide */ - public NetworkRegistrationState(int domain, @TransportType int transportType, int regState, - int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, - int[] availableServices, @Nullable CellIdentity cellIdentity, boolean cssSupported, - int roamingIndicator, int systemIsInPrl, int defaultRoamingIndicator) { + public NetworkRegistrationInfo(int domain, @TransportType int transportType, int regState, + int accessNetworkTechnology, int rejectCause, + boolean emergencyOnly, int[] availableServices, + @Nullable CellIdentity cellIdentity, boolean cssSupported, + int roamingIndicator, int systemIsInPrl, + int defaultRoamingIndicator) { this(domain, transportType, regState, accessNetworkTechnology, rejectCause, emergencyOnly, availableServices, cellIdentity); @@ -219,14 +221,16 @@ public class NetworkRegistrationState implements Parcelable { } /** - * Constructor for data network registration states. + * Constructor for data network registration info. * @hide */ - public NetworkRegistrationState(int domain, @TransportType int transportType, int regState, - int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, - int[] availableServices, @Nullable CellIdentity cellIdentity, int maxDataCalls, - boolean isDcNrRestricted, boolean isNrAvailable, boolean isEndcAvailable, - LteVopsSupportInfo lteVopsSupportInfo) { + public NetworkRegistrationInfo(int domain, @TransportType int transportType, int regState, + int accessNetworkTechnology, int rejectCause, + boolean emergencyOnly, int[] availableServices, + @Nullable CellIdentity cellIdentity, int maxDataCalls, + boolean isDcNrRestricted, boolean isNrAvailable, + boolean isEndcAvailable, + LteVopsSupportInfo lteVopsSupportInfo) { this(domain, transportType, regState, accessNetworkTechnology, rejectCause, emergencyOnly, availableServices, cellIdentity); @@ -235,7 +239,7 @@ public class NetworkRegistrationState implements Parcelable { updateNrStatus(mDataSpecificStates); } - private NetworkRegistrationState(Parcel source) { + private NetworkRegistrationInfo(Parcel source) { mDomain = source.readInt(); mTransportType = source.readInt(); mRegState = source.readInt(); @@ -433,7 +437,7 @@ public class NetworkRegistrationState implements Parcelable { @Override public String toString() { - return new StringBuilder("NetworkRegistrationState{") + return new StringBuilder("NetworkRegistrationInfo{") .append(" domain=").append((mDomain == DOMAIN_CS) ? "CS" : "PS") .append(" transportType=").append( AccessNetworkConstants.transportTypeToString(mTransportType)) @@ -465,11 +469,11 @@ public class NetworkRegistrationState implements Parcelable { public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof NetworkRegistrationState)) { + if (!(o instanceof NetworkRegistrationInfo)) { return false; } - NetworkRegistrationState other = (NetworkRegistrationState) o; + NetworkRegistrationInfo other = (NetworkRegistrationInfo) o; return mDomain == other.mDomain && mTransportType == other.mTransportType && mRegState == other.mRegState @@ -528,46 +532,46 @@ public class NetworkRegistrationState implements Parcelable { } } - public static final Parcelable.Creator<NetworkRegistrationState> CREATOR = - new Parcelable.Creator<NetworkRegistrationState>() { - @Override - public NetworkRegistrationState createFromParcel(Parcel source) { - return new NetworkRegistrationState(source); - } + public static final @NonNull Parcelable.Creator<NetworkRegistrationInfo> CREATOR = + new Parcelable.Creator<NetworkRegistrationInfo>() { + @Override + public NetworkRegistrationInfo createFromParcel(Parcel source) { + return new NetworkRegistrationInfo(source); + } - @Override - public NetworkRegistrationState[] newArray(int size) { - return new NetworkRegistrationState[size]; - } - }; + @Override + public NetworkRegistrationInfo[] newArray(int size) { + return new NetworkRegistrationInfo[size]; + } + }; /** * @hide */ - public NetworkRegistrationState sanitizeLocationInfo() { - NetworkRegistrationState result = copy(); + public NetworkRegistrationInfo sanitizeLocationInfo() { + NetworkRegistrationInfo result = copy(); result.mCellIdentity = null; return result; } - private NetworkRegistrationState copy() { + private NetworkRegistrationInfo copy() { Parcel p = Parcel.obtain(); this.writeToParcel(p, 0); p.setDataPosition(0); - NetworkRegistrationState result = new NetworkRegistrationState(p); + NetworkRegistrationInfo result = new NetworkRegistrationInfo(p); p.recycle(); return result; } /** - * Provides a convenient way to set the fields of a {@link NetworkRegistrationState} when + * Provides a convenient way to set the fields of a {@link NetworkRegistrationInfo} when * creating a new instance. * - * <p>The example below shows how you might create a new {@code NetworkRegistrationState}: + * <p>The example below shows how you might create a new {@code NetworkRegistrationInfo}: * * <pre><code> * - * NetworkRegistrationState nrs = new NetworkRegistrationState.Builder() + * NetworkRegistrationInfo nrs = new NetworkRegistrationInfo.Builder() * .setApnTypeBitmask(ApnSetting.TYPE_DEFAULT | ApnSetting.TYPE_MMS) * .setApnName("apn.example.com") * .setEntryName("Example Carrier APN") @@ -736,12 +740,12 @@ public class NetworkRegistrationState implements Parcelable { } /** - * Build the NetworkRegistrationState. + * Build the NetworkRegistrationInfo. * - * @return the NetworkRegistrationState object. + * @return the NetworkRegistrationInfo object. */ - public @NonNull NetworkRegistrationState build() { - return new NetworkRegistrationState(mDomain, mTransportType, mRegState, + public @NonNull NetworkRegistrationInfo build() { + return new NetworkRegistrationInfo(mDomain, mTransportType, mRegState, mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices, mCellIdentity); } diff --git a/telephony/java/android/telephony/NetworkService.java b/telephony/java/android/telephony/NetworkService.java index f1240e9fcf34..bc989dd8c5ad 100644 --- a/telephony/java/android/telephony/NetworkService.java +++ b/telephony/java/android/telephony/NetworkService.java @@ -27,7 +27,7 @@ import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.RemoteException; -import android.telephony.NetworkRegistrationState.Domain; +import android.telephony.NetworkRegistrationInfo.Domain; import android.util.SparseArray; import com.android.internal.annotations.VisibleForTesting; @@ -59,10 +59,10 @@ public abstract class NetworkService extends Service { private static final int NETWORK_SERVICE_CREATE_NETWORK_SERVICE_PROVIDER = 1; private static final int NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER = 2; private static final int NETWORK_SERVICE_REMOVE_ALL_NETWORK_SERVICE_PROVIDERS = 3; - private static final int NETWORK_SERVICE_GET_REGISTRATION_STATE = 4; - private static final int NETWORK_SERVICE_REGISTER_FOR_STATE_CHANGE = 5; - private static final int NETWORK_SERVICE_UNREGISTER_FOR_STATE_CHANGE = 6; - private static final int NETWORK_SERVICE_INDICATION_NETWORK_STATE_CHANGED = 7; + private static final int NETWORK_SERVICE_GET_REGISTRATION_INFO = 4; + private static final int NETWORK_SERVICE_REGISTER_FOR_INFO_CHANGE = 5; + private static final int NETWORK_SERVICE_UNREGISTER_FOR_INFO_CHANGE = 6; + private static final int NETWORK_SERVICE_INDICATION_NETWORK_INFO_CHANGED = 7; private final HandlerThread mHandlerThread; @@ -86,7 +86,7 @@ public abstract class NetworkService extends Service { private final int mSlotIndex; private final List<INetworkServiceCallback> - mNetworkRegistrationStateChangedCallbacks = new ArrayList<>(); + mNetworkRegistrationInfoChangedCallbacks = new ArrayList<>(); /** * Constructor @@ -104,38 +104,38 @@ public abstract class NetworkService extends Service { } /** - * API to get network registration state. The result will be passed to the callback. + * API to get network registration info. The result will be passed to the callback. * @param domain Network domain - * @param callback The callback for reporting network registration state + * @param callback The callback for reporting network registration info */ - public void getNetworkRegistrationState(@Domain int domain, - @NonNull NetworkServiceCallback callback) { - callback.onGetNetworkRegistrationStateComplete( + public void getNetworkRegistrationInfo(@Domain int domain, + @NonNull NetworkServiceCallback callback) { + callback.onGetNetworkRegistrationInfoComplete( NetworkServiceCallback.RESULT_ERROR_UNSUPPORTED, null); } /** - * Notify the system that network registration state is changed. + * Notify the system that network registration info is changed. */ - public final void notifyNetworkRegistrationStateChanged() { - mHandler.obtainMessage(NETWORK_SERVICE_INDICATION_NETWORK_STATE_CHANGED, + public final void notifyNetworkRegistrationInfoChanged() { + mHandler.obtainMessage(NETWORK_SERVICE_INDICATION_NETWORK_INFO_CHANGED, mSlotIndex, 0, null).sendToTarget(); } - private void registerForStateChanged(@NonNull INetworkServiceCallback callback) { - synchronized (mNetworkRegistrationStateChangedCallbacks) { - mNetworkRegistrationStateChangedCallbacks.add(callback); + private void registerForInfoChanged(@NonNull INetworkServiceCallback callback) { + synchronized (mNetworkRegistrationInfoChangedCallbacks) { + mNetworkRegistrationInfoChangedCallbacks.add(callback); } } - private void unregisterForStateChanged(@NonNull INetworkServiceCallback callback) { - synchronized (mNetworkRegistrationStateChangedCallbacks) { - mNetworkRegistrationStateChangedCallbacks.remove(callback); + private void unregisterForInfoChanged(@NonNull INetworkServiceCallback callback) { + synchronized (mNetworkRegistrationInfoChangedCallbacks) { + mNetworkRegistrationInfoChangedCallbacks.remove(callback); } } - private void notifyStateChangedToCallbacks() { - for (INetworkServiceCallback callback : mNetworkRegistrationStateChangedCallbacks) { + private void notifyInfoChangedToCallbacks() { + for (INetworkServiceCallback callback : mNetworkRegistrationInfoChangedCallbacks) { try { callback.onNetworkStateChanged(); } catch (RemoteException exception) { @@ -189,24 +189,24 @@ public abstract class NetworkService extends Service { } mServiceMap.clear(); break; - case NETWORK_SERVICE_GET_REGISTRATION_STATE: + case NETWORK_SERVICE_GET_REGISTRATION_INFO: if (serviceProvider == null) break; int domainId = message.arg2; - serviceProvider.getNetworkRegistrationState(domainId, + serviceProvider.getNetworkRegistrationInfo(domainId, new NetworkServiceCallback(callback)); break; - case NETWORK_SERVICE_REGISTER_FOR_STATE_CHANGE: + case NETWORK_SERVICE_REGISTER_FOR_INFO_CHANGE: if (serviceProvider == null) break; - serviceProvider.registerForStateChanged(callback); + serviceProvider.registerForInfoChanged(callback); break; - case NETWORK_SERVICE_UNREGISTER_FOR_STATE_CHANGE: + case NETWORK_SERVICE_UNREGISTER_FOR_INFO_CHANGE: if (serviceProvider == null) break; - serviceProvider.unregisterForStateChanged(callback); + serviceProvider.unregisterForInfoChanged(callback); break; - case NETWORK_SERVICE_INDICATION_NETWORK_STATE_CHANGED: + case NETWORK_SERVICE_INDICATION_NETWORK_INFO_CHANGED: if (serviceProvider == null) break; - serviceProvider.notifyStateChangedToCallbacks(); + serviceProvider.notifyInfoChangedToCallbacks(); break; default: break; @@ -280,23 +280,23 @@ public abstract class NetworkService extends Service { } @Override - public void getNetworkRegistrationState( + public void getNetworkRegistrationInfo( int slotIndex, int domain, INetworkServiceCallback callback) { - mHandler.obtainMessage(NETWORK_SERVICE_GET_REGISTRATION_STATE, slotIndex, + mHandler.obtainMessage(NETWORK_SERVICE_GET_REGISTRATION_INFO, slotIndex, domain, callback).sendToTarget(); } @Override - public void registerForNetworkRegistrationStateChanged( + public void registerForNetworkRegistrationInfoChanged( int slotIndex, INetworkServiceCallback callback) { - mHandler.obtainMessage(NETWORK_SERVICE_REGISTER_FOR_STATE_CHANGE, slotIndex, + mHandler.obtainMessage(NETWORK_SERVICE_REGISTER_FOR_INFO_CHANGE, slotIndex, 0, callback).sendToTarget(); } @Override - public void unregisterForNetworkRegistrationStateChanged( + public void unregisterForNetworkRegistrationInfoChanged( int slotIndex, INetworkServiceCallback callback) { - mHandler.obtainMessage(NETWORK_SERVICE_UNREGISTER_FOR_STATE_CHANGE, slotIndex, + mHandler.obtainMessage(NETWORK_SERVICE_UNREGISTER_FOR_INFO_CHANGE, slotIndex, 0, callback).sendToTarget(); } } diff --git a/telephony/java/android/telephony/NetworkServiceCallback.java b/telephony/java/android/telephony/NetworkServiceCallback.java index c2fcfb7a0759..cc2524000091 100644 --- a/telephony/java/android/telephony/NetworkServiceCallback.java +++ b/telephony/java/android/telephony/NetworkServiceCallback.java @@ -28,8 +28,8 @@ import java.lang.ref.WeakReference; /** * Network service callback. Object of this class is passed to NetworkServiceProvider upon - * calling getNetworkRegistrationState, to receive asynchronous feedback from NetworkServiceProvider - * upon onGetNetworkRegistrationStateComplete. It's like a wrapper of INetworkServiceCallback + * calling getNetworkRegistrationInfo, to receive asynchronous feedback from NetworkServiceProvider + * upon onGetNetworkRegistrationInfoComplete. It's like a wrapper of INetworkServiceCallback * because INetworkServiceCallback can't be a parameter type in public APIs. * * @hide @@ -70,20 +70,20 @@ public class NetworkServiceCallback { /** * Called to indicate result of - * {@link NetworkServiceProvider#getNetworkRegistrationState(int, NetworkServiceCallback)} + * {@link NetworkServiceProvider#getNetworkRegistrationInfo(int, NetworkServiceCallback)} * * @param result Result status like {@link NetworkServiceCallback#RESULT_SUCCESS} or * {@link NetworkServiceCallback#RESULT_ERROR_UNSUPPORTED} * @param state The state information to be returned to callback. */ - public void onGetNetworkRegistrationStateComplete(int result, - @Nullable NetworkRegistrationState state) { + public void onGetNetworkRegistrationInfoComplete(int result, + @Nullable NetworkRegistrationInfo state) { INetworkServiceCallback callback = mCallback.get(); if (callback != null) { try { - callback.onGetNetworkRegistrationStateComplete(result, state); + callback.onGetNetworkRegistrationInfoComplete(result, state); } catch (RemoteException e) { - Rlog.e(mTag, "Failed to onGetNetworkRegistrationStateComplete on the remote"); + Rlog.e(mTag, "Failed to onGetNetworkRegistrationInfoComplete on the remote"); } } else { Rlog.e(mTag, "Weak reference of callback is null."); diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 4b15aac77940..0937b9f122ab 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -29,8 +29,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.telephony.AccessNetworkConstants.AccessNetworkType; import android.telephony.AccessNetworkConstants.TransportType; -import android.telephony.NetworkRegistrationState.Domain; -import android.telephony.NetworkRegistrationState.NRStatus; +import android.telephony.NetworkRegistrationInfo.Domain; +import android.telephony.NetworkRegistrationInfo.NRStatus; import android.text.TextUtils; import java.lang.annotation.Retention; @@ -349,7 +349,7 @@ public class ServiceState implements Parcelable { * Reference: 3GPP TS 36.104 5.4.3 */ private int mLteEarfcnRsrpBoost = 0; - private List<NetworkRegistrationState> mNetworkRegistrationStates = new ArrayList<>(); + private List<NetworkRegistrationInfo> mNetworkRegistrationInfos = new ArrayList<>(); /** * get String description of roaming type @@ -432,8 +432,8 @@ public class ServiceState implements Parcelable { mCellBandwidths = s.mCellBandwidths == null ? null : Arrays.copyOf(s.mCellBandwidths, s.mCellBandwidths.length); mLteEarfcnRsrpBoost = s.mLteEarfcnRsrpBoost; - mNetworkRegistrationStates = s.mNetworkRegistrationStates == null ? null : - new ArrayList<>(s.mNetworkRegistrationStates); + mNetworkRegistrationInfos = s.mNetworkRegistrationInfos == null ? null : + new ArrayList<>(s.mNetworkRegistrationInfos); mNrFrequencyRange = s.mNrFrequencyRange; } @@ -466,8 +466,8 @@ public class ServiceState implements Parcelable { mIsEmergencyOnly = in.readInt() != 0; mIsUsingCarrierAggregation = in.readInt() != 0; mLteEarfcnRsrpBoost = in.readInt(); - mNetworkRegistrationStates = new ArrayList<>(); - in.readList(mNetworkRegistrationStates, NetworkRegistrationState.class.getClassLoader()); + mNetworkRegistrationInfos = new ArrayList<>(); + in.readList(mNetworkRegistrationInfos, NetworkRegistrationInfo.class.getClassLoader()); mChannelNumber = in.readInt(); mCellBandwidths = in.createIntArray(); mNrFrequencyRange = in.readInt(); @@ -495,7 +495,7 @@ public class ServiceState implements Parcelable { out.writeInt(mIsEmergencyOnly ? 1 : 0); out.writeInt(mIsUsingCarrierAggregation ? 1 : 0); out.writeInt(mLteEarfcnRsrpBoost); - out.writeList(mNetworkRegistrationStates); + out.writeList(mNetworkRegistrationInfos); out.writeInt(mChannelNumber); out.writeIntArray(mCellBandwidths); out.writeInt(mNrFrequencyRange); @@ -620,8 +620,8 @@ public class ServiceState implements Parcelable { */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public @RoamingType int getVoiceRoamingType() { - final NetworkRegistrationState regState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); + final NetworkRegistrationInfo regState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); if (regState != null) { return regState.getRoamingType(); } @@ -644,10 +644,10 @@ public class ServiceState implements Parcelable { * @hide */ public boolean getDataRoamingFromRegistration() { - final NetworkRegistrationState regState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); + final NetworkRegistrationInfo regState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); if (regState != null) { - return (regState.getRegState() == NetworkRegistrationState.REG_STATE_ROAMING); + return (regState.getRegState() == NetworkRegistrationInfo.REG_STATE_ROAMING); } return false; } @@ -659,8 +659,8 @@ public class ServiceState implements Parcelable { */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public @RoamingType int getDataRoamingType() { - final NetworkRegistrationState regState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); + final NetworkRegistrationInfo regState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); if (regState != null) { return regState.getRoamingType(); } @@ -858,7 +858,7 @@ public class ServiceState implements Parcelable { mIsEmergencyOnly, mIsUsingCarrierAggregation, mLteEarfcnRsrpBoost, - mNetworkRegistrationStates, + mNetworkRegistrationInfos, mNrFrequencyRange); } @@ -888,9 +888,9 @@ public class ServiceState implements Parcelable { s.mCdmaDefaultRoamingIndicator) && mIsEmergencyOnly == s.mIsEmergencyOnly && mIsUsingCarrierAggregation == s.mIsUsingCarrierAggregation) - && (mNetworkRegistrationStates == null ? s.mNetworkRegistrationStates == null : - s.mNetworkRegistrationStates != null && - mNetworkRegistrationStates.containsAll(s.mNetworkRegistrationStates)) + && (mNetworkRegistrationInfos == null + ? s.mNetworkRegistrationInfos == null : s.mNetworkRegistrationInfos != null + && mNetworkRegistrationInfos.containsAll(s.mNetworkRegistrationInfos)) && mNrFrequencyRange == s.mNrFrequencyRange; } @@ -1043,7 +1043,7 @@ public class ServiceState implements Parcelable { .append(", mIsEmergencyOnly=").append(mIsEmergencyOnly) .append(", mIsUsingCarrierAggregation=").append(mIsUsingCarrierAggregation) .append(", mLteEarfcnRsrpBoost=").append(mLteEarfcnRsrpBoost) - .append(", mNetworkRegistrationStates=").append(mNetworkRegistrationStates) + .append(", mNetworkRegistrationInfos=").append(mNetworkRegistrationInfos) .append(", mNrFrequencyRange=").append(mNrFrequencyRange) .append("}").toString(); } @@ -1073,7 +1073,7 @@ public class ServiceState implements Parcelable { mIsEmergencyOnly = false; mIsUsingCarrierAggregation = false; mLteEarfcnRsrpBoost = 0; - mNetworkRegistrationStates = new ArrayList<>(); + mNetworkRegistrationInfos = new ArrayList<>(); mNrFrequencyRange = FREQUENCY_RANGE_UNKNOWN; } @@ -1130,14 +1130,14 @@ public class ServiceState implements Parcelable { /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public void setVoiceRoamingType(@RoamingType int type) { - NetworkRegistrationState regState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); + NetworkRegistrationInfo regState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); if (regState == null) { - regState = new NetworkRegistrationState( - NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, + regState = new NetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, ServiceState.ROAMING_TYPE_NOT_ROAMING, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null); - addNetworkRegistrationState(regState); + addNetworkRegistrationInfo(regState); } regState.setRoamingType(type); } @@ -1151,14 +1151,14 @@ public class ServiceState implements Parcelable { /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public void setDataRoamingType(@RoamingType int type) { - NetworkRegistrationState regState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); + NetworkRegistrationInfo regState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); if (regState == null) { - regState = new NetworkRegistrationState( - NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, + regState = new NetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, ServiceState.ROAMING_TYPE_NOT_ROAMING, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null); - addNetworkRegistrationState(regState); + addNetworkRegistrationInfo(regState); } regState.setRoamingType(type); } @@ -1326,14 +1326,14 @@ public class ServiceState implements Parcelable { this.mRilVoiceRadioTechnology = rt; // sync to network registration state - NetworkRegistrationState regState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); + NetworkRegistrationInfo regState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); if (regState == null) { - regState = new NetworkRegistrationState( - NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, + regState = new NetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, ServiceState.ROAMING_TYPE_NOT_ROAMING, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null); - addNetworkRegistrationState(regState); + addNetworkRegistrationInfo(regState); } regState.setAccessNetworkTechnology( rilRadioTechnologyToNetworkType(mRilVoiceRadioTechnology)); @@ -1353,15 +1353,15 @@ public class ServiceState implements Parcelable { mRilDataRadioTechnology); // sync to network registration state - NetworkRegistrationState regState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); + NetworkRegistrationInfo regState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); if (regState == null) { - regState = new NetworkRegistrationState( - NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, + regState = new NetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, ServiceState.ROAMING_TYPE_NOT_ROAMING, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null); - addNetworkRegistrationState(regState); + addNetworkRegistrationInfo(regState); } regState.setAccessNetworkTechnology( rilRadioTechnologyToNetworkType(mRilDataRadioTechnology)); @@ -1391,9 +1391,9 @@ public class ServiceState implements Parcelable { * @hide */ public @NRStatus int getNrStatus() { - final NetworkRegistrationState regState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); - if (regState == null) return NetworkRegistrationState.NR_STATUS_NONE; + final NetworkRegistrationInfo regState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); + if (regState == null) return NetworkRegistrationInfo.NR_STATUS_NONE; return regState.getNrStatus(); } @@ -1576,19 +1576,19 @@ public class ServiceState implements Parcelable { /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public @TelephonyManager.NetworkType int getDataNetworkType() { - final NetworkRegistrationState iwlanRegState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN); + final NetworkRegistrationInfo iwlanRegState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN); if (iwlanRegState != null - && iwlanRegState.getRegState() == NetworkRegistrationState.REG_STATE_HOME) { + && iwlanRegState.getRegState() == NetworkRegistrationInfo.REG_STATE_HOME) { // If the device is on IWLAN, return IWLAN as the network type. This is to simulate the // behavior of legacy mode device. In the future caller should use - // getNetworkRegistrationState() to retrieve the actual data network type on cellular + // getNetworkRegistrationInfo() to retrieve the actual data network type on cellular // or on IWLAN. return iwlanRegState.getAccessNetworkTechnology(); } - final NetworkRegistrationState regState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); + final NetworkRegistrationInfo regState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); if (regState != null) { return regState.getAccessNetworkTechnology(); } @@ -1598,8 +1598,8 @@ public class ServiceState implements Parcelable { /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public @TelephonyManager.NetworkType int getVoiceNetworkType() { - final NetworkRegistrationState regState = getNetworkRegistrationState( - NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); + final NetworkRegistrationInfo regState = getNetworkRegistrationInfo( + NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN); if (regState != null) { return regState.getAccessNetworkTechnology(); } @@ -1762,52 +1762,36 @@ public class ServiceState implements Parcelable { } /** - * Get all of the available network registration states. + * Get all of the available network registration info. * - * @return List of {@link NetworkRegistrationState} + * @return List of {@link NetworkRegistrationInfo} * @hide */ @NonNull @SystemApi - public List<NetworkRegistrationState> getNetworkRegistrationStates() { - synchronized (mNetworkRegistrationStates) { - return new ArrayList<>(mNetworkRegistrationStates); + public List<NetworkRegistrationInfo> getNetworkRegistrationInfoList() { + synchronized (mNetworkRegistrationInfos) { + return new ArrayList<>(mNetworkRegistrationInfos); } } /** - * Get the network registration states for the transport type. + * Get the network registration info list for the transport type. * * @param transportType The transport type - * @return List of {@link NetworkRegistrationState} - * @hide - * - * @deprecated Use {@link #getNetworkRegistrationStatesForTransportType(int)} - */ - @NonNull - @Deprecated - @SystemApi - public List<NetworkRegistrationState> getNetworkRegistrationStates(int transportType) { - return getNetworkRegistrationStatesForTransportType(transportType); - } - - /** - * Get the network registration states for the transport type. - * - * @param transportType The transport type - * @return List of {@link NetworkRegistrationState} + * @return List of {@link NetworkRegistrationInfo} * @hide */ @NonNull @SystemApi - public List<NetworkRegistrationState> getNetworkRegistrationStatesForTransportType( + public List<NetworkRegistrationInfo> getNetworkRegistrationInfoListForTransportType( @TransportType int transportType) { - List<NetworkRegistrationState> list = new ArrayList<>(); + List<NetworkRegistrationInfo> list = new ArrayList<>(); - synchronized (mNetworkRegistrationStates) { - for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) { - if (networkRegistrationState.getTransportType() == transportType) { - list.add(networkRegistrationState); + synchronized (mNetworkRegistrationInfos) { + for (NetworkRegistrationInfo networkRegistrationInfo : mNetworkRegistrationInfos) { + if (networkRegistrationInfo.getTransportType() == transportType) { + list.add(networkRegistrationInfo); } } } @@ -1816,22 +1800,22 @@ public class ServiceState implements Parcelable { } /** - * Get the network registration states for the network domain. + * Get the network registration info list for the network domain. * - * @param domain The network {@link NetworkRegistrationState.Domain domain} - * @return List of {@link NetworkRegistrationState} + * @param domain The network {@link NetworkRegistrationInfo.Domain domain} + * @return List of {@link NetworkRegistrationInfo} * @hide */ @NonNull @SystemApi - public List<NetworkRegistrationState> getNetworkRegistrationStatesForDomain( + public List<NetworkRegistrationInfo> getNetworkRegistrationInfoListForDomain( @Domain int domain) { - List<NetworkRegistrationState> list = new ArrayList<>(); + List<NetworkRegistrationInfo> list = new ArrayList<>(); - synchronized (mNetworkRegistrationStates) { - for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) { - if (networkRegistrationState.getDomain() == domain) { - list.add(networkRegistrationState); + synchronized (mNetworkRegistrationInfos) { + for (NetworkRegistrationInfo networkRegistrationInfo : mNetworkRegistrationInfos) { + if (networkRegistrationInfo.getDomain() == domain) { + list.add(networkRegistrationInfo); } } } @@ -1842,39 +1826,21 @@ public class ServiceState implements Parcelable { /** * Get the network registration state for the transport type and network domain. * - * @param domain The network {@link NetworkRegistrationState.Domain domain} - * @param transportType The transport type - * @return The matching {@link NetworkRegistrationState} - * @hide - * - * @deprecated Use {@link #getNetworkRegistrationState(int, int)} - */ - @Nullable - @Deprecated - @SystemApi - public NetworkRegistrationState getNetworkRegistrationStates(@Domain int domain, - @TransportType int transportType) { - return getNetworkRegistrationState(domain, transportType); - } - - /** - * Get the network registration state for the transport type and network domain. - * - * @param domain The network {@link NetworkRegistrationState.Domain domain} + * @param domain The network {@link NetworkRegistrationInfo.Domain domain} * @param transportType The transport type - * @return The matching {@link NetworkRegistrationState} + * @return The matching {@link NetworkRegistrationInfo} * @hide * */ @Nullable @SystemApi - public NetworkRegistrationState getNetworkRegistrationState(@Domain int domain, - @TransportType int transportType) { - synchronized (mNetworkRegistrationStates) { - for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) { - if (networkRegistrationState.getTransportType() == transportType - && networkRegistrationState.getDomain() == domain) { - return networkRegistrationState; + public NetworkRegistrationInfo getNetworkRegistrationInfo(@Domain int domain, + @TransportType int transportType) { + synchronized (mNetworkRegistrationInfos) { + for (NetworkRegistrationInfo networkRegistrationInfo : mNetworkRegistrationInfos) { + if (networkRegistrationInfo.getTransportType() == transportType + && networkRegistrationInfo.getDomain() == domain) { + return networkRegistrationInfo; } } } @@ -1885,20 +1851,20 @@ public class ServiceState implements Parcelable { /** * @hide */ - public void addNetworkRegistrationState(NetworkRegistrationState regState) { + public void addNetworkRegistrationInfo(NetworkRegistrationInfo regState) { if (regState == null) return; - synchronized (mNetworkRegistrationStates) { - for (int i = 0; i < mNetworkRegistrationStates.size(); i++) { - NetworkRegistrationState curRegState = mNetworkRegistrationStates.get(i); + synchronized (mNetworkRegistrationInfos) { + for (int i = 0; i < mNetworkRegistrationInfos.size(); i++) { + NetworkRegistrationInfo curRegState = mNetworkRegistrationInfos.get(i); if (curRegState.getTransportType() == regState.getTransportType() && curRegState.getDomain() == regState.getDomain()) { - mNetworkRegistrationStates.remove(i); + mNetworkRegistrationInfos.remove(i); break; } } - mNetworkRegistrationStates.add(regState); + mNetworkRegistrationInfos.add(regState); } } @@ -1913,15 +1879,15 @@ public class ServiceState implements Parcelable { /** * Returns a copy of self with location-identifying information removed. - * Always clears the NetworkRegistrationState's CellIdentity fields, but if removeCoarseLocation + * Always clears the NetworkRegistrationInfo's CellIdentity fields, but if removeCoarseLocation * is true, clears other info as well. * @hide */ public ServiceState sanitizeLocationInfo(boolean removeCoarseLocation) { ServiceState state = new ServiceState(this); - if (state.mNetworkRegistrationStates != null) { - state.mNetworkRegistrationStates = state.mNetworkRegistrationStates.stream() - .map(NetworkRegistrationState::sanitizeLocationInfo) + if (state.mNetworkRegistrationInfos != null) { + state.mNetworkRegistrationInfos = state.mNetworkRegistrationInfos.stream() + .map(NetworkRegistrationInfo::sanitizeLocationInfo) .collect(Collectors.toList()); } if (!removeCoarseLocation) return state; |