Merge "Add UiccCardInfo APIs"
am: 8acece0441
Change-Id: Id9aececc41b6627cfe4ced5de4c58996005729b9
This commit is contained in:
@@ -5462,6 +5462,7 @@ package android.telephony {
|
||||
method public int getSimCardState();
|
||||
method public int getSupportedRadioAccessFamily();
|
||||
method public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms();
|
||||
method public android.telephony.UiccCardInfo[] getUiccCardsInfo();
|
||||
method public android.telephony.UiccSlotInfo[] getUiccSlotsInfo();
|
||||
method public android.os.Bundle getVisualVoicemailSettings();
|
||||
method public int getVoiceActivationState();
|
||||
@@ -5579,6 +5580,18 @@ package android.telephony {
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.UiccAccessRule> CREATOR;
|
||||
}
|
||||
|
||||
public class UiccCardInfo implements android.os.Parcelable {
|
||||
ctor public UiccCardInfo(boolean, int, java.lang.String, java.lang.String, int);
|
||||
method public int describeContents();
|
||||
method public int getCardId();
|
||||
method public java.lang.String getEid();
|
||||
method public java.lang.String getIccId();
|
||||
method public int getSlotIndex();
|
||||
method public boolean isEuicc();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.UiccCardInfo> CREATOR;
|
||||
}
|
||||
|
||||
public class UiccSlotInfo implements android.os.Parcelable {
|
||||
ctor public UiccSlotInfo(boolean, boolean, java.lang.String, int, int, boolean);
|
||||
method public int describeContents();
|
||||
|
||||
@@ -3146,6 +3146,29 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about currently inserted UICCs and eUICCs. See {@link UiccCardInfo} for more
|
||||
* details on the kind of information available.
|
||||
*
|
||||
* @return UiccCardInfo an array of UiccCardInfo objects, representing information on the
|
||||
* currently inserted UICCs and eUICCs.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
public UiccCardInfo[] getUiccCardsInfo() {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony == null) {
|
||||
return null;
|
||||
}
|
||||
return telephony.getUiccCardsInfo();
|
||||
} catch (RemoteException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the UICC slots. The objects in the array can be null if the slot info is not
|
||||
* available, which is possible between phone process starting and getting slot info from modem.
|
||||
|
||||
19
telephony/java/android/telephony/UiccCardInfo.aidl
Normal file
19
telephony/java/android/telephony/UiccCardInfo.aidl
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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;
|
||||
|
||||
parcelable UiccCardInfo;
|
||||
156
telephony/java/android/telephony/UiccCardInfo.java
Normal file
156
telephony/java/android/telephony/UiccCardInfo.java
Normal file
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* The UiccCardInfo represents information about a currently inserted UICC or embedded eUICC.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public class UiccCardInfo implements Parcelable {
|
||||
|
||||
private final boolean mIsEuicc;
|
||||
private final int mCardId;
|
||||
private final String mEid;
|
||||
private final String mIccId;
|
||||
private final int mSlotIndex;
|
||||
|
||||
public static final Creator<UiccCardInfo> CREATOR = new Creator<UiccCardInfo>() {
|
||||
@Override
|
||||
public UiccCardInfo createFromParcel(Parcel in) {
|
||||
return new UiccCardInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UiccCardInfo[] newArray(int size) {
|
||||
return new UiccCardInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
private UiccCardInfo(Parcel in) {
|
||||
mIsEuicc = in.readByte() != 0;
|
||||
mCardId = in.readInt();
|
||||
mEid = in.readString();
|
||||
mIccId = in.readString();
|
||||
mSlotIndex = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeByte((byte) (mIsEuicc ? 1 : 0));
|
||||
dest.writeInt(mCardId);
|
||||
dest.writeString(mEid);
|
||||
dest.writeString(mIccId);
|
||||
dest.writeInt(mSlotIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public UiccCardInfo(boolean isEuicc, int cardId, String eid, String iccId, int slotIndex) {
|
||||
this.mIsEuicc = isEuicc;
|
||||
this.mCardId = cardId;
|
||||
this.mEid = eid;
|
||||
this.mIccId = iccId;
|
||||
this.mSlotIndex = slotIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the UiccCardInfo is an eUICC.
|
||||
* @return true if the UICC is an eUICC.
|
||||
*/
|
||||
public boolean isEuicc() {
|
||||
return mIsEuicc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the card ID of the UICC. See {@link TelephonyManager#getCardIdForDefaultEuicc()} for more
|
||||
* details on card ID.
|
||||
*/
|
||||
public int getCardId() {
|
||||
return mCardId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the embedded ID (EID) of the eUICC. If the UiccCardInfo is not an eUICC
|
||||
* (see {@link #isEuicc()}), returns null.
|
||||
*/
|
||||
public String getEid() {
|
||||
if (!mIsEuicc) {
|
||||
return null;
|
||||
}
|
||||
return mEid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ICCID of the UICC.
|
||||
*/
|
||||
public String getIccId() {
|
||||
return mIccId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slot index for the slot that the UICC is currently inserted in.
|
||||
*/
|
||||
public int getSlotIndex() {
|
||||
return mSlotIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
UiccCardInfo that = (UiccCardInfo) obj;
|
||||
return ((mIsEuicc == that.mIsEuicc)
|
||||
&& (mCardId == that.mCardId)
|
||||
&& (Objects.equals(mEid, that.mEid))
|
||||
&& (Objects.equals(mIccId, that.mIccId))
|
||||
&& (mSlotIndex == that.mSlotIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mIsEuicc, mCardId, mEid, mIccId, mSlotIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UiccCardInfo (mIsEuicc="
|
||||
+ mIsEuicc
|
||||
+ ", mCardId="
|
||||
+ mCardId
|
||||
+ ", mEid="
|
||||
+ mEid
|
||||
+ ", mIccId="
|
||||
+ mIccId
|
||||
+ ", mSlotIndex="
|
||||
+ mSlotIndex
|
||||
+ ")";
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,7 @@ import com.android.internal.telephony.OperatorInfo;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import android.telephony.UiccCardInfo;
|
||||
import android.telephony.UiccSlotInfo;
|
||||
|
||||
/**
|
||||
@@ -1485,6 +1486,17 @@ interface ITelephony {
|
||||
*/
|
||||
int getCardIdForDefaultEuicc(int subId, String callingPackage);
|
||||
|
||||
/**
|
||||
* Gets information about currently inserted UICCs and eUICCs. See {@link UiccCardInfo} for more
|
||||
* details on the kind of information available.
|
||||
*
|
||||
* @return UiccCardInfo an array of UiccCardInfo objects, representing information on the
|
||||
* currently inserted UICCs and eUICCs.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
UiccCardInfo[] getUiccCardsInfo();
|
||||
|
||||
/**
|
||||
* Get slot info for all the UICC slots.
|
||||
* @return UiccSlotInfo array.
|
||||
|
||||
Reference in New Issue
Block a user