diff options
| author | 2019-01-14 14:30:08 -0800 | |
|---|---|---|
| committer | 2019-01-22 10:36:31 -0800 | |
| commit | d261a313d6fb0e4e3e6c00db41560e6329d83975 (patch) | |
| tree | 4f32eabc6cca8ef07e1f214408a5a672384462da | |
| parent | 3788e9147d45ba5ae02a0c80766368317e2cdb7f (diff) | |
Deprecate Duplicate SignalStrength Methods
This change cleans up access and deprecates method
on the SignalStrength class that are no longer needed
due to the support of getCellSignalStrengths(). These
methods are generally technology-specific getters. In
addition, this tags non-public methods that were also
of this type to restrict their access to apps
targeting P or earlier via the @UnsupportedAppUsage
annotation.
In addition, deprecate the semantically incorrect
isGsm().
Lastly, deprecate the NotifierBundle() methods that
rely heavily on implementation details that changed
in this release, and which should also be unneeded due
to getCellSignalStrengths() giving access to the
internal storage classes of SignalStrength.
Bug: 122845432
Test: make update-api && make offline-sdk-docs && make
(no functional change).
Change-Id: Iec794aee337099dee91d0820f7269fda433e8b01
| -rwxr-xr-x | api/current.txt | 17 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CellSignalStrengthGsm.java | 5 | ||||
| -rw-r--r-- | telephony/java/android/telephony/SignalStrength.java | 286 |
3 files changed, 266 insertions, 42 deletions
diff --git a/api/current.txt b/api/current.txt index 4c8b52506f32..593930e0e5a8 100755 --- a/api/current.txt +++ b/api/current.txt @@ -42368,6 +42368,7 @@ package android.telephony { public final class CellSignalStrengthGsm extends android.telephony.CellSignalStrength implements android.os.Parcelable { method public int describeContents(); method public int getAsuLevel(); + method public int getBitErrorRate(); method public int getDbm(); method public int getLevel(); method public int getTimingAdvance(); @@ -42669,16 +42670,16 @@ package android.telephony { public class SignalStrength implements android.os.Parcelable { method public int describeContents(); - method public int getCdmaDbm(); - method public int getCdmaEcio(); + method @Deprecated public int getCdmaDbm(); + method @Deprecated public int getCdmaEcio(); method @NonNull public java.util.List<android.telephony.CellSignalStrength> getCellSignalStrengths(); - method public int getEvdoDbm(); - method public int getEvdoEcio(); - method public int getEvdoSnr(); - method public int getGsmBitErrorRate(); - method public int getGsmSignalStrength(); + method @Deprecated public int getEvdoDbm(); + method @Deprecated public int getEvdoEcio(); + method @Deprecated public int getEvdoSnr(); + method @Deprecated public int getGsmBitErrorRate(); + method @Deprecated public int getGsmSignalStrength(); method public int getLevel(); - method public boolean isGsm(); + method @Deprecated public boolean isGsm(); method public void writeToParcel(android.os.Parcel, int); field public static final int INVALID = 2147483647; // 0x7fffffff } diff --git a/telephony/java/android/telephony/CellSignalStrengthGsm.java b/telephony/java/android/telephony/CellSignalStrengthGsm.java index 7b29f69da6da..30e641d61143 100644 --- a/telephony/java/android/telephony/CellSignalStrengthGsm.java +++ b/telephony/java/android/telephony/CellSignalStrengthGsm.java @@ -148,8 +148,9 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P /** * Return the Bit Error Rate - * @returns the bit error rate (0-7, 99) as defined in TS 27.007 8.5 or UNAVAILABLE. - * @hide + * + * @return the bit error rate (0-7, 99) as defined in TS 27.007 8.5 or + * {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE}. */ public int getBitErrorRate() { return mBitErrorRate; diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java index ad3ca6d129c9..91375bc2f11e 100644 --- a/telephony/java/android/telephony/SignalStrength.java +++ b/telephony/java/android/telephony/SignalStrength.java @@ -292,14 +292,27 @@ public class SignalStrength implements Parcelable { * Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69 * * @return RSSI in ASU 0..31, 99, or UNAVAILABLE + * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthGsm#getAsuLevel}. + * @see android.telephony#CellSignalStrengthGsm + * @see android.telephony.SignalStrength#getCellSignalStrengths */ + @Deprecated public int getGsmSignalStrength() { return mGsm.getAsuLevel(); } /** * Get the GSM bit error rate (0-7, 99) as defined in TS 27.007 8.5 + * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthGsm#getBitErrorRate}. + * + * @see android.telephony#CellSignalStrengthGsm + * @see android.telephony.SignalStrength#getCellSignalStrengths() */ + @Deprecated public int getGsmBitErrorRate() { return mGsm.getBitErrorRate(); } @@ -308,14 +321,28 @@ public class SignalStrength implements Parcelable { * Get the CDMA RSSI value in dBm * * @return the CDMA RSSI value or {@link #INVALID} if invalid + * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthCdma#getCdmaDbm}. + * + * @see android.telephony#CellSignalStrengthCdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() */ + @Deprecated public int getCdmaDbm() { return mCdma.getCdmaDbm(); } /** * Get the CDMA Ec/Io value in dB*10 + * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthCdma#getCdmaEcio}. + * + * @see android.telephony#CellSignalStrengthCdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() */ + @Deprecated public int getCdmaEcio() { return mCdma.getCdmaEcio(); } @@ -324,51 +351,112 @@ public class SignalStrength implements Parcelable { * Get the EVDO RSSI value in dBm * * @return the EVDO RSSI value or {@link #INVALID} if invalid + * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthCdma#getEvdoDbm}. + * + * @see android.telephony#CellSignalStrengthCdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() */ + @Deprecated public int getEvdoDbm() { return mCdma.getEvdoDbm(); } /** * Get the EVDO Ec/Io value in dB*10 + * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthCdma#getEvdoEcio}. + * + * @see android.telephony#CellSignalStrengthCdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() */ + @Deprecated public int getEvdoEcio() { return mCdma.getEvdoEcio(); } /** * Get the signal to noise ratio. Valid values are 0-8. 8 is the highest. + * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthCdma#getEvdoSnr}. + * + * @see android.telephony#CellSignalStrengthCdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() */ + @Deprecated public int getEvdoSnr() { return mCdma.getEvdoSnr(); } - /** @hide */ - @UnsupportedAppUsage + /** + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthLte#getRssi}. + * + * @see android.telephony#CellSignalStrengthLte + * @see android.telephony.SignalStrength#getCellSignalStrengths() + * @hide + */ + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getLteSignalStrength() { return mLte.getRssi(); } - /** @hide */ - @UnsupportedAppUsage + /** + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthLte#getRsrp}. + * + * @see android.telephony#CellSignalStrengthLte + * @see android.telephony.SignalStrength#getCellSignalStrengths() + * @hide + */ + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getLteRsrp() { return mLte.getRsrp(); } - /** @hide */ - @UnsupportedAppUsage + /** + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthLte#getRsrq}. + * + * @see android.telephony#CellSignalStrengthLte + * @see android.telephony.SignalStrength#getCellSignalStrengths() + * @hide + */ + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getLteRsrq() { return mLte.getRsrq(); } - /** @hide */ - @UnsupportedAppUsage + /** + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthLte#getRssnr}. + * + * @see android.telephony#CellSignalStrengthLte + * @see android.telephony.SignalStrength#getCellSignalStrengths() + * @hide + */ + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getLteRssnr() { return mLte.getRssnr(); } - /** @hide */ - @UnsupportedAppUsage + /** + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthLte#getCqi}. + * + * @see android.telephony#CellSignalStrengthLte + * @see android.telephony.SignalStrength#getCellSignalStrengths() + * @hide + */ + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getLteCqi() { return mLte.getCqi(); } @@ -391,11 +479,17 @@ public class SignalStrength implements Parcelable { } /** - * Get the signal level as an asu value between 0..31, 99 is unknown + * Get the signal level as an asu value with a range dependent on the underlying technology. * + * @deprecated this information should be retrieved from + * {@link CellSignalStrength#getAsuLevel}. Because the levels vary by technology, + * this method is misleading and should not be used. + * @see android.telephony#CellSignalStrength + * @see android.telephony.SignalStrength#getCellSignalStrengths * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getAsuLevel() { return getPrimary().getAsuLevel(); } @@ -403,9 +497,15 @@ public class SignalStrength implements Parcelable { /** * Get the signal strength as dBm * + * @deprecated this information should be retrieved from + * {@link CellSignalStrength#getDbm()}. Because the levels vary by technology, + * this method is misleading and should not be used. + * @see android.telephony#CellSignalStrength + * @see android.telephony.SignalStrength#getCellSignalStrengths * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getDbm() { return getPrimary().getDbm(); } @@ -413,9 +513,15 @@ public class SignalStrength implements Parcelable { /** * Get Gsm signal strength as dBm * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthGsm#getDbm}. + * + * @see android.telephony#CellSignalStrengthGsm + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getGsmDbm() { return mGsm.getDbm(); } @@ -423,9 +529,15 @@ public class SignalStrength implements Parcelable { /** * Get gsm as level 0..4 * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthGsm#getLevel}. + * + * @see android.telephony#CellSignalStrengthGsm + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getGsmLevel() { return mGsm.getLevel(); } @@ -433,9 +545,15 @@ public class SignalStrength implements Parcelable { /** * Get the gsm signal level as an asu value between 0..31, 99 is unknown * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthGsm#getAsuLevel}. + * + * @see android.telephony#CellSignalStrengthGsm + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getGsmAsuLevel() { return mGsm.getAsuLevel(); } @@ -443,9 +561,15 @@ public class SignalStrength implements Parcelable { /** * Get cdma as level 0..4 * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthCdma#getLevel}. + * + * @see android.telephony#CellSignalStrengthCdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getCdmaLevel() { return mCdma.getLevel(); } @@ -453,9 +577,17 @@ public class SignalStrength implements Parcelable { /** * Get the cdma signal level as an asu value between 0..31, 99 is unknown * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthCdma#getAsuLevel}. Since there is no definition of + * ASU for CDMA, the resultant value is Android-specific and is not recommended + * for use. + * + * @see android.telephony#CellSignalStrengthCdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getCdmaAsuLevel() { return mCdma.getAsuLevel(); } @@ -463,9 +595,15 @@ public class SignalStrength implements Parcelable { /** * Get Evdo as level 0..4 * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthCdma#getEvdoLevel}. + * + * @see android.telephony#CellSignalStrengthCdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getEvdoLevel() { return mCdma.getEvdoLevel(); } @@ -473,9 +611,17 @@ public class SignalStrength implements Parcelable { /** * Get the evdo signal level as an asu value between 0..31, 99 is unknown * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthCdma#getEvdoAsuLevel}. Since there is no definition of + * ASU for EvDO, the resultant value is Android-specific and is not recommended + * for use. + * + * @see android.telephony#CellSignalStrengthCdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getEvdoAsuLevel() { return mCdma.getEvdoAsuLevel(); } @@ -483,9 +629,15 @@ public class SignalStrength implements Parcelable { /** * Get LTE as dBm * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthLte#getDbm}. + * + * @see android.telephony#CellSignalStrengthLte + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getLteDbm() { return mLte.getRsrp(); } @@ -493,9 +645,15 @@ public class SignalStrength implements Parcelable { /** * Get LTE as level 0..4 * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthLte#getLevel}. + * + * @see android.telephony#CellSignalStrengthLte + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getLteLevel() { return mLte.getLevel(); } @@ -504,26 +662,46 @@ public class SignalStrength implements Parcelable { * Get the LTE signal level as an asu value between 0..97, 99 is unknown * Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69 * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthLte#getAsuLevel}. + * + * @see android.telephony#CellSignalStrengthLte + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getLteAsuLevel() { return mLte.getAsuLevel(); } /** * @return true if this is for GSM + * + * @deprecated This method returns true if there are any 3gpp type SignalStrength elements in + * this SignalStrength report or if the report contains no valid SignalStrength + * information. Instead callers should use + * {@link android.telephony.SignalStrength#getCellSignalStrengths + * getCellSignalStrengths()} to determine which types of information are contained + * in the SignalStrength report. */ + @Deprecated public boolean isGsm() { return !(getPrimary() instanceof CellSignalStrengthCdma); } /** - * @return get TD_SCDMA dbm + * @return get TD-SCDMA dBm + * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthTdscdma#getDbm}. * + * @see android.telephony#CellSignalStrengthTdscdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getTdScdmaDbm() { return mTdscdma.getRscp(); } @@ -534,9 +712,15 @@ public class SignalStrength implements Parcelable { * INT_MAX: 0x7FFFFFFF denotes invalid value * Reference: 3GPP TS 25.123, section 9.1.1.1 * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthTdscdma#getLevel}. + * + * @see android.telephony#CellSignalStrengthTdscdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getTdScdmaLevel() { return mTdscdma.getLevel(); } @@ -544,18 +728,30 @@ public class SignalStrength implements Parcelable { /** * Get the TD-SCDMA signal level as an asu value. * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthTdscdma#getAsuLevel}. + * + * @see android.telephony#CellSignalStrengthTdscdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public int getTdScdmaAsuLevel() { return mTdscdma.getAsuLevel(); } /** - * Gets WCDMA RSCP as a dbm value between -120 and -24, as defined in TS 27.007 8.69. + * Gets WCDMA RSCP as a dBm value between -120 and -24, as defined in TS 27.007 8.69. + * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthWcdma#getRscp}. * + * @see android.telephony#CellSignalStrengthWcdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ + @Deprecated public int getWcdmaRscp() { return mWcdma.getRscp(); } @@ -563,8 +759,14 @@ public class SignalStrength implements Parcelable { /** * Get the WCDMA signal level as an ASU value between 0-96, 255 is unknown * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthWcdma#getAsuLevel}. + * + * @see android.telephony#CellSignalStrengthWcdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ + @Deprecated public int getWcdmaAsuLevel() { /* * 3GPP 27.007 (Ver 10.3.0) Sec 8.69 @@ -578,10 +780,16 @@ public class SignalStrength implements Parcelable { } /** - * Gets WCDMA signal strength as a dbm value between -120 and -24, as defined in TS 27.007 8.69. + * Gets WCDMA signal strength as a dBm value between -120 and -24, as defined in TS 27.007 8.69. + * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthWcdma#getDbm}. * + * @see android.telephony#CellSignalStrengthWcdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ + @Deprecated public int getWcdmaDbm() { return mWcdma.getDbm(); } @@ -589,13 +797,19 @@ public class SignalStrength implements Parcelable { /** * Get WCDMA as level 0..4 * + * @deprecated this information should be retrieved from + * {@link CellSignalStrengthWcdma#getDbm}. + * + * @see android.telephony#CellSignalStrengthWcdma + * @see android.telephony.SignalStrength#getCellSignalStrengths() * @hide */ + @Deprecated public int getWcdmaLevel() { return mWcdma.getLevel(); } - /** + /** * @return hash code */ @Override @@ -639,9 +853,13 @@ public class SignalStrength implements Parcelable { * Set SignalStrength based on intent notifier map * * @param m intent notifier map + * + * @deprecated this method relies on non-stable implementation details, and full access to + * internal storage is available via {@link getCellSignalStrengths()}. * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) private void setFromNotifierBundle(Bundle m) { mCdma = m.getParcelable("Cdma"); mGsm = m.getParcelable("Gsm"); @@ -654,9 +872,13 @@ public class SignalStrength implements Parcelable { * Set intent notifier Bundle based on SignalStrength * * @param m intent notifier Bundle + * + * @deprecated this method relies on non-stable implementation details, and full access to + * internal storage is available via {@link getCellSignalStrengths()}. * @hide */ - @UnsupportedAppUsage + @Deprecated + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public void fillInNotifierBundle(Bundle m) { m.putParcelable("Cdma", mCdma); m.putParcelable("Gsm", mGsm); |