OSDN Git Service

Access Identity and SignalStrength from CellInfo
authorNathan Harold <nharold@google.com>
Mon, 9 Jul 2018 18:59:53 +0000 (11:59 -0700)
committerNathan Harold <nharold@google.com>
Thu, 19 Jul 2018 22:24:14 +0000 (15:24 -0700)
Accessing common CellIdentity and CellSignalStrength
information should not require RTTI. Thus, add
overloaded methods that allow the access the common
versions of these functions from a top level CellInfo.

Bug: 10151416
Test: compilation

Change-Id: I18f31c5cec075dcd68cc493e24c2d551138dd73c

telephony/java/android/telephony/CellInfo.java
telephony/java/android/telephony/CellInfoCdma.java
telephony/java/android/telephony/CellInfoGsm.java
telephony/java/android/telephony/CellInfoLte.java
telephony/java/android/telephony/CellInfoTdscdma.java
telephony/java/android/telephony/CellInfoWcdma.java

index 3aab3fc..bffeb17 100644 (file)
@@ -17,6 +17,7 @@
 package android.telephony;
 
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -124,6 +125,14 @@ public abstract class CellInfo implements Parcelable {
         mTimeStamp = timeStamp;
     }
 
+    /** @hide */
+    @NonNull
+    public abstract CellIdentity getCellIdentity();
+
+    /** @hide */
+    @NonNull
+    public abstract CellSignalStrength getCellSignalStrength();
+
     /**
      * Gets the connection status of this cell.
      *
index 6403bc5..8b8d1bb 100644 (file)
@@ -45,6 +45,7 @@ public final class CellInfoCdma extends CellInfo implements Parcelable {
         this.mCellSignalStrengthCdma = ci.mCellSignalStrengthCdma.copy();
     }
 
+    @Override
     public CellIdentityCdma getCellIdentity() {
         return mCellIdentityCdma;
     }
@@ -53,6 +54,7 @@ public final class CellInfoCdma extends CellInfo implements Parcelable {
         mCellIdentityCdma = cid;
     }
 
+    @Override
     public CellSignalStrengthCdma getCellSignalStrength() {
         return mCellSignalStrengthCdma;
     }
index a3a9b31..f7af1b2 100644 (file)
@@ -45,6 +45,7 @@ public final class CellInfoGsm extends CellInfo implements Parcelable {
         this.mCellSignalStrengthGsm = ci.mCellSignalStrengthGsm.copy();
     }
 
+    @Override
     public CellIdentityGsm getCellIdentity() {
         return mCellIdentityGsm;
     }
@@ -53,6 +54,7 @@ public final class CellInfoGsm extends CellInfo implements Parcelable {
         mCellIdentityGsm = cid;
     }
 
+    @Override
     public CellSignalStrengthGsm getCellSignalStrength() {
         return mCellSignalStrengthGsm;
     }
index b892e89..97d856e 100644 (file)
@@ -45,6 +45,7 @@ public final class CellInfoLte extends CellInfo implements Parcelable {
         this.mCellSignalStrengthLte = ci.mCellSignalStrengthLte.copy();
     }
 
+    @Override
     public CellIdentityLte getCellIdentity() {
         if (DBG) log("getCellIdentity: " + mCellIdentityLte);
         return mCellIdentityLte;
@@ -55,6 +56,7 @@ public final class CellInfoLte extends CellInfo implements Parcelable {
         mCellIdentityLte = cid;
     }
 
+    @Override
     public CellSignalStrengthLte getCellSignalStrength() {
         if (DBG) log("getCellSignalStrength: " + mCellSignalStrengthLte);
         return mCellSignalStrengthLte;
index 7084c51..4fb1bce 100644 (file)
@@ -48,6 +48,7 @@ public final class CellInfoTdscdma extends CellInfo implements Parcelable {
         this.mCellSignalStrengthTdscdma = ci.mCellSignalStrengthTdscdma.copy();
     }
 
+    @Override
     public CellIdentityTdscdma getCellIdentity() {
         return mCellIdentityTdscdma;
     }
@@ -56,6 +57,7 @@ public final class CellInfoTdscdma extends CellInfo implements Parcelable {
         mCellIdentityTdscdma = cid;
     }
 
+    @Override
     public CellSignalStrengthTdscdma getCellSignalStrength() {
         return mCellSignalStrengthTdscdma;
     }
index 005f3d3..4f9dcb1 100644 (file)
@@ -47,6 +47,7 @@ public final class CellInfoWcdma extends CellInfo implements Parcelable {
         this.mCellSignalStrengthWcdma = ci.mCellSignalStrengthWcdma.copy();
     }
 
+    @Override
     public CellIdentityWcdma getCellIdentity() {
         return mCellIdentityWcdma;
     }
@@ -55,6 +56,7 @@ public final class CellInfoWcdma extends CellInfo implements Parcelable {
         mCellIdentityWcdma = cid;
     }
 
+    @Override
     public CellSignalStrengthWcdma getCellSignalStrength() {
         return mCellSignalStrengthWcdma;
     }