Merge "[API feedback] fixed API for NR"

am: 7afba9e583

Change-Id: I703b745d276171f57092668d502441d45ae6ded6
This commit is contained in:
Pengquan Meng
2019-03-20 11:42:00 -07:00
committed by android-build-merger
5 changed files with 30 additions and 28 deletions

View File

@@ -42351,12 +42351,12 @@ package android.telephony {
} }
public final class CellIdentityNr extends android.telephony.CellIdentity { public final class CellIdentityNr extends android.telephony.CellIdentity {
method public String getMccString(); method @Nullable public String getMccString();
method public String getMncString(); method @Nullable public String getMncString();
method public long getNci(); method public long getNci();
method public int getNrarfcn(); method @IntRange(from=0, to=3279165) public int getNrarfcn();
method public int getPci(); method @IntRange(from=0, to=1007) public int getPci();
method public int getTac(); method @IntRange(from=0, to=65535) public int getTac();
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityNr> CREATOR; field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityNr> CREATOR;
} }
@@ -42423,8 +42423,8 @@ package android.telephony {
} }
public final class CellInfoNr extends android.telephony.CellInfo { public final class CellInfoNr extends android.telephony.CellInfo {
method public android.telephony.CellIdentity getCellIdentity(); method @NonNull public android.telephony.CellIdentity getCellIdentity();
method public android.telephony.CellSignalStrength getCellSignalStrength(); method @NonNull public android.telephony.CellSignalStrength getCellSignalStrength();
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.CellInfoNr> CREATOR; field public static final android.os.Parcelable.Creator<android.telephony.CellInfoNr> CREATOR;
} }

View File

@@ -6386,7 +6386,7 @@ package android.telephony {
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst();
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping(); method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping();
method public static long getMaxNumberVerificationTimeoutMillis(); method public static long getMaxNumberVerificationTimeoutMillis();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmap(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState(); method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
method public int getSimApplicationState(); method public int getSimApplicationState();
method public int getSimCardState(); method public int getSimCardState();
@@ -6423,7 +6423,7 @@ package android.telephony {
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultisimCarrierRestriction(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultisimCarrierRestriction(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmap(long); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerState(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerState(int);

View File

@@ -16,13 +16,15 @@
package android.telephony; package android.telephony;
import android.annotation.IntRange;
import android.annotation.Nullable;
import android.os.Parcel; import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation; import android.telephony.gsm.GsmCellLocation;
import java.util.Objects; import java.util.Objects;
/** /**
* Information to represent a unique 5G NR cell. * Information to represent a unique NR(New Radio 5G) cell.
*/ */
public final class CellIdentityNr extends CellIdentity { public final class CellIdentityNr extends CellIdentity {
private static final String TAG = "CellIdentityNr"; private static final String TAG = "CellIdentityNr";
@@ -79,7 +81,7 @@ public final class CellIdentityNr extends CellIdentity {
} }
/** /**
* Get the NR Cell Identity. * Get the NR(New Radio 5G) Cell Identity.
* *
* @return The 36-bit NR Cell Identity in range [0, 68719476735] or * @return The 36-bit NR Cell Identity in range [0, 68719476735] or
* {@link CellInfo#UNAVAILABLE_LONG} if unknown. * {@link CellInfo#UNAVAILABLE_LONG} if unknown.
@@ -96,6 +98,7 @@ public final class CellIdentityNr extends CellIdentity {
* *
* @return Integer value in range [0, 3279165] or {@link CellInfo#UNAVAILABLE} if unknown. * @return Integer value in range [0, 3279165] or {@link CellInfo#UNAVAILABLE} if unknown.
*/ */
@IntRange(from = 0, to = 3279165)
public int getNrarfcn() { public int getNrarfcn() {
return mNrArfcn; return mNrArfcn;
} }
@@ -104,6 +107,7 @@ public final class CellIdentityNr extends CellIdentity {
* Get the physical cell id. * Get the physical cell id.
* @return Integer value in range [0, 1007] or {@link CellInfo#UNAVAILABLE} if unknown. * @return Integer value in range [0, 1007] or {@link CellInfo#UNAVAILABLE} if unknown.
*/ */
@IntRange(from = 0, to = 1007)
public int getPci() { public int getPci() {
return mPci; return mPci;
} }
@@ -112,6 +116,7 @@ public final class CellIdentityNr extends CellIdentity {
* Get the tracking area code. * Get the tracking area code.
* @return a 16 bit integer or {@link CellInfo#UNAVAILABLE} if unknown. * @return a 16 bit integer or {@link CellInfo#UNAVAILABLE} if unknown.
*/ */
@IntRange(from = 0, to = 65535)
public int getTac() { public int getTac() {
return mTac; return mTac;
} }
@@ -119,6 +124,7 @@ public final class CellIdentityNr extends CellIdentity {
/** /**
* @return Mobile Country Code in string format, or {@code null} if unknown. * @return Mobile Country Code in string format, or {@code null} if unknown.
*/ */
@Nullable
public String getMccString() { public String getMccString() {
return mMccStr; return mMccStr;
} }
@@ -126,6 +132,7 @@ public final class CellIdentityNr extends CellIdentity {
/** /**
* @return Mobile Network Code in string fomrat, or {@code null} if unknown. * @return Mobile Network Code in string fomrat, or {@code null} if unknown.
*/ */
@Nullable
public String getMncString() { public String getMncString() {
return mMncStr; return mMncStr;
} }

View File

@@ -16,6 +16,7 @@
package android.telephony; package android.telephony;
import android.annotation.NonNull;
import android.os.Parcel; import android.os.Parcel;
import java.util.Objects; import java.util.Objects;
@@ -36,11 +37,13 @@ public final class CellInfoNr extends CellInfo {
} }
@Override @Override
@NonNull
public CellIdentity getCellIdentity() { public CellIdentity getCellIdentity() {
return mCellIdentity; return mCellIdentity;
} }
@Override @Override
@NonNull
public CellSignalStrength getCellSignalStrength() { public CellSignalStrength getCellSignalStrength() {
return mCellSignalStrength; return mCellSignalStrength;
} }

View File

@@ -6762,14 +6762,12 @@ public class TelephonyManager {
} }
} catch (RemoteException ex) { } catch (RemoteException ex) {
Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex); Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex);
} catch (NullPointerException ex) {
Rlog.e(TAG, "getPreferredNetworkType NPE", ex);
} }
return -1; return -1;
} }
/** /**
* Get the preferred network type bitmap. * Get the preferred network type bitmask.
* *
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
* given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()} * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
@@ -6778,13 +6776,13 @@ public class TelephonyManager {
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
* or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
* *
* @return The bitmap of preferred network types. * @return The bitmask of preferred network types.
* *
* @hide * @hide
*/ */
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@SystemApi @SystemApi
public @NetworkTypeBitMask long getPreferredNetworkTypeBitmap() { public @NetworkTypeBitMask long getPreferredNetworkTypeBitmask() {
try { try {
ITelephony telephony = getITelephony(); ITelephony telephony = getITelephony();
if (telephony != null) { if (telephony != null) {
@@ -6792,9 +6790,7 @@ public class TelephonyManager {
telephony.getPreferredNetworkType(getSubId())); telephony.getPreferredNetworkType(getSubId()));
} }
} catch (RemoteException ex) { } catch (RemoteException ex) {
Rlog.e(TAG, "getPreferredNetworkTypeBitmap RemoteException", ex); Rlog.e(TAG, "getPreferredNetworkTypeBitmask RemoteException", ex);
} catch (NullPointerException ex) {
Rlog.e(TAG, "getPreferredNetworkTypeBitmap NPE", ex);
} }
return 0; return 0;
} }
@@ -7019,14 +7015,12 @@ public class TelephonyManager {
} }
} catch (RemoteException ex) { } catch (RemoteException ex) {
Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex); Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex);
} catch (NullPointerException ex) {
Rlog.e(TAG, "setPreferredNetworkType NPE", ex);
} }
return false; return false;
} }
/** /**
* Set the preferred network type bitmap. * Set the preferred network type bitmask.
* *
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
* given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()} * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
@@ -7035,24 +7029,22 @@ public class TelephonyManager {
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling
* app has carrier privileges (see {@link #hasCarrierPrivileges}). * app has carrier privileges (see {@link #hasCarrierPrivileges}).
* *
* @param networkTypeBitmap The bitmap of preferred network types. * @param networkTypeBitmask The bitmask of preferred network types.
* @return true on success; false on any failure. * @return true on success; false on any failure.
* @hide * @hide
*/ */
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
@SystemApi @SystemApi
public boolean setPreferredNetworkTypeBitmap(@NetworkTypeBitMask long networkTypeBitmap) { public boolean setPreferredNetworkTypeBitmask(@NetworkTypeBitMask long networkTypeBitmask) {
try { try {
ITelephony telephony = getITelephony(); ITelephony telephony = getITelephony();
if (telephony != null) { if (telephony != null) {
return telephony.setPreferredNetworkType( return telephony.setPreferredNetworkType(
getSubId(), RadioAccessFamily.getNetworkTypeFromRaf( getSubId(), RadioAccessFamily.getNetworkTypeFromRaf(
(int) networkTypeBitmap)); (int) networkTypeBitmask));
} }
} catch (RemoteException ex) { } catch (RemoteException ex) {
Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex); Rlog.e(TAG, "setPreferredNetworkTypeBitmask RemoteException", ex);
} catch (NullPointerException ex) {
Rlog.e(TAG, "setPreferredNetworkType NPE", ex);
} }
return false; return false;
} }