Merge "Add Conversion from CellIdentity to CellLocation"
This commit is contained in:
@@ -129,6 +129,12 @@ public abstract class CellIdentity implements Parcelable {
|
|||||||
return mAlphaShort;
|
return mAlphaShort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a CellLocation object for this CellIdentity
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public abstract CellLocation asCellLocation();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (!(other instanceof CellIdentity)) {
|
if (!(other instanceof CellIdentity)) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package android.telephony;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.UnsupportedAppUsage;
|
import android.annotation.UnsupportedAppUsage;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.text.TextUtils;
|
import android.telephony.cdma.CdmaCellLocation;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -178,6 +178,18 @@ public final class CellIdentityCdma extends CellIdentity {
|
|||||||
super.hashCode());
|
super.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
@Override
|
||||||
|
public CdmaCellLocation asCellLocation() {
|
||||||
|
CdmaCellLocation cl = new CdmaCellLocation();
|
||||||
|
int bsid = mBasestationId != Integer.MAX_VALUE ? mBasestationId : -1;
|
||||||
|
int sid = mSystemId != Integer.MAX_VALUE ? mSystemId : -1;
|
||||||
|
int nid = mNetworkId != Integer.MAX_VALUE ? mNetworkId : -1;
|
||||||
|
// lat and long already use Integer.MAX_VALUE for invalid/unknown
|
||||||
|
cl.setCellLocationData(bsid, mLatitude, mLongitude, sid, nid);
|
||||||
|
return cl;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (this == other) {
|
if (this == other) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package android.telephony;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.UnsupportedAppUsage;
|
import android.annotation.UnsupportedAppUsage;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -198,6 +199,17 @@ public final class CellIdentityGsm extends CellIdentity {
|
|||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
@Override
|
||||||
|
public GsmCellLocation asCellLocation() {
|
||||||
|
GsmCellLocation cl = new GsmCellLocation();
|
||||||
|
int lac = mLac != Integer.MAX_VALUE ? mLac : -1;
|
||||||
|
int cid = mCid != Integer.MAX_VALUE ? mCid : -1;
|
||||||
|
cl.setLacAndCid(lac, cid);
|
||||||
|
cl.setPsc(-1);
|
||||||
|
return cl;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mLac, mCid, super.hashCode());
|
return Objects.hash(mLac, mCid, super.hashCode());
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package android.telephony;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.UnsupportedAppUsage;
|
import android.annotation.UnsupportedAppUsage;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -200,6 +201,28 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
return mEarfcn;
|
return mEarfcn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A hack to allow tunneling of LTE information via GsmCellLocation
|
||||||
|
* so that older Network Location Providers can return some information
|
||||||
|
* on LTE only networks, see bug 9228974.
|
||||||
|
*
|
||||||
|
* The tunnel'd LTE information is returned as follows:
|
||||||
|
* LAC = TAC field
|
||||||
|
* CID = CI field
|
||||||
|
* PSC = 0.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public GsmCellLocation asCellLocation() {
|
||||||
|
GsmCellLocation cl = new GsmCellLocation();
|
||||||
|
int tac = mTac != Integer.MAX_VALUE ? mTac : -1;
|
||||||
|
int cid = mCi != Integer.MAX_VALUE ? mCi : -1;
|
||||||
|
cl.setLacAndCid(tac, cid);
|
||||||
|
cl.setPsc(0);
|
||||||
|
return cl;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mCi, mPci, mTac, super.hashCode());
|
return Objects.hash(mCi, mPci, mTac, super.hashCode());
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.telephony;
|
package android.telephony;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -134,6 +135,17 @@ public final class CellIdentityTdscdma extends CellIdentity {
|
|||||||
return mUarfcn;
|
return mUarfcn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
@Override
|
||||||
|
public GsmCellLocation asCellLocation() {
|
||||||
|
GsmCellLocation cl = new GsmCellLocation();
|
||||||
|
int lac = mLac != Integer.MAX_VALUE ? mLac : -1;
|
||||||
|
int cid = mCid != Integer.MAX_VALUE ? mCid : -1;
|
||||||
|
cl.setLacAndCid(lac, cid);
|
||||||
|
cl.setPsc(-1); // There is no PSC for TD-SCDMA; not using this for CPI to stem shenanigans
|
||||||
|
return cl;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (this == other) {
|
if (this == other) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package android.telephony;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.UnsupportedAppUsage;
|
import android.annotation.UnsupportedAppUsage;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -191,6 +192,19 @@ public final class CellIdentityWcdma extends CellIdentity {
|
|||||||
return mUarfcn;
|
return mUarfcn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
@Override
|
||||||
|
public GsmCellLocation asCellLocation() {
|
||||||
|
GsmCellLocation cl = new GsmCellLocation();
|
||||||
|
int lac = mLac != Integer.MAX_VALUE ? mLac : -1;
|
||||||
|
int cid = mCid != Integer.MAX_VALUE ? mCid : -1;
|
||||||
|
int psc = mPsc != Integer.MAX_VALUE ? mPsc : -1;
|
||||||
|
cl.setLacAndCid(lac, cid);
|
||||||
|
cl.setPsc(psc);
|
||||||
|
|
||||||
|
return cl;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (this == other) {
|
if (this == other) {
|
||||||
|
|||||||
Reference in New Issue
Block a user