Loading telephony/java/android/telephony/CellIdentity.java +36 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,12 @@ public abstract class CellIdentity implements Parcelable { /** @hide */ protected String mAlphaShort; // For GSM, WCDMA, TDSCDMA, LTE and NR, Cell Global ID is defined in 3GPP TS 23.003. // For CDMA, its defined as System Id + Network Id + Basestation Id. /** @hide */ protected String mGlobalCellId; /** @hide */ protected CellIdentity(@Nullable String tag, int type, @Nullable String mcc, @Nullable String mnc, @Nullable String alphal, @Nullable String alphas) { Loading Loading @@ -181,6 +187,36 @@ public abstract class CellIdentity implements Parcelable { mAlphaShort = alphaShort; } /** * @return Global Cell ID * @hide */ @Nullable public String getGlobalCellId() { return mGlobalCellId; } /** * @param ci a CellIdentity to compare to the current CellIdentity. * @return true if ci has the same technology and Global Cell ID; false, otherwise. * @hide */ public boolean isSameCell(@Nullable CellIdentity ci) { if (ci == null) return false; if (this.getClass() != ci.getClass()) return false; if (this.getGlobalCellId() == null || ci.getGlobalCellId() == null) return false; return TextUtils.equals(this.getGlobalCellId(), ci.getGlobalCellId()); } /** @hide */ protected String getPlmn() { if (mMccStr == null || mMncStr == null) return null; return mMccStr + mMncStr; } /** @hide */ protected abstract void updateGlobalCellId(); /** * @return a CellLocation object for this CellIdentity * @hide Loading telephony/java/android/telephony/CellIdentityCdma.java +12 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ public final class CellIdentityCdma extends CellIdentity { mBasestationId = CellInfo.UNAVAILABLE; mLongitude = CellInfo.UNAVAILABLE; mLatitude = CellInfo.UNAVAILABLE; mGlobalCellId = null; } /** Loading Loading @@ -106,6 +107,7 @@ public final class CellIdentityCdma extends CellIdentity { } else { mLongitude = mLatitude = CellInfo.UNAVAILABLE; } updateGlobalCellId(); } /** @hide */ Loading Loading @@ -136,6 +138,16 @@ public final class CellIdentityCdma extends CellIdentity { mAlphaLong, mAlphaShort); } /** @hide */ @Override protected void updateGlobalCellId() { mGlobalCellId = null; if (mNetworkId == CellInfo.UNAVAILABLE || mSystemId == CellInfo.UNAVAILABLE || mBasestationId == CellInfo.UNAVAILABLE) return; mGlobalCellId = String.format("%04x%04x%04x", mSystemId, mNetworkId, mBasestationId); } /** * Take the latitude and longitude in 1/4 seconds and see if * the reported location is on Null Island. Loading telephony/java/android/telephony/CellIdentityGsm.java +14 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public final class CellIdentityGsm extends CellIdentity { mArfcn = CellInfo.UNAVAILABLE; mBsic = CellInfo.UNAVAILABLE; mAdditionalPlmns = new ArraySet<>(); mGlobalCellId = null; } /** Loading Loading @@ -94,6 +95,7 @@ public final class CellIdentityGsm extends CellIdentity { mAdditionalPlmns.add(plmn); } } updateGlobalCellId(); } /** @hide */ Loading Loading @@ -136,6 +138,18 @@ public final class CellIdentityGsm extends CellIdentity { CellInfo.UNAVAILABLE, mMccStr, mMncStr, mAlphaLong, mAlphaShort, mAdditionalPlmns); } /** @hide */ @Override protected void updateGlobalCellId() { mGlobalCellId = null; String plmn = getPlmn(); if (plmn == null) return; if (mLac == CellInfo.UNAVAILABLE || mCid == CellInfo.UNAVAILABLE) return; mGlobalCellId = plmn + String.format("%04x%04x", mLac, mCid); } /** * @return 3-digit Mobile Country Code, 0..999, * {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable. Loading telephony/java/android/telephony/CellIdentityLte.java +14 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ public final class CellIdentityLte extends CellIdentity { mBandwidth = CellInfo.UNAVAILABLE; mAdditionalPlmns = new ArraySet<>(); mCsgInfo = null; mGlobalCellId = null; } /** Loading Loading @@ -130,6 +131,7 @@ public final class CellIdentityLte extends CellIdentity { } } mCsgInfo = csgInfo; updateGlobalCellId(); } /** @hide */ Loading Loading @@ -172,6 +174,18 @@ public final class CellIdentityLte extends CellIdentity { return new CellIdentityLte(this); } /** @hide */ @Override protected void updateGlobalCellId() { mGlobalCellId = null; String plmn = getPlmn(); if (plmn == null) return; if (mCi == CellInfo.UNAVAILABLE) return; mGlobalCellId = plmn + String.format("%07x", mCi); } /** * @return 3-digit Mobile Country Code, 0..999, * {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable. Loading telephony/java/android/telephony/CellIdentityNr.java +12 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ public final class CellIdentityNr extends CellIdentity { mAdditionalPlmns.add(plmn); } } updateGlobalCellId(); } /** @hide */ Loading @@ -107,6 +108,17 @@ public final class CellIdentityNr extends CellIdentity { mAdditionalPlmns); } /** @hide */ protected void updateGlobalCellId() { mGlobalCellId = null; String plmn = getPlmn(); if (plmn == null) return; if (mNci == CellInfo.UNAVAILABLE_LONG) return; mGlobalCellId = plmn + String.format("%09x", mNci); } /** * @return a CellLocation object for this CellIdentity. * @hide Loading Loading
telephony/java/android/telephony/CellIdentity.java +36 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,12 @@ public abstract class CellIdentity implements Parcelable { /** @hide */ protected String mAlphaShort; // For GSM, WCDMA, TDSCDMA, LTE and NR, Cell Global ID is defined in 3GPP TS 23.003. // For CDMA, its defined as System Id + Network Id + Basestation Id. /** @hide */ protected String mGlobalCellId; /** @hide */ protected CellIdentity(@Nullable String tag, int type, @Nullable String mcc, @Nullable String mnc, @Nullable String alphal, @Nullable String alphas) { Loading Loading @@ -181,6 +187,36 @@ public abstract class CellIdentity implements Parcelable { mAlphaShort = alphaShort; } /** * @return Global Cell ID * @hide */ @Nullable public String getGlobalCellId() { return mGlobalCellId; } /** * @param ci a CellIdentity to compare to the current CellIdentity. * @return true if ci has the same technology and Global Cell ID; false, otherwise. * @hide */ public boolean isSameCell(@Nullable CellIdentity ci) { if (ci == null) return false; if (this.getClass() != ci.getClass()) return false; if (this.getGlobalCellId() == null || ci.getGlobalCellId() == null) return false; return TextUtils.equals(this.getGlobalCellId(), ci.getGlobalCellId()); } /** @hide */ protected String getPlmn() { if (mMccStr == null || mMncStr == null) return null; return mMccStr + mMncStr; } /** @hide */ protected abstract void updateGlobalCellId(); /** * @return a CellLocation object for this CellIdentity * @hide Loading
telephony/java/android/telephony/CellIdentityCdma.java +12 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ public final class CellIdentityCdma extends CellIdentity { mBasestationId = CellInfo.UNAVAILABLE; mLongitude = CellInfo.UNAVAILABLE; mLatitude = CellInfo.UNAVAILABLE; mGlobalCellId = null; } /** Loading Loading @@ -106,6 +107,7 @@ public final class CellIdentityCdma extends CellIdentity { } else { mLongitude = mLatitude = CellInfo.UNAVAILABLE; } updateGlobalCellId(); } /** @hide */ Loading Loading @@ -136,6 +138,16 @@ public final class CellIdentityCdma extends CellIdentity { mAlphaLong, mAlphaShort); } /** @hide */ @Override protected void updateGlobalCellId() { mGlobalCellId = null; if (mNetworkId == CellInfo.UNAVAILABLE || mSystemId == CellInfo.UNAVAILABLE || mBasestationId == CellInfo.UNAVAILABLE) return; mGlobalCellId = String.format("%04x%04x%04x", mSystemId, mNetworkId, mBasestationId); } /** * Take the latitude and longitude in 1/4 seconds and see if * the reported location is on Null Island. Loading
telephony/java/android/telephony/CellIdentityGsm.java +14 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public final class CellIdentityGsm extends CellIdentity { mArfcn = CellInfo.UNAVAILABLE; mBsic = CellInfo.UNAVAILABLE; mAdditionalPlmns = new ArraySet<>(); mGlobalCellId = null; } /** Loading Loading @@ -94,6 +95,7 @@ public final class CellIdentityGsm extends CellIdentity { mAdditionalPlmns.add(plmn); } } updateGlobalCellId(); } /** @hide */ Loading Loading @@ -136,6 +138,18 @@ public final class CellIdentityGsm extends CellIdentity { CellInfo.UNAVAILABLE, mMccStr, mMncStr, mAlphaLong, mAlphaShort, mAdditionalPlmns); } /** @hide */ @Override protected void updateGlobalCellId() { mGlobalCellId = null; String plmn = getPlmn(); if (plmn == null) return; if (mLac == CellInfo.UNAVAILABLE || mCid == CellInfo.UNAVAILABLE) return; mGlobalCellId = plmn + String.format("%04x%04x", mLac, mCid); } /** * @return 3-digit Mobile Country Code, 0..999, * {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable. Loading
telephony/java/android/telephony/CellIdentityLte.java +14 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ public final class CellIdentityLte extends CellIdentity { mBandwidth = CellInfo.UNAVAILABLE; mAdditionalPlmns = new ArraySet<>(); mCsgInfo = null; mGlobalCellId = null; } /** Loading Loading @@ -130,6 +131,7 @@ public final class CellIdentityLte extends CellIdentity { } } mCsgInfo = csgInfo; updateGlobalCellId(); } /** @hide */ Loading Loading @@ -172,6 +174,18 @@ public final class CellIdentityLte extends CellIdentity { return new CellIdentityLte(this); } /** @hide */ @Override protected void updateGlobalCellId() { mGlobalCellId = null; String plmn = getPlmn(); if (plmn == null) return; if (mCi == CellInfo.UNAVAILABLE) return; mGlobalCellId = plmn + String.format("%07x", mCi); } /** * @return 3-digit Mobile Country Code, 0..999, * {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable. Loading
telephony/java/android/telephony/CellIdentityNr.java +12 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ public final class CellIdentityNr extends CellIdentity { mAdditionalPlmns.add(plmn); } } updateGlobalCellId(); } /** @hide */ Loading @@ -107,6 +108,17 @@ public final class CellIdentityNr extends CellIdentity { mAdditionalPlmns); } /** @hide */ protected void updateGlobalCellId() { mGlobalCellId = null; String plmn = getPlmn(); if (plmn == null) return; if (mNci == CellInfo.UNAVAILABLE_LONG) return; mGlobalCellId = plmn + String.format("%09x", mNci); } /** * @return a CellLocation object for this CellIdentity. * @hide Loading