Merge "Replace usages of @hide telephony APIs with system/public ones."
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index af3e924..de174b1 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -132,7 +132,6 @@
],
libs: [
"android.test.runner",
- "telephony-common",
"android.test.base",
],
kotlincflags: ["-Xjvm-default=enable"],
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 58a6c17..4e2f7d4 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -371,7 +371,8 @@
checkIsHandlerThread();
if (DEBUG_SIM_STATES) {
Log.v(TAG, "onSubscriptionInfoChanged()");
- List<SubscriptionInfo> sil = mSubscriptionManager.getActiveSubscriptionInfoList(false);
+ List<SubscriptionInfo> sil = mSubscriptionManager
+ .getActiveAndHiddenSubscriptionInfoList();
if (sil != null) {
for (SubscriptionInfo subInfo : sil) {
Log.v(TAG, "SubInfo:" + subInfo);
@@ -425,10 +426,10 @@
public List<SubscriptionInfo> getSubscriptionInfo(boolean forceReload) {
List<SubscriptionInfo> sil = mSubscriptionInfo;
if (sil == null || forceReload) {
- sil = mSubscriptionManager.getActiveSubscriptionInfoList(false);
+ sil = mSubscriptionManager.getActiveAndHiddenSubscriptionInfoList();
}
if (sil == null) {
- // getActiveSubscriptionInfoList was null callers expect an empty list.
+ // getActiveAndHiddenSubscriptionInfoList was null callers expect an empty list.
mSubscriptionInfo = new ArrayList<SubscriptionInfo>();
} else {
mSubscriptionInfo = sil;
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 f426b95..28ba125 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -31,6 +31,7 @@
import android.telephony.CdmaEriInformation;
import android.telephony.CellSignalStrength;
import android.telephony.CellSignalStrengthCdma;
+import android.telephony.DataSpecificRegistrationInfo;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
@@ -322,9 +323,9 @@
private int getNumLevels() {
if (mInflateSignalStrengths) {
- return SignalStrength.NUM_SIGNAL_STRENGTH_BINS + 1;
+ return CellSignalStrength.getNumSignalStrengthLevels() + 1;
}
- return SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
+ return CellSignalStrength.getNumSignalStrengthLevels();
}
@Override
@@ -782,12 +783,24 @@
if (mDataNetType == TelephonyManager.NETWORK_TYPE_LTE) {
if (isCarrierSpecificDataIcon()) {
mCAPlus = true;
- } else if (mServiceState != null && mServiceState.isUsingCarrierAggregation()) {
+ } else if (mServiceState != null && isUsingCarrierAggregation(mServiceState)) {
mCA = true;
}
}
}
+ private boolean isUsingCarrierAggregation(ServiceState serviceState) {
+ NetworkRegistrationInfo nri = serviceState.getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ if (nri != null) {
+ DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
+ if (dsri != null) {
+ return dsri.isUsingCarrierAggregation();
+ }
+ }
+ return false;
+ }
+
@Override
public void onDataActivity(int direction) {
if (DEBUG) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 6dd1133..46143ca 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -41,9 +41,9 @@
import android.os.PersistableBundle;
import android.provider.Settings;
import android.telephony.CarrierConfigManager;
+import android.telephony.CellSignalStrength;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
-import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
@@ -56,7 +56,6 @@
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.telephony.TelephonyIntents;
import com.android.settingslib.net.DataUsageController;
import com.android.systemui.DemoMode;
import com.android.systemui.Dumpable;
@@ -605,7 +604,7 @@
@VisibleForTesting
void doUpdateMobileControllers() {
List<SubscriptionInfo> subscriptions = mSubscriptionManager
- .getActiveSubscriptionInfoList(false);
+ .getActiveAndHiddenSubscriptionInfoList();
if (subscriptions == null) {
subscriptions = Collections.emptyList();
}
@@ -1035,7 +1034,7 @@
if (level != null) {
controller.getState().level = level.equals("null") ? -1
: Math.min(Integer.parseInt(level),
- SignalStrength.NUM_SIGNAL_STRENGTH_BINS);
+ CellSignalStrength.getNumSignalStrengthLevels());
controller.getState().connected = controller.getState().level >= 0;
}
if (args.containsKey("inflate")) {
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java
index eccf096..ea6cf33 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java
@@ -249,7 +249,7 @@
// STOPSHIP(b/130246708) This line makes sure that SubscriptionManager provides the
// same answer as KeyguardUpdateMonitor. Remove when this is addressed
- when(mSubscriptionManager.getActiveSubscriptionInfoList(anyBoolean())).thenReturn(
+ when(mSubscriptionManager.getActiveAndHiddenSubscriptionInfoList()).thenReturn(
new ArrayList<>());
when(mKeyguardUpdateMonitor.getSimState(anyInt())).thenReturn(
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
index 59eb6c5..795cbb9 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
@@ -22,7 +22,6 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
@@ -483,7 +482,7 @@
List<SubscriptionInfo> list = new ArrayList<>();
list.add(TEST_SUBSCRIPTION);
list.add(TEST_SUBSCRIPTION_2);
- when(mSubscriptionManager.getActiveSubscriptionInfoList(anyBoolean())).thenReturn(list);
+ when(mSubscriptionManager.getActiveAndHiddenSubscriptionInfoList()).thenReturn(list);
mKeyguardUpdateMonitor.mPhoneStateListener.onActiveDataSubscriptionIdChanged(
TEST_SUBSCRIPTION_2.getSubscriptionId());
mTestableLooper.processAllMessages();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 24b9df8..294d546 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -44,6 +44,7 @@
import android.provider.Settings;
import android.provider.Settings.Global;
import android.telephony.CdmaEriInformation;
+import android.telephony.CellSignalStrength;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
@@ -57,7 +58,6 @@
import androidx.test.InstrumentationRegistry;
-import com.android.internal.telephony.cdma.EriInfo;
import com.android.settingslib.graph.SignalDrawable;
import com.android.settingslib.net.DataUsageController;
import com.android.systemui.R;
@@ -229,7 +229,7 @@
subs.add(subscription);
}
when(mMockSm.getActiveSubscriptionInfoList()).thenReturn(subs);
- when(mMockSm.getActiveSubscriptionInfoList(anyBoolean())).thenReturn(subs);
+ when(mMockSm.getActiveAndHiddenSubscriptionInfoList()).thenReturn(subs);
mNetworkController.doUpdateMobileControllers();
}
@@ -415,7 +415,7 @@
typeIconArg.capture(), dataInArg.capture(), dataOutArg.capture(),
anyString(), anyString(), anyBoolean(), anyInt(), anyBoolean());
IconState iconState = iconArg.getValue();
- int state = SignalDrawable.getState(icon, SignalStrength.NUM_SIGNAL_STRENGTH_BINS,
+ int state = SignalDrawable.getState(icon, CellSignalStrength.getNumSignalStrengthLevels(),
false);
assertEquals("Visibility in, quick settings", visible, iconState.visible);
assertEquals("Signal icon in, quick settings", state, iconState.icon);
@@ -450,7 +450,8 @@
IconState iconState = iconArg.getValue();
int state = icon == -1 ? 0
- : SignalDrawable.getState(icon, SignalStrength.NUM_SIGNAL_STRENGTH_BINS, !inet);
+ : SignalDrawable.getState(icon, CellSignalStrength.getNumSignalStrengthLevels(),
+ !inet);
assertEquals("Signal icon in status bar", state, iconState.icon);
assertEquals("Data icon in status bar", typeIcon, (int) typeIconArg.getValue());
assertEquals("Visibility in status bar", visible, iconState.visible);
@@ -493,7 +494,7 @@
IconState iconState = iconArg.getValue();
- int numSignalStrengthBins = SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
+ int numSignalStrengthBins = CellSignalStrength.getNumSignalStrengthLevels();
if (mMobileSignalController.mInflateSignalStrengths) {
numSignalStrengthBins++;
icon++;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index 4406248..f52c8c1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -136,7 +136,7 @@
@Test
public void testSignalStrength() {
for (int testStrength = 0;
- testStrength < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; testStrength++) {
+ testStrength < CellSignalStrength.getNumSignalStrengthLevels(); testStrength++) {
setupDefaultSignal();
setLevel(testStrength);
@@ -153,7 +153,7 @@
@Test
public void testCdmaSignalStrength() {
for (int testStrength = 0;
- testStrength < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; testStrength++) {
+ testStrength < CellSignalStrength.getNumSignalStrengthLevels(); testStrength++) {
setupDefaultSignal();
setCdma();
setLevel(testStrength);
@@ -167,7 +167,7 @@
@Test
public void testSignalRoaming() {
for (int testStrength = 0;
- testStrength < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; testStrength++) {
+ testStrength < CellSignalStrength.getNumSignalStrengthLevels(); testStrength++) {
setupDefaultSignal();
setGsmRoaming(true);
setLevel(testStrength);
@@ -494,7 +494,7 @@
// Carrier network change is true, show special indicator
verifyLastMobileDataIndicators(true /* visible */,
- SignalDrawable.getCarrierChangeState(SignalStrength.NUM_SIGNAL_STRENGTH_BINS),
+ SignalDrawable.getCarrierChangeState(CellSignalStrength.getNumSignalStrengthLevels()),
0 /* typeIcon */);
// Revert back
@@ -525,7 +525,7 @@
// Carrier network change is true, show special indicator, no roaming.
verifyLastMobileDataIndicators(true /* visible */,
- SignalDrawable.getCarrierChangeState(SignalStrength.NUM_SIGNAL_STRENGTH_BINS),
+ SignalDrawable.getCarrierChangeState(CellSignalStrength.getNumSignalStrengthLevels()),
0 /* typeIcon */,
false /* roaming */);
@@ -557,7 +557,7 @@
// Carrier network change is true, show special indicator, no roaming.
verifyLastMobileDataIndicators(true /* visible */,
- SignalDrawable.getCarrierChangeState(SignalStrength.NUM_SIGNAL_STRENGTH_BINS),
+ SignalDrawable.getCarrierChangeState(CellSignalStrength.getNumSignalStrengthLevels()),
0 /* typeIcon */,
false /* roaming */);
@@ -565,7 +565,7 @@
// Roaming should not show.
verifyLastMobileDataIndicators(true /* visible */,
- SignalDrawable.getCarrierChangeState(SignalStrength.NUM_SIGNAL_STRENGTH_BINS),
+ SignalDrawable.getCarrierChangeState(CellSignalStrength.getNumSignalStrengthLevels()),
0 /* typeIcon */,
false /* roaming */);