Merge changes from topics "cdma_eri_api", "cdma_eri_displaynumber"
* changes: Replace IconIndex as DisplayNumber Expose CDMA ERI API
This commit is contained in:
@@ -46603,6 +46603,9 @@ package android.telephony {
|
|||||||
field public static final int DATA_ENABLED_REASON_USER = 0; // 0x0
|
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_SUSPENDED = 3; // 0x3
|
||||||
field public static final int DATA_UNKNOWN = -1; // 0xffffffff
|
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_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_CALL_VOICEMAIL_INTENT = "android.telephony.extra.CALL_VOICEMAIL_INTENT";
|
||||||
field public static final String EXTRA_CARRIER_ID = "android.telephony.extra.CARRIER_ID";
|
field public static final String EXTRA_CARRIER_ID = "android.telephony.extra.CARRIER_ID";
|
||||||
|
|||||||
@@ -10108,6 +10108,7 @@ package android.telephony {
|
|||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getCarrierPrivilegeStatus(int);
|
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 @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 @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 getCdmaEnhancedRoamingIndicatorDisplayNumber();
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String getCdmaMdn();
|
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 getCdmaMdn(int);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String getCdmaMin();
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String getCdmaMin();
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import android.os.Handler;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.provider.Settings.Global;
|
import android.provider.Settings.Global;
|
||||||
import android.telephony.Annotation;
|
import android.telephony.Annotation;
|
||||||
import android.telephony.CdmaEriInformation;
|
|
||||||
import android.telephony.CellSignalStrength;
|
import android.telephony.CellSignalStrength;
|
||||||
import android.telephony.CellSignalStrengthCdma;
|
import android.telephony.CellSignalStrengthCdma;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
@@ -423,11 +422,9 @@ public class MobileSignalController extends SignalController<
|
|||||||
if (isCarrierNetworkChangeActive()) {
|
if (isCarrierNetworkChangeActive()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isCdma() && mServiceState != null) {
|
if (isCdma()) {
|
||||||
final int iconMode = mPhone.getCdmaEriInformation().getEriIconMode();
|
return mPhone.getCdmaEnhancedRoamingIndicatorDisplayNumber()
|
||||||
return mPhone.getCdmaEriInformation().getEriIconIndex() != CdmaEriInformation.ERI_OFF
|
!= TelephonyManager.ERI_OFF;
|
||||||
&& (iconMode == CdmaEriInformation.ERI_ICON_MODE_NORMAL
|
|
||||||
|| iconMode == CdmaEriInformation.ERI_ICON_MODE_FLASH);
|
|
||||||
} else {
|
} else {
|
||||||
return mServiceState != null && mServiceState.getRoaming();
|
return mServiceState != null && mServiceState.getRoaming();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import android.net.wifi.WifiManager;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.Global;
|
import android.provider.Settings.Global;
|
||||||
import android.telephony.CdmaEriInformation;
|
|
||||||
import android.telephony.CellSignalStrength;
|
import android.telephony.CellSignalStrength;
|
||||||
import android.telephony.NetworkRegistrationInfo;
|
import android.telephony.NetworkRegistrationInfo;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
@@ -119,8 +118,6 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
|||||||
private NetworkCapabilities mNetCapabilities;
|
private NetworkCapabilities mNetCapabilities;
|
||||||
private ConnectivityManager.NetworkCallback mNetworkCallback;
|
private ConnectivityManager.NetworkCallback mNetworkCallback;
|
||||||
|
|
||||||
private CdmaEriInformation mEriInformation;
|
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public TestWatcher failWatcher = new TestWatcher() {
|
public TestWatcher failWatcher = new TestWatcher() {
|
||||||
@Override
|
@Override
|
||||||
@@ -181,11 +178,6 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
|||||||
doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mTelephonyDisplayInfo).getNetworkType();
|
doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mTelephonyDisplayInfo).getNetworkType();
|
||||||
doReturn(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE).when(mTelephonyDisplayInfo)
|
doReturn(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE).when(mTelephonyDisplayInfo)
|
||||||
.getOverrideNetworkType();
|
.getOverrideNetworkType();
|
||||||
|
|
||||||
mEriInformation = new CdmaEriInformation(CdmaEriInformation.ERI_OFF,
|
|
||||||
CdmaEriInformation.ERI_ICON_MODE_NORMAL);
|
|
||||||
when(mMockTm.getCdmaEriInformation()).thenReturn(mEriInformation);
|
|
||||||
|
|
||||||
mConfig = new Config();
|
mConfig = new Config();
|
||||||
mConfig.hspaDataDistinguishable = true;
|
mConfig.hspaDataDistinguishable = true;
|
||||||
mCallbackHandler = mock(CallbackHandler.class);
|
mCallbackHandler = mock(CallbackHandler.class);
|
||||||
@@ -308,9 +300,8 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setCdmaRoaming(boolean isRoaming) {
|
public void setCdmaRoaming(boolean isRoaming) {
|
||||||
mEriInformation.setEriIconIndex(isRoaming ?
|
when(mMockTm.getCdmaEnhancedRoamingIndicatorDisplayNumber()).thenReturn(
|
||||||
CdmaEriInformation.ERI_ON : CdmaEriInformation.ERI_OFF);
|
isRoaming ? TelephonyManager.ERI_ON : TelephonyManager.ERI_OFF);
|
||||||
when(mMockTm.getCdmaEriInformation()).thenReturn(mEriInformation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVoiceRegState(int voiceRegState) {
|
public void setVoiceRegState(int voiceRegState) {
|
||||||
|
|||||||
@@ -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];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -5603,27 +5603,78 @@ public class TelephonyManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @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.
|
||||||
* Returns {@link android.telephony#CdmaEriInformation}
|
*/
|
||||||
|
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
|
||||||
* @hide
|
* @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 display number. The number is assigned by
|
||||||
|
* 3GPP2 C.R1001-H v1.0 Table 8.1-1. Additionally carriers define their own ERI display numbers.
|
||||||
|
* Defined values are {@link #ERI_ON}, {@link #ERI_OFF}, and {@link #ERI_FLASH}.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
@NonNull
|
public @EriIconIndex int getCdmaEnhancedRoamingIndicatorDisplayNumber() {
|
||||||
public CdmaEriInformation getCdmaEriInformation() {
|
return getCdmaEriIconIndex(getSubId());
|
||||||
return new CdmaEriInformation(
|
|
||||||
getCdmaEriIconIndex(getSubId()), getCdmaEriIconMode(getSubId()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the CDMA ERI icon index to display for a subscription
|
* Returns the CDMA ERI icon index to display for a subscription.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public int getCdmaEriIconIndex(int subId) {
|
public @EriIconIndex int getCdmaEriIconIndex(int subId) {
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony == null)
|
if (telephony == null)
|
||||||
@@ -5647,7 +5698,7 @@ public class TelephonyManager {
|
|||||||
*/
|
*/
|
||||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public int getCdmaEriIconMode(int subId) {
|
public @EriIconMode int getCdmaEriIconMode(int subId) {
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony == null)
|
if (telephony == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user