diff options
| -rwxr-xr-x | api/system-current.txt | 14 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CdmaEriInformation.java | 170 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 30 |
3 files changed, 196 insertions, 18 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 799002c7ffde..d34b71e1f935 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -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(); diff --git a/telephony/java/android/telephony/CdmaEriInformation.java b/telephony/java/android/telephony/CdmaEriInformation.java new file mode 100644 index 000000000000..1cd9d3048526 --- /dev/null +++ b/telephony/java/android/telephony/CdmaEriInformation.java @@ -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]; + } + }; +} diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 56ca8c7790cb..17bcb35a7b1f 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -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 { @@ -5645,25 +5651,13 @@ 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 * 1 - FLASHING * * @hide */ - @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @UnsupportedAppUsage public int getCdmaEriIconMode(int subId) { try { |