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

Commit b739dedd authored by Sarah Chin's avatar Sarah Chin Committed by Gerrit Code Review
Browse files

Merge changes from topics "phone_cap", "tdscdma"

* changes:
  Modify PhoneCapabilities for device capabilities
  Added TD-SCDMA bands for network scanning
parents dd6d0b26 e8b76356
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -44653,6 +44653,12 @@ package android.telephony {
    field public static final int BAND_7 = 7; // 0x7
    field public static final int BAND_8 = 8; // 0x8
    field public static final int BAND_9 = 9; // 0x9
    field public static final int BAND_A = 101; // 0x65
    field public static final int BAND_B = 102; // 0x66
    field public static final int BAND_C = 103; // 0x67
    field public static final int BAND_D = 104; // 0x68
    field public static final int BAND_E = 105; // 0x69
    field public static final int BAND_F = 106; // 0x6a
  }
  public final class AvailableNetworkInfo implements android.os.Parcelable {
@@ -45313,8 +45319,32 @@ package android.telephony {
  public final class PhoneCapability implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public java.util.List<java.lang.Integer> getBands(int);
    method @NonNull public java.util.List<java.util.List<java.lang.Long>> getConcurrentFeaturesSupport();
    method @NonNull public java.util.List<java.lang.String> getLogicalModemUuids();
    method public int getMaxActiveDedicatedBearers();
    method public int getMaxActiveInternetData();
    method public int getMaxActivePsVoice();
    method public long getPsDataConnectionLingerTimeMillis();
    method @NonNull public java.util.List<android.telephony.SimSlotCapability> getSimSlotCapabilities();
    method public long getSupportedRats();
    method public int getUeCategory(boolean, int);
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PhoneCapability> CREATOR;
    field public static final long MODEM_FEATURE_3GPP2_REG = 1L; // 0x1L
    field public static final long MODEM_FEATURE_3GPP_REG = 2L; // 0x2L
    field public static final long MODEM_FEATURE_CDMA2000_EHRPD_REG = 4L; // 0x4L
    field public static final long MODEM_FEATURE_CSIM = 8192L; // 0x2000L
    field public static final long MODEM_FEATURE_CS_VOICE_SESSION = 512L; // 0x200L
    field public static final long MODEM_FEATURE_DEDICATED_BEARER = 2048L; // 0x800L
    field public static final long MODEM_FEATURE_EUTRAN_REG = 32L; // 0x20L
    field public static final long MODEM_FEATURE_EUTRA_NR_DUAL_CONNECTIVITY_REG = 128L; // 0x80L
    field public static final long MODEM_FEATURE_GERAN_REG = 8L; // 0x8L
    field public static final long MODEM_FEATURE_INTERACTIVE_DATA_SESSION = 1024L; // 0x400L
    field public static final long MODEM_FEATURE_NETWORK_SCAN = 4096L; // 0x1000L
    field public static final long MODEM_FEATURE_NGRAN_REG = 64L; // 0x40L
    field public static final long MODEM_FEATURE_PS_VOICE_REG = 256L; // 0x100L
    field public static final long MODEM_FEATURE_UTRAN_REG = 16L; // 0x10L
  }
  public class PhoneNumberFormattingTextWatcher implements android.text.TextWatcher {
@@ -45499,6 +45529,18 @@ package android.telephony {
    field public static final int INVALID = 2147483647; // 0x7fffffff
  }
  public final class SimSlotCapability implements android.os.Parcelable {
    method public int describeContents();
    method public int getPhysicalSlotIndex();
    method public int getSlotType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SimSlotCapability> CREATOR;
    field public static final int SLOT_TYPE_EUICC = 3; // 0x3
    field public static final int SLOT_TYPE_IUICC = 2; // 0x2
    field public static final int SLOT_TYPE_SOFT_SIM = 4; // 0x4
    field public static final int SLOT_TYPE_UICC = 1; // 0x1
  }
  public final class SmsManager {
    method public String createAppSpecificSmsToken(android.app.PendingIntent);
    method @Nullable public String createAppSpecificSmsTokenWithPackageInfo(@Nullable String, @NonNull android.app.PendingIntent);
@@ -45845,6 +45887,7 @@ package android.telephony {
    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public int getNetworkSelectionMode();
    method public String getNetworkSpecifier();
    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkType();
    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telephony.PhoneCapability getPhoneCapability();
    method @Deprecated public int getPhoneCount();
    method public int getPhoneType();
    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public int getPreferredOpportunisticDataSubscription();
+30 −7
Original line number Diff line number Diff line
@@ -67,6 +67,22 @@ public final class AccessNetworkConstants {
        }
    }

    /**
     * Access network type
     * @hide
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"RADIO_ACCESS_NETWORK_TYPE_"},
            value = {
                    AccessNetworkType.UNKNOWN,
                    AccessNetworkType.GERAN,
                    AccessNetworkType.UTRAN,
                    AccessNetworkType.EUTRAN,
                    AccessNetworkType.CDMA2000,
                    AccessNetworkType.IWLAN,
                    AccessNetworkType.NGRAN})
    public @interface RadioAccessNetworkType {}

    public static final class AccessNetworkType {
        public static final int UNKNOWN = 0;
        public static final int GERAN = 1;
@@ -115,11 +131,11 @@ public final class AccessNetworkConstants {
        public static final int BAND_ER900 = 14;

        /** @hide */
        private GeranBand() {};
        private GeranBand() {}
    }

    /**
     * Frenquency bands for UTRAN.
     * Frequency bands for UTRAN.
     * http://www.etsi.org/deliver/etsi_ts/125100_125199/125104/13.03.00_60/ts_125104v130p.pdf
     */
    public static final class UtranBand {
@@ -146,12 +162,19 @@ public final class AccessNetworkConstants {
        public static final int BAND_25 = 25;
        public static final int BAND_26 = 26;

        /** Frequency bands for TD-SCDMA. Defined in 3GPP TS 25.102, Table 5.2. */
        public static final int BAND_A = 101;
        public static final int BAND_B = 102;
        public static final int BAND_C = 103;
        public static final int BAND_D = 104;
        public static final int BAND_E = 105;
        public static final int BAND_F = 106;
        /** @hide */
        private UtranBand() {};
        private UtranBand() {}
    }

    /**
     * Frenquency bands for EUTRAN.
     * Frequency bands for EUTRAN.
     * http://www.etsi.org/deliver/etsi_ts/136100_136199/136101/14.03.00_60/ts_136101v140p.pdf
     */
    public static final class EutranBand {
@@ -209,7 +232,7 @@ public final class AccessNetworkConstants {
    }

    /**
     * Frenquency bands for CDMA2000.
     * Frequency bands for CDMA2000.
     * http://www.3gpp2.org/Public_html/Specs/C.S0057-E_v1.0_Bandclass_Specification.pdf
     * @hide
     *
@@ -240,7 +263,7 @@ public final class AccessNetworkConstants {
        public static final int BAND_21 = 22;

        /** @hide */
        private CdmaBands() {};
        private CdmaBands() {}
    }

    /**
@@ -295,7 +318,7 @@ public final class AccessNetworkConstants {
        public static final int BAND_261 = 261;

        /** @hide */
        private NgranBands() {};
        private NgranBands() {}
    }

    /** @hide */
+389 −65

File changed.

Preview size limit exceeded, changes collapsed.

+130 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.annotation.IntDef;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;

/**
 * Capabilities for a SIM Slot.
 */
public final class SimSlotCapability implements Parcelable {
    /** Slot type for UICC (removable SIM). */
    public static final int SLOT_TYPE_UICC = 1;
    /** Slot type for iUICC/iSIM (integrated SIM). */
    public static final int SLOT_TYPE_IUICC = 2;
    /** Slot type for eUICC/eSIM (embedded SIM). */
    public static final int SLOT_TYPE_EUICC = 3;
    /** Slot type for soft SIM (no physical SIM). */
    public static final int SLOT_TYPE_SOFT_SIM = 4;

    /** @hide */
    @IntDef(prefix = {"SLOT_TYPE_" }, value = {
            SLOT_TYPE_UICC,
            SLOT_TYPE_IUICC,
            SLOT_TYPE_EUICC,
            SLOT_TYPE_SOFT_SIM,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface SlotType {
    }

    private final int mPhysicalSlotIndex;
    private final int mSlotType;

    /** @hide */
    public SimSlotCapability(int physicalSlotId, int slotType) {
        this.mPhysicalSlotIndex = physicalSlotId;
        this.mSlotType = slotType;
    }

    private SimSlotCapability(Parcel in) {
        mPhysicalSlotIndex = in.readInt();
        mSlotType = in.readInt();
    }

    /**
     * @return physical SIM slot index
     */
    public int getPhysicalSlotIndex() {
        return mPhysicalSlotIndex;
    }

    /**
     * @return type of SIM {@link SlotType}
     */
    public @SlotType int getSlotType() {
        return mSlotType;
    }

    @Override
    public String toString() {
        return "mPhysicalSlotIndex=" + mPhysicalSlotIndex + " slotType=" + mSlotType;
    }

    @Override
    public int hashCode() {
        return Objects.hash(mPhysicalSlotIndex, mSlotType);
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || !(o instanceof SimSlotCapability) || hashCode() != o.hashCode()) {
            return false;
        }

        if (this == o) {
            return true;
        }

        SimSlotCapability s = (SimSlotCapability) o;

        return (mPhysicalSlotIndex == s.mPhysicalSlotIndex && mSlotType == s.mSlotType);
    }

    /**
     * {@link Parcelable#describeContents}
     */
    public @ContentsFlags int describeContents() {
        return 0;
    }

    /**
     * {@link Parcelable#writeToParcel}
     */
    public void writeToParcel(@NonNull Parcel dest, @WriteFlags int flags) {
        dest.writeInt(mPhysicalSlotIndex);
        dest.writeInt(mSlotType);
    }

    public static final @NonNull Parcelable.Creator<SimSlotCapability> CREATOR =
            new Parcelable.Creator() {
                public SimSlotCapability createFromParcel(Parcel in) {
                    return new SimSlotCapability(in);
                }

                public SimSlotCapability[] newArray(int size) {
                    return new SimSlotCapability[size];
                }
            };
}
+18 −0
Original line number Diff line number Diff line
@@ -1519,6 +1519,24 @@ public class TelephonyManager {
    //
    //

    /**
     * Returns the {@link PhoneCapability} for the device or null if it is not available.
     * <p>
     * Requires Permission: READ_PHONE_STATE or that the calling app has
     * carrier privileges (see {@link #hasCarrierPrivileges}).
     */
    @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
    @Nullable
    public PhoneCapability getPhoneCapability() {
        try {
            ITelephony telephony = getITelephony();
            return telephony == null ? null :
                    telephony.getPhoneCapability(getSubId(), getOpPackageName(), getFeatureId());
        } catch (RemoteException ex) {
            return null;
        }
    }

    /**
     * Returns the software version number for the device, for example,
     * the IMEI/SV for GSM phones. Return null if the software version is
Loading