Expose TelephonyManager CDMA ERI APIs as sysetm APIs
1) TelephonyManager.getCdmaEriInformation()
2) Introduce new class CdmaEriInformation
Bug: 147839123
Test: Basic telephony testing
atest frameworks/base/packages/SystemUI/tests
Change-Id: I2a4938ae07494a62c67bdcf881f4944823e7dced
This commit is contained in:
@@ -9633,6 +9633,19 @@ package android.telephony {
|
||||
method @NonNull public java.util.List<android.telephony.CbGeoUtils.LatLng> getVertices();
|
||||
}
|
||||
|
||||
public final class CdmaEriInformation implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public int getEriIconIndex();
|
||||
method public int getEriIconMode();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CdmaEriInformation> CREATOR;
|
||||
field public static final int ERI_FLASH = 2; // 0x2
|
||||
field public static final int ERI_ICON_MODE_FLASH = 1; // 0x1
|
||||
field public static final int ERI_ICON_MODE_NORMAL = 0; // 0x0
|
||||
field public static final int ERI_OFF = 1; // 0x1
|
||||
field public static final int ERI_ON = 0; // 0x0
|
||||
}
|
||||
|
||||
public class CellBroadcastIntents {
|
||||
method public static void sendOrderedBroadcastForBackgroundReceivers(@NonNull android.content.Context, @Nullable android.os.UserHandle, @NonNull android.content.Intent, @Nullable String, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
|
||||
}
|
||||
@@ -10662,6 +10675,7 @@ package android.telephony {
|
||||
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 @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.CdmaEriInformation getCdmaEriInformation();
|
||||
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();
|
||||
|
||||
170
telephony/java/android/telephony/CdmaEriInformation.java
Normal file
170
telephony/java/android/telephony/CdmaEriInformation.java
Normal file
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@SystemApi
|
||||
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];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -5615,19 +5615,25 @@ public class TelephonyManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CDMA ERI icon index to display
|
||||
* Get the CDMA ERI (Enhanced Roaming Indicator) information
|
||||
*
|
||||
* Returns {@link android.telephony#CdmaEriInformation}
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
|
||||
public int getCdmaEriIconIndex() {
|
||||
return getCdmaEriIconIndex(getSubId());
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
@SystemApi
|
||||
@NonNull
|
||||
public CdmaEriInformation getCdmaEriInformation() {
|
||||
return new CdmaEriInformation(
|
||||
getCdmaEriIconMode(getSubId()), getCdmaEriIconIndex(getSubId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CDMA ERI icon index to display for a subscription
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
@UnsupportedAppUsage
|
||||
public int getCdmaEriIconIndex(int subId) {
|
||||
try {
|
||||
@@ -5644,18 +5650,6 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CDMA ERI icon mode,
|
||||
* 0 - ON
|
||||
* 1 - FLASHING
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
|
||||
public int getCdmaEriIconMode() {
|
||||
return getCdmaEriIconMode(getSubId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CDMA ERI icon mode for a subscription.
|
||||
* 0 - ON
|
||||
@@ -5663,7 +5657,7 @@ public class TelephonyManager {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
@UnsupportedAppUsage
|
||||
public int getCdmaEriIconMode(int subId) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user