Expose CDMA ERI API am: 1b48e894c5 am: bc0ff8946f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1504953
Change-Id: I650512d17502e53b3aaf59f0faaf414e1ffa68cf
diff --git a/core/api/current.txt b/core/api/current.txt
index 2769c0a..2f9c3e7 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -46603,6 +46603,9 @@
field public static final int DATA_ENABLED_REASON_USER = 0; // 0x0
field public static final int DATA_SUSPENDED = 3; // 0x3
field public static final int DATA_UNKNOWN = -1; // 0xffffffff
+ field public static final int ERI_FLASH = 2; // 0x2
+ field public static final int ERI_OFF = 1; // 0x1
+ field public static final int ERI_ON = 0; // 0x0
field public static final String EXTRA_ACTIVE_SIM_SUPPORTED_COUNT = "android.telephony.extra.ACTIVE_SIM_SUPPORTED_COUNT";
field public static final String EXTRA_CALL_VOICEMAIL_INTENT = "android.telephony.extra.CALL_VOICEMAIL_INTENT";
field public static final String EXTRA_CARRIER_ID = "android.telephony.extra.CARRIER_ID";
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 18d1064..f36d8a1 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -10108,6 +10108,7 @@
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getCarrierPrivilegeStatus(int);
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<java.lang.String> getCarrierPrivilegedPackagesForAllActiveSubscriptions();
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.CarrierRestrictionRules getCarrierRestrictionRules();
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getCdmaEnhancedRoamingIndicatorIconIndex();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String getCdmaMdn();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String getCdmaMdn(int);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String getCdmaMin();
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 cf83603..a0e6cc8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -23,7 +23,6 @@
import android.os.Looper;
import android.provider.Settings.Global;
import android.telephony.Annotation;
-import android.telephony.CdmaEriInformation;
import android.telephony.CellSignalStrength;
import android.telephony.CellSignalStrengthCdma;
import android.telephony.PhoneStateListener;
@@ -423,11 +422,8 @@
if (isCarrierNetworkChangeActive()) {
return false;
}
- if (isCdma() && mServiceState != null) {
- final int iconMode = mPhone.getCdmaEriInformation().getEriIconMode();
- return mPhone.getCdmaEriInformation().getEriIconIndex() != CdmaEriInformation.ERI_OFF
- && (iconMode == CdmaEriInformation.ERI_ICON_MODE_NORMAL
- || iconMode == CdmaEriInformation.ERI_ICON_MODE_FLASH);
+ if (isCdma()) {
+ return mPhone.getCdmaEnhancedRoamingIndicatorIconIndex() != TelephonyManager.ERI_OFF;
} else {
return mServiceState != null && mServiceState.getRoaming();
}
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 aef454f..5d2486cf1 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
@@ -45,7 +45,6 @@
import android.os.Handler;
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;
@@ -119,8 +118,6 @@
private NetworkCapabilities mNetCapabilities;
private ConnectivityManager.NetworkCallback mNetworkCallback;
- private CdmaEriInformation mEriInformation;
-
@Rule
public TestWatcher failWatcher = new TestWatcher() {
@Override
@@ -181,11 +178,6 @@
doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mTelephonyDisplayInfo).getNetworkType();
doReturn(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE).when(mTelephonyDisplayInfo)
.getOverrideNetworkType();
-
- mEriInformation = new CdmaEriInformation(CdmaEriInformation.ERI_OFF,
- CdmaEriInformation.ERI_ICON_MODE_NORMAL);
- when(mMockTm.getCdmaEriInformation()).thenReturn(mEriInformation);
-
mConfig = new Config();
mConfig.hspaDataDistinguishable = true;
mCallbackHandler = mock(CallbackHandler.class);
@@ -308,9 +300,8 @@
}
public void setCdmaRoaming(boolean isRoaming) {
- mEriInformation.setEriIconIndex(isRoaming ?
- CdmaEriInformation.ERI_ON : CdmaEriInformation.ERI_OFF);
- when(mMockTm.getCdmaEriInformation()).thenReturn(mEriInformation);
+ when(mMockTm.getCdmaEnhancedRoamingIndicatorIconIndex()).thenReturn(
+ isRoaming ? TelephonyManager.ERI_ON : TelephonyManager.ERI_OFF);
}
public void setVoiceRegState(int voiceRegState) {
diff --git a/telephony/java/android/telephony/CdmaEriInformation.java b/telephony/java/android/telephony/CdmaEriInformation.java
deleted file mode 100644
index fd0b905..0000000
--- a/telephony/java/android/telephony/CdmaEriInformation.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telephony;
-
-import android.annotation.IntDef;
-import android.annotation.NonNull;
-import android.annotation.SystemApi;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * CDMA ERI (Enhanced Roaming Indicator) information.
- *
- * This contains the following ERI information
- *
- * 1. ERI (Enhanced Roaming Indicator) icon index. The number is assigned by
- * 3GPP2 C.R1001-H v1.0 Table 8.1-1. Additionally carriers define their own
- * ERI icon index.
- * 2. CDMA ERI icon mode. This represents how the icon should be displayed.
- * Its one of the following CDMA ERI icon mode
- * {@link android.telephony.CdmaEriInformation#ERI_ICON_MODE_NORMAL}
- * {@link android.telephony.CdmaEriInformation#ERI_ICON_MODE_FLASH}
- *
- * @hide
- */
-public final class CdmaEriInformation implements Parcelable {
- /** @hide */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef(prefix = {"ERI_"}, value = {
- ERI_ON,
- ERI_OFF,
- ERI_FLASH
- })
- public @interface EriIconIndex {}
-
- /**
- * ERI (Enhanced Roaming Indicator) is ON i.e value 0 defined by
- * 3GPP2 C.R1001-H v1.0 Table 8.1-1.
- */
- public static final int ERI_ON = 0;
-
- /**
- * ERI (Enhanced Roaming Indicator) is OFF i.e value 1 defined by
- * 3GPP2 C.R1001-H v1.0 Table 8.1-1.
- */
- public static final int ERI_OFF = 1;
-
- /**
- * ERI (Enhanced Roaming Indicator) is FLASH i.e value 2 defined by
- * 3GPP2 C.R1001-H v1.0 Table 8.1-1.
- */
- public static final int ERI_FLASH = 2;
-
- /** @hide */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef(prefix = {"ERI_ICON_MODE_"}, value = {
- ERI_ICON_MODE_NORMAL,
- ERI_ICON_MODE_FLASH
- })
- public @interface EriIconMode {}
-
- /**
- * ERI (Enhanced Roaming Indicator) icon mode is normal. This constant represents that
- * the ERI icon should be displayed normally.
- *
- * Note: ERI is defined 3GPP2 C.R1001-H Table 8.1-1
- */
- public static final int ERI_ICON_MODE_NORMAL = 0;
-
- /**
- * ERI (Enhanced Roaming Indicator) icon mode flash. This constant represents that
- * the ERI icon should be flashing.
- *
- * Note: ERI is defined 3GPP2 C.R1001-H Table 8.1-1
- */
- public static final int ERI_ICON_MODE_FLASH = 1;
-
- private @EriIconIndex int mIconIndex;
- private @EriIconMode int mIconMode;
-
- /**
- * Creates CdmaEriInformation from iconIndex and iconMode
- *
- * @hide
- */
- public CdmaEriInformation(@EriIconIndex int iconIndex, @EriIconMode int iconMode) {
- mIconIndex = iconIndex;
- mIconMode = iconMode;
- }
-
- /** Gets the ERI icon index */
- public @EriIconIndex int getEriIconIndex() {
- return mIconIndex;
- }
-
- /**
- * Sets the ERI icon index
- *
- * @hide
- */
- public void setEriIconIndex(@EriIconIndex int iconIndex) {
- mIconIndex = iconIndex;
- }
-
- /** Gets the ERI icon mode */
- public @EriIconMode int getEriIconMode() {
- return mIconMode;
- }
-
- /**
- * Sets the ERI icon mode
- *
- * @hide
- */
- public void setEriIconMode(@EriIconMode int iconMode) {
- mIconMode = iconMode;
- }
- /** Implement the Parcelable interface */
- @Override
- public void writeToParcel(@NonNull Parcel dest, int flags) {
- dest.writeInt(mIconIndex);
- dest.writeInt(mIconMode);
- }
-
- /** Implement the Parcelable interface */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /**
- * Construct a CdmaEriInformation object from the given parcel
- */
- private CdmaEriInformation(Parcel in) {
- mIconIndex = in.readInt();
- mIconMode = in.readInt();
- }
-
- /** Implement the Parcelable interface */
- public static final @android.annotation.NonNull Parcelable.Creator<CdmaEriInformation> CREATOR =
- new Parcelable.Creator<CdmaEriInformation>() {
- @Override
- public CdmaEriInformation createFromParcel(Parcel in) {
- return new CdmaEriInformation(in);
- }
-
- @Override
- public CdmaEriInformation[] newArray(int size) {
- return new CdmaEriInformation[size];
- }
- };
-}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 6f88cbd..b5b96f7 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -5603,27 +5603,78 @@
}
}
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"ERI_"}, value = {
+ ERI_ON,
+ ERI_OFF,
+ ERI_FLASH
+ })
+ public @interface EriIconIndex {}
+
/**
- * Get the CDMA ERI (Enhanced Roaming Indicator) information
+ * ERI (Enhanced Roaming Indicator) is ON i.e value 0 defined by
+ * 3GPP2 C.R1001-H v1.0 Table 8.1-1.
+ */
+ public static final int ERI_ON = 0;
+
+ /**
+ * ERI (Enhanced Roaming Indicator) is OFF i.e value 1 defined by
+ * 3GPP2 C.R1001-H v1.0 Table 8.1-1.
+ */
+ public static final int ERI_OFF = 1;
+
+ /**
+ * ERI (Enhanced Roaming Indicator) is FLASH i.e value 2 defined by
+ * 3GPP2 C.R1001-H v1.0 Table 8.1-1.
+ */
+ public static final int ERI_FLASH = 2;
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"ERI_ICON_MODE_"}, value = {
+ ERI_ICON_MODE_NORMAL,
+ ERI_ICON_MODE_FLASH
+ })
+ public @interface EriIconMode {}
+
+ /**
+ * ERI (Enhanced Roaming Indicator) icon mode is normal. This constant represents that
+ * the ERI icon should be displayed normally.
*
- * Returns {@link android.telephony#CdmaEriInformation}
- *
+ * Note: ERI is defined 3GPP2 C.R1001-H Table 8.1-1
* @hide
*/
+ public static final int ERI_ICON_MODE_NORMAL = 0;
+
+ /**
+ * ERI (Enhanced Roaming Indicator) icon mode flash. This constant represents that
+ * the ERI icon should be flashing.
+ *
+ * Note: ERI is defined 3GPP2 C.R1001-H Table 8.1-1
+ * @hide
+ */
+ public static final int ERI_ICON_MODE_FLASH = 1;
+
+ /**
+ * Returns the CDMA ERI icon index to display. The number is assigned by
+ * 3GPP2 C.R1001-H v1.0 Table 8.1-1. Additionally carriers define their own ERI icon index.
+ * Defined values are {@link #ERI_ON}, {@link #ERI_OFF}, and {@link #ERI_FLASH}.
+ * @hide
+ */
+ @SystemApi
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
- @NonNull
- public CdmaEriInformation getCdmaEriInformation() {
- return new CdmaEriInformation(
- getCdmaEriIconIndex(getSubId()), getCdmaEriIconMode(getSubId()));
+ public @EriIconIndex int getCdmaEnhancedRoamingIndicatorIconIndex() {
+ return getCdmaEriIconIndex(getSubId());
}
/**
- * Returns the CDMA ERI icon index to display for a subscription
+ * Returns the CDMA ERI icon index to display for a subscription.
* @hide
*/
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@UnsupportedAppUsage
- public int getCdmaEriIconIndex(int subId) {
+ public @EriIconIndex int getCdmaEriIconIndex(int subId) {
try {
ITelephony telephony = getITelephony();
if (telephony == null)
@@ -5647,7 +5698,7 @@
*/
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@UnsupportedAppUsage
- public int getCdmaEriIconMode(int subId) {
+ public @EriIconMode int getCdmaEriIconMode(int subId) {
try {
ITelephony telephony = getITelephony();
if (telephony == null)