diff options
author | Chiachang Wang <chiachangwang@google.com> | 2021-02-25 15:52:47 +0800 |
---|---|---|
committer | Chiachang Wang <chiachangwang@google.com> | 2021-02-25 15:57:34 +0800 |
commit | 1e427c1e0a12e48300899377d2bb8cc693f3cce8 (patch) | |
tree | 94106bf1b7e2d0054fcab33afe0ebde2d679d970 | |
parent | 0dd3627b725c4110c2c16c4337d7ebc4886e1701 (diff) |
Revert "Expose NetworkRegistrationInfo.getNrState() as public API"
getNrState() was exposed. However, it doesn't actually get the NR
state in most cases and it is a mixture of a couple different
concepts. This API does not provide the correct 5G NR state, so
revert it from API surface and also the related change.
Bug: 171183530
Test: make update-api ; m
Change-Id: I651ed14500be5af45dd896ae5da1da36ad249a26
-rw-r--r-- | core/api/current.txt | 1 | ||||
-rw-r--r-- | services/core/java/com/android/server/connectivity/DataConnectionStats.java | 4 | ||||
-rw-r--r-- | telephony/java/android/telephony/NetworkRegistrationInfo.java | 1 |
3 files changed, 4 insertions, 2 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 80c555bd15b9..e3e13eb58bc8 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -40607,7 +40607,6 @@ package android.telephony { method @NonNull public java.util.List<java.lang.Integer> getAvailableServices(); method @Nullable public android.telephony.CellIdentity getCellIdentity(); method public int getDomain(); - method public int getNrState(); method @Nullable public String getRegisteredPlmn(); method public int getTransportType(); method public boolean isRegistered(); diff --git a/services/core/java/com/android/server/connectivity/DataConnectionStats.java b/services/core/java/com/android/server/connectivity/DataConnectionStats.java index fbd089c1f0ee..15f43a0481bd 100644 --- a/services/core/java/com/android/server/connectivity/DataConnectionStats.java +++ b/services/core/java/com/android/server/connectivity/DataConnectionStats.java @@ -52,6 +52,7 @@ public class DataConnectionStats extends BroadcastReceiver { private SignalStrength mSignalStrength; private ServiceState mServiceState; private int mDataState = TelephonyManager.DATA_DISCONNECTED; + private int mNrState = NetworkRegistrationInfo.NR_STATE_NONE; public DataConnectionStats(Context context, Handler listenerHandler) { mContext = context; @@ -99,7 +100,7 @@ public class DataConnectionStats extends BroadcastReceiver { : regInfo.getAccessNetworkTechnology(); // If the device is in NSA NR connection the networkType will report as LTE. // For cell dwell rate metrics, this should report NR instead. - if (regInfo != null && regInfo.getNrState() == NetworkRegistrationInfo.NR_STATE_CONNECTED) { + if (mNrState == NetworkRegistrationInfo.NR_STATE_CONNECTED) { networkType = TelephonyManager.NETWORK_TYPE_NR; } if (DEBUG) Log.d(TAG, String.format("Noting data connection for network type %s: %svisible", @@ -171,6 +172,7 @@ public class DataConnectionStats extends BroadcastReceiver { @Override public void onServiceStateChanged(ServiceState state) { mServiceState = state; + mNrState = state.getNrState(); notePhoneDataConnectionState(); } diff --git a/telephony/java/android/telephony/NetworkRegistrationInfo.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java index 706e3cb93a0f..a78f81331c8c 100644 --- a/telephony/java/android/telephony/NetworkRegistrationInfo.java +++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java @@ -371,6 +371,7 @@ public final class NetworkRegistrationInfo implements Parcelable { * Get the 5G NR connection state. * * @return the 5G NR connection state. + * @hide */ public @NRState int getNrState() { return mNrState; |