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

Commit e8b76356 authored by Sarah Chin's avatar Sarah Chin
Browse files

Modify PhoneCapabilities for device capabilities

Updated PhoneCapability from 1.3 RadioConfig HAL
New SimSlotCapability
Add getPhoneCapability API

Test: atest FrameworksTelephonyTests
Bug: 143238237
Bug: 143238191
Change-Id: I3349c3e50a806fb7bfd65b1bf16079878a5aeb06
Merged-In: I3349c3e50a806fb7bfd65b1bf16079878a5aeb06
parent 51598fab
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -45314,8 +45314,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 {
@@ -45500,6 +45524,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);
@@ -45846,6 +45882,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();
+16 −0
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;
+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
@@ -1439,6 +1439,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