Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f6fc129 authored by Wink Saville's avatar Wink Saville Committed by Android (Google) Code Review
Browse files

Merge "Add CellInfoWcdma and related classes." into jb-mr2-dev

parents 9968b523 e3a9cbc0
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -21571,7 +21571,7 @@ package android.telephony {
    method public int getLac();
    method public int getMcc();
    method public int getMnc();
    method public int getPsc();
    method public deprecated int getPsc();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
@@ -21587,6 +21587,17 @@ package android.telephony {
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  public final class CellIdentityWcdma 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 void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  public abstract class CellInfo implements android.os.Parcelable {
    method public int describeContents();
    method public long getTimeStamp();
@@ -21616,6 +21627,13 @@ package android.telephony {
    field 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();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  public abstract class CellLocation {
    ctor public CellLocation();
    method public static android.telephony.CellLocation getEmpty();
@@ -21671,6 +21689,17 @@ package android.telephony {
    field 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 boolean equals(java.lang.Object);
    method public int getAsuLevel();
    method public int getDbm();
    method public int getLevel();
    method public int hashCode();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  public class NeighboringCellInfo implements android.os.Parcelable {
    ctor public deprecated NeighboringCellInfo();
    ctor public deprecated NeighboringCellInfo(int, int);
+6 −6
Original line number Diff line number Diff line
@@ -93,21 +93,21 @@ public final class CellIdentityCdma implements Parcelable {
    }

    /**
     * @return Network Id 0..65535
     * @return Network Id 0..65535, Integer.MAX_VALUE if unknown
     */
    public int getNetworkId() {
        return mNetworkId;
    }

    /**
     * @return System Id 0..32767
     * @return System Id 0..32767, Integer.MAX_VALUE if unknown
     */
    public int getSystemId() {
        return mSystemId;
    }

    /**
     * @return Base Station Id 0..65535
     * @return Base Station Id 0..65535, Integer.MAX_VALUE if unknown
     */
    public int getBasestationId() {
        return mBasestationId;
@@ -118,7 +118,7 @@ public final class CellIdentityCdma implements Parcelable {
     * specified in 3GPP2 C.S0005-A v6.0. It is represented in units
     * of 0.25 seconds and ranges from -2592000 to 2592000, both
     * values inclusive (corresponding to a range of -180
     * to +180 degrees).
     * to +180 degrees). Integer.MAX_VALUE if unknown.
     */
    public int getLongitude() {
        return mLongitude;
@@ -129,7 +129,7 @@ public final class CellIdentityCdma implements Parcelable {
     * specified in 3GPP2 C.S0005-A v6.0. It is represented in units
     * of 0.25 seconds and ranges from -1296000 to 1296000, both
     * values inclusive (corresponding to a range of -90
     * to +90 degrees).
     * to +90 degrees). Integer.MAX_VALUE if unknown.
     */
    public int getLatitude() {
        return mLatitude;
@@ -162,7 +162,7 @@ public final class CellIdentityCdma implements Parcelable {

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("CellIdentitiyCdma:{");
        StringBuilder sb = new StringBuilder("CellIdentityCdma:{");
        sb.append(" mNetworkId="); sb.append(mNetworkId);
        sb.append(" mSystemId="); sb.append(mSystemId);
        sb.append(" mBasestationId="); sb.append(mBasestationId);
+12 −26
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import android.os.Parcelable;
import android.telephony.Rlog;

/**
 * CellIdentity to represent a unique GSM or UMTS cell
 * CellIdentity to represent a unique GSM cell
 */
public final class CellIdentityGsm implements Parcelable {

@@ -35,10 +35,7 @@ public final class CellIdentityGsm implements Parcelable {
    // 16-bit Location Area Code, 0..65535
    private final int mLac;
    // 16-bit GSM Cell Identity described in TS 27.007, 0..65535
    // 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455
    private final int mCid;
    // 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511
    private final int mPsc;

    /**
     * @hide
@@ -48,7 +45,6 @@ public final class CellIdentityGsm implements Parcelable {
        mMnc = Integer.MAX_VALUE;
        mLac = Integer.MAX_VALUE;
        mCid = Integer.MAX_VALUE;
        mPsc = Integer.MAX_VALUE;
    }
    /**
     * public constructor
@@ -56,16 +52,14 @@ public final class CellIdentityGsm implements Parcelable {
     * @param mnc 2 or 3-digit Mobile Network Code, 0..999
     * @param lac 16-bit Location Area Code, 0..65535
     * @param cid 16-bit GSM Cell Identity or 28-bit UMTS Cell Identity
     * @param psc 9-bit UMTS Primary Scrambling Code
     *
     * @hide
     */
    public CellIdentityGsm (int mcc, int mnc, int lac, int cid, int psc) {
    public CellIdentityGsm (int mcc, int mnc, int lac, int cid) {
        mMcc = mcc;
        mMnc = mnc;
        mLac = lac;
        mCid = cid;
        mPsc = psc;
    }

    private CellIdentityGsm(CellIdentityGsm cid) {
@@ -73,7 +67,6 @@ public final class CellIdentityGsm implements Parcelable {
        mMnc = cid.mMnc;
        mLac = cid.mLac;
        mCid = cid.mCid;
        mPsc = cid.mPsc;
    }

    CellIdentityGsm copy() {
@@ -81,21 +74,21 @@ public final class CellIdentityGsm implements Parcelable {
    }

    /**
     * @return 3-digit Mobile Country Code, 0..999
     * @return 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
     */
    public int getMcc() {
        return mMcc;
    }

    /**
     * @return 2 or 3-digit Mobile Network Code, 0..999
     * @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
     */
    public int getMnc() {
        return mMnc;
    }

    /**
     * @return 16-bit Location Area Code, 0..65535
     * @return 16-bit Location Area Code, 0..65535, Integer.MAX_VALUE if unknown
     */
    public int getLac() {
        return mLac;
@@ -104,27 +97,24 @@ public final class CellIdentityGsm implements Parcelable {
    /**
     * @return CID
     * Either 16-bit GSM Cell Identity described
     * in TS 27.007, 0..65535
     * or 28-bit UMTS Cell Identity described
     * in TS 25.331, 0..268435455
     * in TS 27.007, 0..65535, Integer.MAX_VALUE if unknown
     */
    public int getCid() {
        return mCid;
    }

    /**
     * @return 9-bit UMTS Primary Scrambling Code described in
     * TS 25.331, 0..511
     * @return Integer.MAX_VALUE, undefined for GSM
     */
    @Deprecated
    public int getPsc() {
        return mPsc;
        return Integer.MAX_VALUE;
    }

    @Override
    public int hashCode() {
        int primeNum = 31;
        return (mMcc * primeNum) + (mMnc * primeNum) + (mLac * primeNum) + (mCid * primeNum) +
                (mPsc * primeNum);
        return (mMcc * primeNum) + (mMnc * primeNum) + (mLac * primeNum) + (mCid * primeNum);
    }

    @Override
@@ -135,8 +125,7 @@ public final class CellIdentityGsm implements Parcelable {
                return mMcc == o.mMcc &&
                        mMnc == o.mMnc &&
                        mLac == o.mLac &&
                        mCid == o.mCid &&
                        mPsc == o.mPsc;
                        mCid == o.mCid;
            } catch (ClassCastException e) {
                return false;
            }
@@ -147,12 +136,11 @@ public final class CellIdentityGsm implements Parcelable {

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("CellIdentitiyGsm:{");
        StringBuilder sb = new StringBuilder("CellIdentityGsm:{");
        sb.append(" mMcc=").append(mMcc);
        sb.append(" mMnc=").append(mMnc);
        sb.append(" mLac=").append(mLac);
        sb.append(" mCid=").append(mCid);
        sb.append(" mPsc=").append(mPsc);
        sb.append("}");

        return sb.toString();
@@ -172,7 +160,6 @@ public final class CellIdentityGsm implements Parcelable {
        dest.writeInt(mMnc);
        dest.writeInt(mLac);
        dest.writeInt(mCid);
        dest.writeInt(mPsc);
    }

    /** Construct from Parcel, type has already been processed */
@@ -181,7 +168,6 @@ public final class CellIdentityGsm implements Parcelable {
        mMnc = in.readInt();
        mLac = in.readInt();
        mCid = in.readInt();
        mPsc = in.readInt();
        if (DBG) log("CellIdentityGsm(Parcel): " + toString());
    }

+6 −6
Original line number Diff line number Diff line
@@ -81,35 +81,35 @@ public final class CellIdentityLte implements Parcelable {
    }

    /**
     * @return 3-digit Mobile Country Code, 0..999
     * @return 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
     */
    public int getMcc() {
        return mMcc;
    }

    /**
     * @return 2 or 3-digit Mobile Network Code, 0..999
     * @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
     */
    public int getMnc() {
        return mMnc;
    }

    /**
     * @return 28-bit Cell Identity
     * @return 28-bit Cell Identity, Integer.MAX_VALUE if unknown
     */
    public int getCi() {
        return mCi;
    }

    /**
     * @return Physical Cell Id 0..503
     * @return Physical Cell Id 0..503, Integer.MAX_VALUE if unknown
     */
    public int getPci() {
        return mPci;
    }

    /**
     * @return 16-bit Tracking Area Code
     * @return 16-bit Tracking Area Code, Integer.MAX_VALUE if unknown
     */
    public int getTac() {
        return mTac;
@@ -142,7 +142,7 @@ public final class CellIdentityLte implements Parcelable {

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("CellIdentitiyLte:{");
        StringBuilder sb = new StringBuilder("CellIdentityLte:{");
        sb.append(" mMcc="); sb.append(mMcc);
        sb.append(" mMnc="); sb.append(mMnc);
        sb.append(" mCi="); sb.append(mCi);
+205 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2013 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;
import android.telephony.Rlog;

/**
 * CellIdentity to represent a unique UMTS cell
 */
public final class CellIdentityWcdma implements Parcelable {

    private static final String LOG_TAG = "CellIdentityWcdma";
    private static final boolean DBG = false;

    // 3-digit Mobile Country Code, 0..999
    private final int mMcc;
    // 2 or 3-digit Mobile Network Code, 0..999
    private final int mMnc;
    // 16-bit Location Area Code, 0..65535
    private final int mLac;
    // 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455
    private final int mCid;
    // 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511
    private final int mPsc;

    /**
     * @hide
     */
    public CellIdentityWcdma() {
        mMcc = Integer.MAX_VALUE;
        mMnc = Integer.MAX_VALUE;
        mLac = Integer.MAX_VALUE;
        mCid = Integer.MAX_VALUE;
        mPsc = Integer.MAX_VALUE;
    }
    /**
     * public constructor
     * @param mcc 3-digit Mobile Country Code, 0..999
     * @param mnc 2 or 3-digit Mobile Network Code, 0..999
     * @param lac 16-bit Location Area Code, 0..65535
     * @param cid 28-bit UMTS Cell Identity
     * @param psc 9-bit UMTS Primary Scrambling Code
     *
     * @hide
     */
    public CellIdentityWcdma (int mcc, int mnc, int lac, int cid, int psc) {
        mMcc = mcc;
        mMnc = mnc;
        mLac = lac;
        mCid = cid;
        mPsc = psc;
    }

    private CellIdentityWcdma(CellIdentityWcdma cid) {
        mMcc = cid.mMcc;
        mMnc = cid.mMnc;
        mLac = cid.mLac;
        mCid = cid.mCid;
        mPsc = cid.mPsc;
    }

    CellIdentityWcdma copy() {
       return new CellIdentityWcdma(this);
    }

    /**
     * @return 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
     */
    public int getMcc() {
        return mMcc;
    }

    /**
     * @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
     */
    public int getMnc() {
        return mMnc;
    }

    /**
     * @return 16-bit Location Area Code, 0..65535, Integer.MAX_VALUE if unknown
     */
    public int getLac() {
        return mLac;
    }

    /**
     * @return CID
     * 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, Integer.MAX_VALUE if unknown
     */
    public int getCid() {
        return mCid;
    }

    /**
     * @return 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511, Integer.MAX_VALUE
     * if unknown
     */
    public int getPsc() {
        return mPsc;
    }

    @Override
    public int hashCode() {
        int primeNum = 31;
        return (mMcc * primeNum) + (mMnc * primeNum) + (mLac * primeNum) + (mCid * primeNum) +
                (mPsc * primeNum);
    }

    @Override
    public boolean equals(Object other) {
        if (super.equals(other)) {
            try {
                CellIdentityWcdma o = (CellIdentityWcdma)other;
                return mMcc == o.mMcc &&
                        mMnc == o.mMnc &&
                        mLac == o.mLac &&
                        mCid == o.mCid &&
                        mPsc == o.mPsc;
            } catch (ClassCastException e) {
                return false;
            }
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("CellIdentityWcdma:{");
        sb.append(" mMcc=").append(mMcc);
        sb.append(" mMnc=").append(mMnc);
        sb.append(" mLac=").append(mLac);
        sb.append(" mCid=").append(mCid);
        sb.append(" mPsc=").append(mPsc);
        sb.append("}");

        return sb.toString();
    }

    /** Implement the Parcelable interface */
    @Override
    public int describeContents() {
        return 0;
    }

    /** Implement the Parcelable interface */
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (DBG) log("writeToParcel(Parcel, int): " + toString());
        dest.writeInt(mMcc);
        dest.writeInt(mMnc);
        dest.writeInt(mLac);
        dest.writeInt(mCid);
        dest.writeInt(mPsc);
    }

    /** Construct from Parcel, type has already been processed */
    private CellIdentityWcdma(Parcel in) {
        mMcc = in.readInt();
        mMnc = in.readInt();
        mLac = in.readInt();
        mCid = in.readInt();
        mPsc = in.readInt();
        if (DBG) log("CellIdentityWcdma(Parcel): " + toString());
    }

    /** Implement the Parcelable interface */
    @SuppressWarnings("hiding")
    public static final Creator<CellIdentityWcdma> CREATOR =
            new Creator<CellIdentityWcdma>() {
        @Override
        public CellIdentityWcdma createFromParcel(Parcel in) {
            return new CellIdentityWcdma(in);
        }

        @Override
        public CellIdentityWcdma[] newArray(int size) {
            return new CellIdentityWcdma[size];
        }
    };

    /**
     * log
     */
    private static void log(String s) {
        Rlog.w(LOG_TAG, s);
    }
}
Loading