Expose IMSI encryption info APIs as system API
Bug: 142431997 Test: make Change-Id: I7bd15f225ac7774ac6e31c766ee0f11302aae3d8
This commit is contained in:
@@ -7860,6 +7860,14 @@ package android.telephony {
|
|||||||
field public static final int WIFI_LOST = 59; // 0x3b
|
field public static final int WIFI_LOST = 59; // 0x3b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class ImsiEncryptionInfo implements android.os.Parcelable {
|
||||||
|
method public int describeContents();
|
||||||
|
method @Nullable public String getKeyIdentifier();
|
||||||
|
method @Nullable public java.security.PublicKey getPublicKey();
|
||||||
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
|
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ImsiEncryptionInfo> CREATOR;
|
||||||
|
}
|
||||||
|
|
||||||
public final class LteVopsSupportInfo implements android.os.Parcelable {
|
public final class LteVopsSupportInfo implements android.os.Parcelable {
|
||||||
ctor public LteVopsSupportInfo(int, int);
|
ctor public LteVopsSupportInfo(int, int);
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
@@ -8343,6 +8351,7 @@ package android.telephony {
|
|||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void enableVideoCalling(boolean);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void enableVideoCalling(boolean);
|
||||||
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int);
|
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int);
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int);
|
||||||
|
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int);
|
||||||
method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent);
|
method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent);
|
||||||
method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int);
|
method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int);
|
||||||
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.CarrierRestrictionRules getCarrierRestrictionRules();
|
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.CarrierRestrictionRules getCarrierRestrictionRules();
|
||||||
@@ -8396,6 +8405,7 @@ package android.telephony {
|
|||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean rebootRadio();
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean rebootRadio();
|
||||||
method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.MODIFY_PHONE_STATE}) public void requestCellInfoUpdate(@NonNull android.os.WorkSource, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback);
|
method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.MODIFY_PHONE_STATE}) public void requestCellInfoUpdate(@NonNull android.os.WorkSource, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void requestNumberVerification(@NonNull android.telephony.PhoneNumberRange, long, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.NumberVerificationCallback);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void requestNumberVerification(@NonNull android.telephony.PhoneNumberRange, long, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.NumberVerificationCallback);
|
||||||
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void resetCarrierKeysForImsiEncryption();
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean resetRadioConfig();
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean resetRadioConfig();
|
||||||
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>);
|
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>);
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean);
|
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean);
|
||||||
@@ -8431,6 +8441,8 @@ package android.telephony {
|
|||||||
field public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE";
|
field public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE";
|
||||||
field public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL";
|
field public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL";
|
||||||
field public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING";
|
field public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING";
|
||||||
|
field public static final int KEY_TYPE_EPDG = 1; // 0x1
|
||||||
|
field public static final int KEY_TYPE_WLAN = 2; // 0x2
|
||||||
field public static final long NETWORK_TYPE_BITMASK_1xRTT = 64L; // 0x40L
|
field public static final long NETWORK_TYPE_BITMASK_1xRTT = 64L; // 0x40L
|
||||||
field public static final long NETWORK_TYPE_BITMASK_CDMA = 8L; // 0x8L
|
field public static final long NETWORK_TYPE_BITMASK_CDMA = 8L; // 0x8L
|
||||||
field public static final long NETWORK_TYPE_BITMASK_EDGE = 2L; // 0x2L
|
field public static final long NETWORK_TYPE_BITMASK_EDGE = 2L; // 0x2L
|
||||||
|
|||||||
@@ -15,9 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package android.telephony;
|
package android.telephony;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
|
import android.annotation.SystemApi;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import java.util.Date;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.security.KeyFactory;
|
import java.security.KeyFactory;
|
||||||
@@ -25,18 +27,18 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.InvalidKeySpecException;
|
||||||
import java.security.spec.X509EncodedKeySpec;
|
import java.security.spec.X509EncodedKeySpec;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to represent information sent by the carrier, which will be used to encrypt
|
* Class to represent information sent by the carrier, which will be used to encrypt
|
||||||
* the IMSI + IMPI. The ecryption is being done by WLAN, and the modem.
|
* the IMSI + IMPI. The ecryption is being done by WLAN, and the modem.
|
||||||
*
|
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@SystemApi
|
||||||
public final class ImsiEncryptionInfo implements Parcelable {
|
public final class ImsiEncryptionInfo implements Parcelable {
|
||||||
|
|
||||||
private static final String LOG_TAG = "ImsiEncryptionInfo";
|
private static final String LOG_TAG = "ImsiEncryptionInfo";
|
||||||
|
|
||||||
|
|
||||||
private final String mcc;
|
private final String mcc;
|
||||||
private final String mnc;
|
private final String mnc;
|
||||||
private final PublicKey publicKey;
|
private final PublicKey publicKey;
|
||||||
@@ -45,11 +47,13 @@ public final class ImsiEncryptionInfo implements Parcelable {
|
|||||||
//Date-Time in UTC when the key will expire.
|
//Date-Time in UTC when the key will expire.
|
||||||
private final Date expirationTime;
|
private final Date expirationTime;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
public ImsiEncryptionInfo(String mcc, String mnc, int keyType, String keyIdentifier,
|
public ImsiEncryptionInfo(String mcc, String mnc, int keyType, String keyIdentifier,
|
||||||
byte[] key, Date expirationTime) {
|
byte[] key, Date expirationTime) {
|
||||||
this(mcc, mnc, keyType, keyIdentifier, makeKeyObject(key), expirationTime);
|
this(mcc, mnc, keyType, keyIdentifier, makeKeyObject(key), expirationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
public ImsiEncryptionInfo(String mcc, String mnc, int keyType, String keyIdentifier,
|
public ImsiEncryptionInfo(String mcc, String mnc, int keyType, String keyIdentifier,
|
||||||
PublicKey publicKey, Date expirationTime) {
|
PublicKey publicKey, Date expirationTime) {
|
||||||
// todo need to validate that ImsiEncryptionInfo is being created with the correct params.
|
// todo need to validate that ImsiEncryptionInfo is being created with the correct params.
|
||||||
@@ -63,6 +67,7 @@ public final class ImsiEncryptionInfo implements Parcelable {
|
|||||||
this.expirationTime = expirationTime;
|
this.expirationTime = expirationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
public ImsiEncryptionInfo(Parcel in) {
|
public ImsiEncryptionInfo(Parcel in) {
|
||||||
int length = in.readInt();
|
int length = in.readInt();
|
||||||
byte b[] = new byte[length];
|
byte b[] = new byte[length];
|
||||||
@@ -75,26 +80,40 @@ public final class ImsiEncryptionInfo implements Parcelable {
|
|||||||
expirationTime = new Date(in.readLong());
|
expirationTime = new Date(in.readLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
public String getMnc() {
|
public String getMnc() {
|
||||||
return this.mnc;
|
return this.mnc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
public String getMcc() {
|
public String getMcc() {
|
||||||
return this.mcc;
|
return this.mcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns key identifier, a string that helps the authentication server to locate the
|
||||||
|
* private key to decrypt the permanent identity, or {@code null} when uavailable.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
public String getKeyIdentifier() {
|
public String getKeyIdentifier() {
|
||||||
return this.keyIdentifier;
|
return this.keyIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
public int getKeyType() {
|
public int getKeyType() {
|
||||||
return this.keyType;
|
return this.keyType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the carrier public key that is used for the IMSI encryption,
|
||||||
|
* or {@code null} when uavailable.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
public PublicKey getPublicKey() {
|
public PublicKey getPublicKey() {
|
||||||
return this.publicKey;
|
return this.publicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
public Date getExpirationTime() {
|
public Date getExpirationTime() {
|
||||||
return this.expirationTime;
|
return this.expirationTime;
|
||||||
}
|
}
|
||||||
@@ -115,7 +134,7 @@ public final class ImsiEncryptionInfo implements Parcelable {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final @android.annotation.NonNull Parcelable.Creator<ImsiEncryptionInfo> CREATOR =
|
public static final @NonNull Parcelable.Creator<ImsiEncryptionInfo> CREATOR =
|
||||||
new Parcelable.Creator<ImsiEncryptionInfo>() {
|
new Parcelable.Creator<ImsiEncryptionInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public ImsiEncryptionInfo createFromParcel(Parcel in) {
|
public ImsiEncryptionInfo createFromParcel(Parcel in) {
|
||||||
@@ -129,7 +148,7 @@ public final class ImsiEncryptionInfo implements Parcelable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||||
byte[] b = publicKey.getEncoded();
|
byte[] b = publicKey.getEncoded();
|
||||||
dest.writeInt(b.length);
|
dest.writeInt(b.length);
|
||||||
dest.writeByteArray(b);
|
dest.writeByteArray(b);
|
||||||
|
|||||||
@@ -197,12 +197,29 @@ public class TelephonyManager {
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
static public final int OTASP_SIM_UNPROVISIONED = 5;
|
static public final int OTASP_SIM_UNPROVISIONED = 5;
|
||||||
|
|
||||||
/** @hide */
|
/**
|
||||||
|
* Used in carrier Wi-Fi for IMSI + IMPI encryption, this indicates a public key that's
|
||||||
|
* available for use in ePDG links.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
static public final int KEY_TYPE_EPDG = 1;
|
static public final int KEY_TYPE_EPDG = 1;
|
||||||
|
|
||||||
/** @hide */
|
/**
|
||||||
|
* Used in carrier Wi-Fi for IMSI + IMPI encryption, this indicates a public key that's
|
||||||
|
* available for use in WLAN links.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
static public final int KEY_TYPE_WLAN = 2;
|
static public final int KEY_TYPE_WLAN = 2;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
@IntDef(prefix = {"KEY_TYPE_"}, value = {KEY_TYPE_EPDG, KEY_TYPE_WLAN})
|
||||||
|
public @interface KeyType {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Single Radio Voice Call Continuity (SRVCC) handover is active.
|
* No Single Radio Voice Call Continuity (SRVCC) handover is active.
|
||||||
* See TS 23.216 for more information.
|
* See TS 23.216 for more information.
|
||||||
@@ -3869,25 +3886,27 @@ public class TelephonyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Carrier specific information that will be used to encrypt the IMSI and IMPI.
|
* Returns carrier specific information that will be used to encrypt the IMSI and IMPI,
|
||||||
* This includes the public key and the key identifier. For multi-sim devices, if no subId
|
* including the public key and the key identifier; or {@code null} if not available.
|
||||||
* has been specified, we will return the value for the dafault data sim.
|
|
||||||
* Return null if it is unavailable.
|
|
||||||
* <p>
|
* <p>
|
||||||
* Requires Permission:
|
* For a multi-sim device, the dafault data sim is used if not specified.
|
||||||
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
* <p>
|
||||||
* @param keyType whether the key is being used for wlan or epdg. Valid key types are
|
* Requires Permission: READ_PRIVILEGED_PHONE_STATE.
|
||||||
* {@link TelephonyManager#KEY_TYPE_EPDG} or
|
*
|
||||||
* {@link TelephonyManager#KEY_TYPE_WLAN}.
|
* @param keyType whether the key is being used for EPDG or WLAN. Valid values are
|
||||||
|
* {@link #KEY_TYPE_EPDG} or {@link #KEY_TYPE_WLAN}.
|
||||||
* @return ImsiEncryptionInfo Carrier specific information that will be used to encrypt the
|
* @return ImsiEncryptionInfo Carrier specific information that will be used to encrypt the
|
||||||
* IMSI and IMPI. This includes the public key and the key identifier. This information
|
* IMSI and IMPI. This includes the public key and the key identifier. This information
|
||||||
* will be stored in the device keystore. The system will return a null when no key was
|
* will be stored in the device keystore. {@code null} will be returned when no key is
|
||||||
* found, and the carrier does not require a key. The system will throw
|
* found, and the carrier does not require a key.
|
||||||
* IllegalArgumentException when an invalid key is sent or when key is required but
|
* @throws IllegalArgumentException when an invalid key is found or when key is required but
|
||||||
* not found.
|
* not found.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int keyType) {
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
|
@SystemApi
|
||||||
|
@Nullable
|
||||||
|
public ImsiEncryptionInfo getCarrierInfoForImsiEncryption(@KeyType int keyType) {
|
||||||
try {
|
try {
|
||||||
IPhoneSubInfo info = getSubscriberInfo();
|
IPhoneSubInfo info = getSubscriberInfo();
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
@@ -3915,14 +3934,21 @@ public class TelephonyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the Carrier Keys in the database. This involves 2 steps:
|
* Resets the carrier keys used to encrypt the IMSI and IMPI.
|
||||||
|
* <p>
|
||||||
|
* This involves 2 steps:
|
||||||
* 1. Delete the keys from the database.
|
* 1. Delete the keys from the database.
|
||||||
* 2. Send an intent to download new Certificates.
|
* 2. Send an intent to download new Certificates.
|
||||||
* <p>
|
* <p>
|
||||||
* Requires Permission:
|
* For a multi-sim device, the dafault data sim is used if not specified.
|
||||||
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
|
* <p>
|
||||||
|
* Requires Permission: MODIFY_PHONE_STATE.
|
||||||
|
*
|
||||||
|
* @see #getCarrierInfoForImsiEncryption
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
|
@SystemApi
|
||||||
public void resetCarrierKeysForImsiEncryption() {
|
public void resetCarrierKeysForImsiEncryption() {
|
||||||
try {
|
try {
|
||||||
IPhoneSubInfo info = getSubscriberInfo();
|
IPhoneSubInfo info = getSubscriberInfo();
|
||||||
@@ -3949,7 +3975,7 @@ public class TelephonyManager {
|
|||||||
* @return true if the digit at position keyType is 1, else false.
|
* @return true if the digit at position keyType is 1, else false.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
private static boolean isKeyEnabled(int keyAvailability, int keyType) {
|
private static boolean isKeyEnabled(int keyAvailability, @KeyType int keyType) {
|
||||||
int returnValue = (keyAvailability >> (keyType - 1)) & 1;
|
int returnValue = (keyAvailability >> (keyType - 1)) & 1;
|
||||||
return (returnValue == 1) ? true : false;
|
return (returnValue == 1) ? true : false;
|
||||||
}
|
}
|
||||||
@@ -3958,7 +3984,7 @@ public class TelephonyManager {
|
|||||||
* If Carrier requires Imsi to be encrypted.
|
* If Carrier requires Imsi to be encrypted.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
private boolean isImsiEncryptionRequired(int subId, int keyType) {
|
private boolean isImsiEncryptionRequired(int subId, @KeyType int keyType) {
|
||||||
CarrierConfigManager configManager =
|
CarrierConfigManager configManager =
|
||||||
(CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
|
(CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
|
||||||
if (configManager == null) {
|
if (configManager == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user