From 2175839ead988720f2bd0fb48661d17e755ef352 Mon Sep 17 00:00:00 2001 From: Nathan Harold Date: Tue, 19 Mar 2019 13:20:17 -0700 Subject: [PATCH] Expose CellInfoTdscdma Expose CellInfoTdscdma and CellSignalStrengthTdscdma which are both returned by existing public APIs. This corrects an oversight whereby the values returned by the public API could not be used by callers. Existing CTS tests already validate these structures as though they were public (which was the intention). Note, this was also requested as feedback in the public beta. Bug: 128880490 Test: cts - atest CellInfoTest; atest SignalStrengthTest Change-Id: Ia75ea9af52796729e26b85ca04fd97b6c9b80f8e (cherry picked from commit b2bfb29595dc2733d5e49a3274b226251a56c002) --- api/current.txt | 17 ++++++++++++++++ .../telephony/CellIdentityTdscdma.java | 14 ++++++++++--- .../android/telephony/CellInfoTdscdma.java | 19 ++++++++++++------ .../telephony/CellSignalStrengthTdscdma.java | 20 +++++++++++-------- 4 files changed, 53 insertions(+), 17 deletions(-) diff --git a/api/current.txt b/api/current.txt index 793bc2fbe459e..8daab8d30aa8d 100644 --- a/api/current.txt +++ b/api/current.txt @@ -44511,6 +44511,13 @@ package android.telephony { field @NonNull public static final android.os.Parcelable.Creator CREATOR; } + public final class CellInfoTdscdma extends android.telephony.CellInfo implements android.os.Parcelable { + method @NonNull public android.telephony.CellIdentityTdscdma getCellIdentity(); + method @NonNull public android.telephony.CellSignalStrengthTdscdma getCellSignalStrength(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator CREATOR; + } + public final class CellInfoWcdma extends android.telephony.CellInfo implements android.os.Parcelable { method public android.telephony.CellIdentityWcdma getCellIdentity(); method public android.telephony.CellSignalStrengthWcdma getCellSignalStrength(); @@ -44594,6 +44601,16 @@ package android.telephony { field @NonNull public static final android.os.Parcelable.Creator CREATOR; } + public final class CellSignalStrengthTdscdma extends android.telephony.CellSignalStrength implements android.os.Parcelable { + method public int describeContents(); + method public int getAsuLevel(); + method public int getDbm(); + method public int getLevel(); + method public int getRscp(); + method public void writeToParcel(android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator CREATOR; + } + public final class CellSignalStrengthWcdma extends android.telephony.CellSignalStrength implements android.os.Parcelable { method public int describeContents(); method public int getAsuLevel(); diff --git a/telephony/java/android/telephony/CellIdentityTdscdma.java b/telephony/java/android/telephony/CellIdentityTdscdma.java index 10ffb804c8d05..19b11b666018c 100644 --- a/telephony/java/android/telephony/CellIdentityTdscdma.java +++ b/telephony/java/android/telephony/CellIdentityTdscdma.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; @@ -203,6 +204,12 @@ public final class CellIdentityTdscdma extends CellIdentity { .append("}").toString(); } + /** Implement the Parcelable interface */ + @Override + public int describeContents() { + return 0; + } + /** Implement the Parcelable interface */ @Override public void writeToParcel(Parcel dest, int flags) { @@ -226,16 +233,17 @@ public final class CellIdentityTdscdma extends CellIdentity { /** Implement the Parcelable interface */ @SuppressWarnings("hiding") - public static final @android.annotation.NonNull Creator CREATOR = + @NonNull + public static final Creator CREATOR = new Creator() { @Override - public CellIdentityTdscdma createFromParcel(Parcel in) { + public @NonNull CellIdentityTdscdma createFromParcel(Parcel in) { in.readInt(); // skip return createFromParcelBody(in); } @Override - public CellIdentityTdscdma[] newArray(int size) { + public @NonNull CellIdentityTdscdma[] newArray(int size) { return new CellIdentityTdscdma[size]; } }; diff --git a/telephony/java/android/telephony/CellInfoTdscdma.java b/telephony/java/android/telephony/CellInfoTdscdma.java index 93baabf34c165..1830086ba448b 100644 --- a/telephony/java/android/telephony/CellInfoTdscdma.java +++ b/telephony/java/android/telephony/CellInfoTdscdma.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; @@ -24,7 +25,9 @@ import java.util.Objects; /** * A {@link CellInfo} representing a TD-SCDMA cell that provides identity and measurement info. * - * @hide + * @see android.telephony.CellInfo + * @see android.telephony.CellSignalStrengthTdscdma + * @see android.telephony.CellIdentityTdscdma */ public final class CellInfoTdscdma extends CellInfo implements Parcelable { @@ -72,18 +75,21 @@ public final class CellInfoTdscdma extends CellInfo implements Parcelable { mCellSignalStrengthTdscdma = new CellSignalStrengthTdscdma(cit.signalStrengthTdscdma); } - @Override public CellIdentityTdscdma getCellIdentity() { + @Override + public @NonNull CellIdentityTdscdma getCellIdentity() { return mCellIdentityTdscdma; } + /** @hide */ public void setCellIdentity(CellIdentityTdscdma cid) { mCellIdentityTdscdma = cid; } @Override - public CellSignalStrengthTdscdma getCellSignalStrength() { + public @NonNull CellSignalStrengthTdscdma getCellSignalStrength() { return mCellSignalStrengthTdscdma; } + /** @hide */ public void setCellSignalStrength(CellSignalStrengthTdscdma css) { mCellSignalStrengthTdscdma = css; @@ -149,15 +155,16 @@ public final class CellInfoTdscdma extends CellInfo implements Parcelable { } /** Implement the Parcelable interface */ - public static final @android.annotation.NonNull Creator CREATOR = new Creator() { + @NonNull + public static final Creator CREATOR = new Creator() { @Override - public CellInfoTdscdma createFromParcel(Parcel in) { + public @NonNull CellInfoTdscdma createFromParcel(Parcel in) { in.readInt(); // Skip past token, we know what it is return createFromParcelBody(in); } @Override - public CellInfoTdscdma[] newArray(int size) { + public @NonNull CellInfoTdscdma[] newArray(int size) { return new CellInfoTdscdma[size]; } }; diff --git a/telephony/java/android/telephony/CellSignalStrengthTdscdma.java b/telephony/java/android/telephony/CellSignalStrengthTdscdma.java index e79643fbf7090..ddbd851bbce55 100644 --- a/telephony/java/android/telephony/CellSignalStrengthTdscdma.java +++ b/telephony/java/android/telephony/CellSignalStrengthTdscdma.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; import android.os.PersistableBundle; @@ -25,7 +26,8 @@ import java.util.Objects; /** * Tdscdma signal strength related information. * - * @hide + * This class provides signal strength and signal quality information for the TD-SCDMA air + * interface. For more information see 3gpp 25.225. */ public final class CellSignalStrengthTdscdma extends CellSignalStrength implements Parcelable { @@ -59,7 +61,9 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen * @param rssi in dBm [-113, -51] or UNAVAILABLE * @param ber [0-7], 99 or UNAVAILABLE * @param rscp in dBm [-120, -24] or UNAVAILABLE - * @hide */ + * + * @hide + */ public CellSignalStrengthTdscdma(int rssi, int ber, int rscp) { mRssi = inRangeOrUnavailable(rssi, -113, -51); mBitErrorRate = inRangeOrUnavailable(ber, 0, 7, 99); @@ -148,8 +152,7 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen } /** - * Get the RSCP as dBm - * @hide + * Get the RSCP as dBm value -120..-24dBm or {@link CellInfo#UNAVAILABLE UNAVAILABLE}. */ public int getRscp() { return mRscp; @@ -160,7 +163,7 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen * * Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69 * - * @return RSCP in ASU 0..96, 255, or UNAVAILABLE + * @return RSCP in ASU 0..96, 255, or {@link CellInfo#UNAVAILABLE UNAVAILABLE}. */ @Override public int getAsuLevel() { @@ -237,15 +240,16 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen /** Implement the Parcelable interface */ @SuppressWarnings("hiding") - public static final @android.annotation.NonNull Parcelable.Creator CREATOR = + @NonNull + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { @Override - public CellSignalStrengthTdscdma createFromParcel(Parcel in) { + public @NonNull CellSignalStrengthTdscdma createFromParcel(Parcel in) { return new CellSignalStrengthTdscdma(in); } @Override - public CellSignalStrengthTdscdma[] newArray(int size) { + public @NonNull CellSignalStrengthTdscdma[] newArray(int size) { return new CellSignalStrengthTdscdma[size]; } };