Merge "Refactor Cell Location public API." into jb-mr1-dev

This commit is contained in:
Wink Saville
2012-09-23 15:44:29 -07:00
committed by Android (Google) Code Review
13 changed files with 59 additions and 247 deletions

View File

@@ -20637,66 +20637,65 @@ package android.speech.tts {
package android.telephony {
public abstract class CellIdentity implements android.os.Parcelable {
public final class CellIdentityCdma implements android.os.Parcelable {
method public int describeContents();
method public abstract int hashCode();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class CellIdentityCdma extends android.telephony.CellIdentity implements android.os.Parcelable {
method public int getBasestationId();
method public int getLatitude();
method public int getLongitude();
method public int getNetworkId();
method public int getSystemId();
method public int hashCode();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class CellIdentityGsm extends android.telephony.CellIdentity implements android.os.Parcelable {
public final class CellIdentityGsm implements android.os.Parcelable {
method public int describeContents();
method public int getCid();
method public int getLac();
method public int getMcc();
method public int getMnc();
method public int getPsc();
method public int hashCode();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class CellIdentityLte extends android.telephony.CellIdentity implements android.os.Parcelable {
public final class CellIdentityLte implements android.os.Parcelable {
method public int describeContents();
method public int getCi();
method public int getMcc();
method public int getMnc();
method public int getPci();
method public int getTac();
method public int hashCode();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public class CellInfo implements android.os.Parcelable {
public abstract class CellInfo implements android.os.Parcelable {
method public int describeContents();
method public long getTimeStamp();
method public boolean isRegistered();
method public void writeToParcel(android.os.Parcel, int);
method public abstract void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class CellInfoCdma extends android.telephony.CellInfo implements android.os.Parcelable {
method public android.telephony.CellIdentityCdma getCellIdentity();
method public android.telephony.CellSignalStrengthCdma getCellSignalStrength();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class CellInfoGsm extends android.telephony.CellInfo implements android.os.Parcelable {
method public android.telephony.CellIdentityGsm getCellIdentity();
method public android.telephony.CellSignalStrengthGsm getCellSignalStrength();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class CellInfoLte extends android.telephony.CellInfo implements android.os.Parcelable {
method public android.telephony.CellIdentityLte getCellIdentity();
method public android.telephony.CellSignalStrengthLte getCellSignalStrength();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
@@ -20706,18 +20705,16 @@ package android.telephony {
method public static void requestLocationUpdate();
}
public abstract class CellSignalStrength implements android.os.Parcelable {
method public int describeContents();
public abstract class CellSignalStrength {
method public abstract boolean equals(java.lang.Object);
method public abstract int getAsuLevel();
method public abstract int getDbm();
method public abstract int getLevel();
method public abstract int hashCode();
method public abstract void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public class CellSignalStrengthCdma extends android.telephony.CellSignalStrength implements android.os.Parcelable {
public final class CellSignalStrengthCdma extends android.telephony.CellSignalStrength implements android.os.Parcelable {
method public int describeContents();
method public boolean equals(java.lang.Object);
method public int getAsuLevel();
method public int getCdmaDbm();
@@ -20734,7 +20731,8 @@ package android.telephony {
field public static final android.os.Parcelable.Creator CREATOR;
}
public class CellSignalStrengthGsm extends android.telephony.CellSignalStrength implements android.os.Parcelable {
public final class CellSignalStrengthGsm extends android.telephony.CellSignalStrength implements android.os.Parcelable {
method public int describeContents();
method public boolean equals(java.lang.Object);
method public int getAsuLevel();
method public int getDbm();
@@ -20744,7 +20742,8 @@ package android.telephony {
field public static final android.os.Parcelable.Creator CREATOR;
}
public class CellSignalStrengthLte extends android.telephony.CellSignalStrength implements android.os.Parcelable {
public final class CellSignalStrengthLte extends android.telephony.CellSignalStrength implements android.os.Parcelable {
method public int describeContents();
method public boolean equals(java.lang.Object);
method public int getAsuLevel();
method public int getDbm();

View File

@@ -1,102 +0,0 @@
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.telephony;
import android.os.Parcel;
import android.os.Parcelable;
/**
* CellIdentity is immutable and represents ONE unique cell in the world
* it contains all levels of info to identity country, carrier, etc.
*/
public abstract class CellIdentity implements Parcelable {
// Type fields for parceling
/** @hide */
protected static final int TYPE_GSM = 1;
/** @hide */
protected static final int TYPE_CDMA = 2;
/** @hide */
protected static final int TYPE_LTE = 3;
/** @hide */
protected CellIdentity() {
}
/** @hide */
protected CellIdentity(Parcel in) {
}
/** @hide */
protected CellIdentity(CellIdentity cid) {
}
/**
* @return a copy of this object with package visibility.
*/
abstract CellIdentity copy();
@Override
public abstract int hashCode();
@Override
public boolean equals(Object other) {
if (other == null) {
return false;
}
if (this == other) {
return true;
}
return (other instanceof CellIdentity);
}
@Override
public String toString() {
return "";
}
/** Implement the Parcelable interface */
@Override
public int describeContents() {
return 0;
}
/** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
}
/** Implement the Parcelable interface */
public static final Creator<CellIdentity> CREATOR =
new Creator<CellIdentity>() {
@Override
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
case TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
case TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
default: throw new RuntimeException("Bad CellIdentity Parcel");
}
}
@Override
public CellIdentity[] newArray(int size) {
return new CellIdentity[size];
}
};
}

View File

@@ -23,7 +23,7 @@ import android.util.Log;
/**
* CellIdentity is to represent a unique CDMA cell
*/
public final class CellIdentityCdma extends CellIdentity implements Parcelable {
public final class CellIdentityCdma implements Parcelable {
private static final String LOG_TAG = "CellSignalStrengthCdma";
private static final boolean DBG = false;
@@ -81,7 +81,6 @@ public final class CellIdentityCdma extends CellIdentity implements Parcelable {
}
private CellIdentityCdma(CellIdentityCdma cid) {
super(cid);
mNetworkId = cid.mNetworkId;
mSystemId = cid.mSystemId;
mBasestationId = cid.mBasestationId;
@@ -89,7 +88,6 @@ public final class CellIdentityCdma extends CellIdentity implements Parcelable {
mLatitude = cid.mLatitude;
}
@Override
CellIdentityCdma copy() {
return new CellIdentityCdma(this);
}
@@ -185,8 +183,6 @@ public final class CellIdentityCdma extends CellIdentity implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
dest.writeInt(TYPE_CDMA);
super.writeToParcel(dest, flags);
dest.writeInt(mNetworkId);
dest.writeInt(mSystemId);
dest.writeInt(mBasestationId);
@@ -196,7 +192,6 @@ public final class CellIdentityCdma extends CellIdentity implements Parcelable {
/** Construct from Parcel, type has already been processed */
private CellIdentityCdma(Parcel in) {
super(in);
mNetworkId = in.readInt();
mSystemId = in.readInt();
mBasestationId = in.readInt();
@@ -211,8 +206,7 @@ public final class CellIdentityCdma extends CellIdentity implements Parcelable {
new Creator<CellIdentityCdma>() {
@Override
public CellIdentityCdma createFromParcel(Parcel in) {
in.readInt(); // Skip past token, we know what it is
return createFromParcelBody(in);
return new CellIdentityCdma(in);
}
@Override
@@ -221,11 +215,6 @@ public final class CellIdentityCdma extends CellIdentity implements Parcelable {
}
};
/** @hide */
static CellIdentityCdma createFromParcelBody(Parcel in) {
return new CellIdentityCdma(in);
}
/**
* log
*/

View File

@@ -23,7 +23,7 @@ import android.util.Log;
/**
* CellIdentity to represent a unique GSM or UMTS cell
*/
public final class CellIdentityGsm extends CellIdentity implements Parcelable {
public final class CellIdentityGsm implements Parcelable {
private static final String LOG_TAG = "CellIdentityGsm";
private static final boolean DBG = false;
@@ -69,7 +69,6 @@ public final class CellIdentityGsm extends CellIdentity implements Parcelable {
}
private CellIdentityGsm(CellIdentityGsm cid) {
super(cid);
mMcc = cid.mMcc;
mMnc = cid.mMnc;
mLac = cid.mLac;
@@ -77,7 +76,6 @@ public final class CellIdentityGsm extends CellIdentity implements Parcelable {
mPsc = cid.mPsc;
}
@Override
CellIdentityGsm copy() {
return new CellIdentityGsm(this);
}
@@ -170,8 +168,6 @@ public final class CellIdentityGsm extends CellIdentity implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
dest.writeInt(TYPE_GSM);
super.writeToParcel(dest, flags);
dest.writeInt(mMcc);
dest.writeInt(mMnc);
dest.writeInt(mLac);
@@ -181,7 +177,6 @@ public final class CellIdentityGsm extends CellIdentity implements Parcelable {
/** Construct from Parcel, type has already been processed */
private CellIdentityGsm(Parcel in) {
super(in);
mMcc = in.readInt();
mMnc = in.readInt();
mLac = in.readInt();
@@ -196,8 +191,7 @@ public final class CellIdentityGsm extends CellIdentity implements Parcelable {
new Creator<CellIdentityGsm>() {
@Override
public CellIdentityGsm createFromParcel(Parcel in) {
in.readInt(); // Skip past token, we know what it is
return createFromParcelBody(in);
return new CellIdentityGsm(in);
}
@Override
@@ -206,11 +200,6 @@ public final class CellIdentityGsm extends CellIdentity implements Parcelable {
}
};
/** @hide */
static CellIdentityGsm createFromParcelBody(Parcel in) {
return new CellIdentityGsm(in);
}
/**
* log
*/

View File

@@ -23,7 +23,7 @@ import android.util.Log;
/**
* CellIdentity is to represent a unique LTE cell
*/
public final class CellIdentityLte extends CellIdentity implements Parcelable {
public final class CellIdentityLte implements Parcelable {
private static final String LOG_TAG = "CellIdentityLte";
private static final boolean DBG = false;
@@ -69,7 +69,6 @@ public final class CellIdentityLte extends CellIdentity implements Parcelable {
}
private CellIdentityLte(CellIdentityLte cid) {
super(cid);
mMcc = cid.mMcc;
mMnc = cid.mMnc;
mCi = cid.mCi;
@@ -77,7 +76,6 @@ public final class CellIdentityLte extends CellIdentity implements Parcelable {
mTac = cid.mTac;
}
@Override
CellIdentityLte copy() {
return new CellIdentityLte(this);
}
@@ -165,8 +163,6 @@ public final class CellIdentityLte extends CellIdentity implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
dest.writeInt(TYPE_LTE);
super.writeToParcel(dest, flags);
dest.writeInt(mMcc);
dest.writeInt(mMnc);
dest.writeInt(mCi);
@@ -176,7 +172,6 @@ public final class CellIdentityLte extends CellIdentity implements Parcelable {
/** Construct from Parcel, type has already been processed */
private CellIdentityLte(Parcel in) {
super(in);
mMcc = in.readInt();
mMnc = in.readInt();
mCi = in.readInt();
@@ -191,8 +186,7 @@ public final class CellIdentityLte extends CellIdentity implements Parcelable {
new Creator<CellIdentityLte>() {
@Override
public CellIdentityLte createFromParcel(Parcel in) {
in.readInt(); // Skip past token, we know what it is
return createFromParcelBody(in);
return new CellIdentityLte(in);
}
@Override
@@ -201,11 +195,6 @@ public final class CellIdentityLte extends CellIdentity implements Parcelable {
}
};
/** @hide */
static CellIdentityLte createFromParcelBody(Parcel in) {
return new CellIdentityLte(in);
}
/**
* log
*/

View File

@@ -22,7 +22,7 @@ import android.os.Parcelable;
/**
* Immutable cell information from a point in time.
*/
public class CellInfo implements Parcelable {
public abstract class CellInfo implements Parcelable {
// Type fields for parceling
/** @hide */
@@ -157,7 +157,9 @@ public class CellInfo implements Parcelable {
return sb.toString();
}
/** Implement the Parcelable interface */
/**
* Implement the Parcelable interface
*/
@Override
public int describeContents() {
return 0;
@@ -165,13 +167,25 @@ public class CellInfo implements Parcelable {
/** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
public abstract void writeToParcel(Parcel dest, int flags);
/**
* Used by child classes for parceling.
*
* @hide
*/
protected void writeToParcel(Parcel dest, int flags, int type) {
dest.writeInt(type);
dest.writeInt(mRegistered ? 1 : 0);
dest.writeInt(mTimeStampType);
dest.writeLong(mTimeStamp);
}
/** @hide */
/**
* Used by child classes for parceling
*
* @hide
*/
protected CellInfo(Parcel in) {
mRegistered = (in.readInt() == 1) ? true : false;
mTimeStampType = in.readInt();

View File

@@ -104,9 +104,7 @@ public final class CellInfoCdma extends CellInfo implements Parcelable {
/** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
dest.writeInt(TYPE_LTE);
super.writeToParcel(dest, flags);
super.writeToParcel(dest, flags, TYPE_CDMA);
mCellIdentityCdma.writeToParcel(dest, flags);
mCellSignalStrengthCdma.writeToParcel(dest, flags);
}

View File

@@ -104,8 +104,7 @@ public final class CellInfoGsm extends CellInfo implements Parcelable {
/** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(TYPE_LTE);
super.writeToParcel(dest, flags);
super.writeToParcel(dest, flags, TYPE_GSM);
mCellIdentityGsm.writeToParcel(dest, flags);
mCellSignalStrengthGsm.writeToParcel(dest, flags);
}

View File

@@ -26,7 +26,7 @@ import android.util.Log;
public final class CellInfoLte extends CellInfo implements Parcelable {
private static final String LOG_TAG = "CellInfoLte";
private static final boolean DBG = false;
private static final boolean DBG = true;
private CellIdentityLte mCellIdentityLte;
private CellSignalStrengthLte mCellSignalStrengthLte;
@@ -46,18 +46,22 @@ public final class CellInfoLte extends CellInfo implements Parcelable {
}
public CellIdentityLte getCellIdentity() {
if (DBG) log("getCellIdentity: " + mCellIdentityLte);
return mCellIdentityLte;
}
/** @hide */
public void setCellIdentity(CellIdentityLte cid) {
if (DBG) log("setCellIdentity: " + cid);
mCellIdentityLte = cid;
}
public CellSignalStrengthLte getCellSignalStrength() {
if (DBG) log("getCellSignalStrength: " + mCellSignalStrengthLte);
return mCellSignalStrengthLte;
}
/** @hide */
public void setCellSignalStrength(CellSignalStrengthLte css) {
if (DBG) log("setCellSignalStrength: " + css);
mCellSignalStrengthLte = css;
}
@@ -105,8 +109,7 @@ public final class CellInfoLte extends CellInfo implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
dest.writeInt(TYPE_LTE);
super.writeToParcel(dest, flags);
super.writeToParcel(dest, flags, TYPE_LTE);
mCellIdentityLte.writeToParcel(dest, flags);
mCellSignalStrengthLte.writeToParcel(dest, flags);
}

View File

@@ -22,16 +22,7 @@ import android.os.Parcelable;
/**
* Abstract base class for cell phone signal strength related information.
*/
public abstract class CellSignalStrength implements Parcelable {
// Type fields for parceling
/** @hide */
protected static final int TYPE_GSM = 1;
/** @hide */
protected static final int TYPE_CDMA = 2;
/** @hide */
protected static final int TYPE_LTE = 3;
public abstract class CellSignalStrength {
/** @hide */
public static final int SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
@@ -85,34 +76,4 @@ public abstract class CellSignalStrength implements Parcelable {
@Override
public abstract boolean equals (Object o);
/** Implement the Parcelable interface */
@Override
public int describeContents() {
return 0;
}
/** Implement the Parcelable interface */
@Override
public abstract void writeToParcel(Parcel dest, int flags);
/** Implement the Parcelable interface */
public static final Creator<CellSignalStrength> CREATOR =
new Creator<CellSignalStrength>() {
@Override
public CellSignalStrength createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case TYPE_GSM: return CellSignalStrengthGsm.createFromParcelBody(in);
case TYPE_CDMA: return CellSignalStrengthCdma.createFromParcelBody(in);
case TYPE_LTE: return CellSignalStrengthLte.createFromParcelBody(in);
default: throw new RuntimeException("Bad CellSignalStrength Parcel");
}
}
@Override
public CellSignalStrength[] newArray(int size) {
return new CellSignalStrength[size];
}
};
}

View File

@@ -23,7 +23,7 @@ import android.util.Log;
/**
* LTE signal strength related information.
*/
public class CellSignalStrengthCdma extends CellSignalStrength implements Parcelable {
public final class CellSignalStrengthCdma extends CellSignalStrength implements Parcelable {
private static final String LOG_TAG = "CellSignalStrengthCdma";
private static final boolean DBG = false;
@@ -331,7 +331,6 @@ public class CellSignalStrengthCdma extends CellSignalStrength implements Parcel
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
dest.writeInt(CellSignalStrength.TYPE_CDMA);
dest.writeInt(mCdmaDbm);
dest.writeInt(mCdmaEcio);
dest.writeInt(mEvdoDbm);
@@ -364,10 +363,7 @@ public class CellSignalStrengthCdma extends CellSignalStrength implements Parcel
new Parcelable.Creator<CellSignalStrengthCdma>() {
@Override
public CellSignalStrengthCdma createFromParcel(Parcel in) {
if (in.readInt() != CellSignalStrength.TYPE_CDMA) {
throw new RuntimeException("Expecting TYPE_CDMA");
}
return createFromParcelBody(in);
return new CellSignalStrengthCdma(in);
}
@Override
@@ -376,11 +372,6 @@ public class CellSignalStrengthCdma extends CellSignalStrength implements Parcel
}
};
/** @hide */
public static CellSignalStrengthCdma createFromParcelBody(Parcel in) {
return new CellSignalStrengthCdma(in);
}
/**
* log
*/

View File

@@ -23,7 +23,7 @@ import android.util.Log;
/**
* LTE signal strength related information.
*/
public class CellSignalStrengthGsm extends CellSignalStrength implements Parcelable {
public final class CellSignalStrengthGsm extends CellSignalStrength implements Parcelable {
private static final String LOG_TAG = "CellSignalStrengthGsm";
private static final boolean DBG = false;
@@ -190,7 +190,6 @@ public class CellSignalStrengthGsm extends CellSignalStrength implements Parcela
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
dest.writeInt(CellSignalStrength.TYPE_GSM);
dest.writeInt(mSignalStrength);
dest.writeInt(mBitErrorRate);
}
@@ -217,10 +216,7 @@ public class CellSignalStrengthGsm extends CellSignalStrength implements Parcela
new Parcelable.Creator<CellSignalStrengthGsm>() {
@Override
public CellSignalStrengthGsm createFromParcel(Parcel in) {
if (in.readInt() != CellSignalStrength.TYPE_GSM) {
throw new RuntimeException("Expecting TYPE_GSM");
}
return createFromParcelBody(in);
return new CellSignalStrengthGsm(in);
}
@Override
@@ -229,11 +225,6 @@ public class CellSignalStrengthGsm extends CellSignalStrength implements Parcela
}
};
/** @hide */
public static CellSignalStrengthGsm createFromParcelBody(Parcel in) {
return new CellSignalStrengthGsm(in);
}
/**
* log
*/

View File

@@ -23,7 +23,7 @@ import android.util.Log;
/**
* LTE signal strength related information.
*/
public class CellSignalStrengthLte extends CellSignalStrength implements Parcelable {
public final class CellSignalStrengthLte extends CellSignalStrength implements Parcelable {
private static final String LOG_TAG = "CellSignalStrengthLte";
private static final boolean DBG = false;
@@ -246,7 +246,6 @@ public class CellSignalStrengthLte extends CellSignalStrength implements Parcela
@Override
public void writeToParcel(Parcel dest, int flags) {
if (DBG) log("writeToParcel(Parcel, int): " + toString());
dest.writeInt(CellSignalStrength.TYPE_LTE);
dest.writeInt(mSignalStrength);
dest.writeInt(mRsrp);
dest.writeInt(mRsrq);
@@ -281,10 +280,7 @@ public class CellSignalStrengthLte extends CellSignalStrength implements Parcela
new Parcelable.Creator<CellSignalStrengthLte>() {
@Override
public CellSignalStrengthLte createFromParcel(Parcel in) {
if (in.readInt() != CellSignalStrength.TYPE_LTE) {
throw new RuntimeException("Expecting TYPE_LTE");
}
return createFromParcelBody(in);
return new CellSignalStrengthLte(in);
}
@Override
@@ -293,11 +289,6 @@ public class CellSignalStrengthLte extends CellSignalStrength implements Parcela
}
};
/** @hide */
public static CellSignalStrengthLte createFromParcelBody(Parcel in) {
return new CellSignalStrengthLte(in);
}
/**
* log
*/