diff options
-rw-r--r-- | api/current.txt | 9 | ||||
-rwxr-xr-x | api/system-current.txt | 3 | ||||
-rw-r--r-- | core/api/current.txt | 9 | ||||
-rw-r--r-- | core/api/system-current.txt | 3 | ||||
-rw-r--r-- | core/java/android/app/AppOpsManager.java | 68 | ||||
-rw-r--r-- | core/java/android/security/keymaster/KeymasterDefs.java | 3 | ||||
-rw-r--r-- | core/proto/android/app/enums.proto | 3 | ||||
-rw-r--r-- | keystore/java/android/security/Credentials.java | 42 | ||||
-rw-r--r-- | keystore/java/android/security/KeyPairGeneratorSpec.java | 26 | ||||
-rw-r--r-- | keystore/java/android/security/KeyStoreParameter.java | 28 | ||||
-rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java | 72 | ||||
-rw-r--r-- | services/core/java/com/android/server/net/NetworkStatsService.java | 3 | ||||
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 177 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 45 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/RILConstants.java | 4 |
15 files changed, 405 insertions, 90 deletions
diff --git a/api/current.txt b/api/current.txt index 19c31380a935..c2e75cd14968 100644 --- a/api/current.txt +++ b/api/current.txt @@ -48321,7 +48321,9 @@ package android.telephony { method @Deprecated public String iccTransmitApduBasicChannel(int, int, int, int, int, String); method @Deprecated public String iccTransmitApduLogicalChannel(int, int, int, int, int, int, String); method public boolean isConcurrentVoiceAndDataSupported(); + method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE, "android.permission.READ_PRIVILEGED_PHONE_STATE"}) public boolean isDataConnectionAllowed(); method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.MODIFY_PHONE_STATE}) public boolean isDataEnabled(); + method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataEnabledForReason(int); method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataRoamingEnabled(); method public boolean isEmergencyNumber(@NonNull String); method public boolean isHearingAidCompatibilitySupported(); @@ -48342,7 +48344,8 @@ package android.telephony { method @Deprecated public String sendEnvelopeWithStatus(String); method @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void sendUssdRequest(String, android.telephony.TelephonyManager.UssdResponseCallback, android.os.Handler); method public void sendVisualVoicemailSms(String, int, String, android.app.PendingIntent); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(boolean); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabledForReason(int, boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setForbiddenPlmns(@NonNull java.util.List<java.lang.String>); method public boolean setLine1NumberForDisplay(String, String); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setNetworkSelectionModeAutomatic(); @@ -48390,6 +48393,10 @@ package android.telephony { field public static final int DATA_CONNECTING = 1; // 0x1 field public static final int DATA_DISCONNECTED = 0; // 0x0 field public static final int DATA_DISCONNECTING = 4; // 0x4 + field public static final int DATA_ENABLED_REASON_CARRIER = 2; // 0x2 + field public static final int DATA_ENABLED_REASON_POLICY = 1; // 0x1 + field public static final int DATA_ENABLED_REASON_THERMAL = 3; // 0x3 + field public static final int DATA_ENABLED_REASON_USER = 0; // 0x0 field public static final int DATA_SUSPENDED = 3; // 0x3 field public static final int DATA_UNKNOWN = -1; // 0xffffffff field public static final String EXTRA_ACTIVE_SIM_SUPPORTED_COUNT = "android.telephony.extra.ACTIVE_SIM_SUPPORTED_COUNT"; diff --git a/api/system-current.txt b/api/system-current.txt index 19badda56eea..5ea8e438d064 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -11248,7 +11248,6 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isAnyRadioPoweredOn(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApnMetered(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApplicationOnUicc(int); - method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataConnectionAllowed(); method public boolean isDataConnectivityPossible(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataEnabledForApn(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isEmergencyAssistanceEnabled(); @@ -11281,7 +11280,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAllowedNetworkTypes(long); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallForwarding(@NonNull android.telephony.CallForwardingInfo, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingEnabled(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setCarrierRestrictionRules(@NonNull android.telephony.CarrierRestrictionRules); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataActivationState(int); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean); diff --git a/core/api/current.txt b/core/api/current.txt index 4a449049cafd..ab0aec73346b 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -46489,7 +46489,9 @@ package android.telephony { method @Deprecated public String iccTransmitApduBasicChannel(int, int, int, int, int, String); method @Deprecated public String iccTransmitApduLogicalChannel(int, int, int, int, int, int, String); method public boolean isConcurrentVoiceAndDataSupported(); + method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE, "android.permission.READ_PRIVILEGED_PHONE_STATE"}) public boolean isDataConnectionAllowed(); method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.MODIFY_PHONE_STATE}) public boolean isDataEnabled(); + method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataEnabledForReason(int); method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataRoamingEnabled(); method public boolean isEmergencyNumber(@NonNull String); method public boolean isHearingAidCompatibilitySupported(); @@ -46510,7 +46512,8 @@ package android.telephony { method @Deprecated public String sendEnvelopeWithStatus(String); method @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void sendUssdRequest(String, android.telephony.TelephonyManager.UssdResponseCallback, android.os.Handler); method public void sendVisualVoicemailSms(String, int, String, android.app.PendingIntent); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(boolean); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabledForReason(int, boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setForbiddenPlmns(@NonNull java.util.List<java.lang.String>); method public boolean setLine1NumberForDisplay(String, String); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setNetworkSelectionModeAutomatic(); @@ -46558,6 +46561,10 @@ package android.telephony { field public static final int DATA_CONNECTING = 1; // 0x1 field public static final int DATA_DISCONNECTED = 0; // 0x0 field public static final int DATA_DISCONNECTING = 4; // 0x4 + field public static final int DATA_ENABLED_REASON_CARRIER = 2; // 0x2 + field public static final int DATA_ENABLED_REASON_POLICY = 1; // 0x1 + field public static final int DATA_ENABLED_REASON_THERMAL = 3; // 0x3 + field public static final int DATA_ENABLED_REASON_USER = 0; // 0x0 field public static final int DATA_SUSPENDED = 3; // 0x3 field public static final int DATA_UNKNOWN = -1; // 0xffffffff field public static final String EXTRA_ACTIVE_SIM_SUPPORTED_COUNT = "android.telephony.extra.ACTIVE_SIM_SUPPORTED_COUNT"; diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 86afd40d95e4..7db113db8e7e 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -10130,7 +10130,6 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isAnyRadioPoweredOn(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApnMetered(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApplicationOnUicc(int); - method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataConnectionAllowed(); method public boolean isDataConnectivityPossible(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataEnabledForApn(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isEmergencyAssistanceEnabled(); @@ -10163,7 +10162,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAllowedNetworkTypes(long); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallForwarding(@NonNull android.telephony.CallForwardingInfo, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingEnabled(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setCarrierRestrictionRules(@NonNull android.telephony.CarrierRestrictionRules); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataActivationState(int); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean); diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 69b77a9b4c59..0d5bb115db91 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -1111,9 +1111,30 @@ public class AppOpsManager { /** @hide */ public static final int OP_NO_ISOLATED_STORAGE = AppProtoEnums.APP_OP_NO_ISOLATED_STORAGE; + /** + * Reserved key for 100 + * + * @hide + */ + public static final int OP_RESERVED_100 = 100; + + /** + * Reserved key for 101 + * + * @hide + */ + public static final int OP_RESERVED_101 = 101; + + /** + * Reserved key for 102 + * + * @hide + */ + public static final int OP_RESERVED_102 = 102; + /** @hide */ @UnsupportedAppUsage - public static final int _NUM_OP = 100; + public static final int _NUM_OP = 103; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -1430,6 +1451,27 @@ public class AppOpsManager { */ public static final String OPSTR_NO_ISOLATED_STORAGE = "android:no_isolated_storage"; + /** + * Reserved for 100 + * + * @hide + */ + public static final String OPSTR_RESERVED_100 = "android:opstr_reserved_100"; + + /** + * Reserved for 101 + * + * @hide + */ + public static final String OPSTR_RESERVED_101 = "android:opstr_reserved_101"; + + /** + * Reserved for 102 + * + * @hide + */ + public static final String OPSTR_RESERVED_102 = "android:opstr_reserved_102"; + /** {@link #sAppOpsToNote} not initialized yet for this op */ private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0; /** Should not collect noting of this app-op in {@link #sAppOpsToNote} */ @@ -1619,6 +1661,9 @@ public class AppOpsManager { OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED, //AUTO_REVOKE_PERMISSIONS_IF_UNUSED OP_AUTO_REVOKE_MANAGED_BY_INSTALLER, //OP_AUTO_REVOKE_MANAGED_BY_INSTALLER OP_NO_ISOLATED_STORAGE, // NO_ISOLATED_STORAGE + OP_RESERVED_100, // OP_RESERVED_100 + OP_RESERVED_101, // OP_RESERVED_101 + OP_RESERVED_102, // OP_RESERVED_102 }; /** @@ -1725,6 +1770,9 @@ public class AppOpsManager { OPSTR_AUTO_REVOKE_PERMISSIONS_IF_UNUSED, OPSTR_AUTO_REVOKE_MANAGED_BY_INSTALLER, OPSTR_NO_ISOLATED_STORAGE, + OPSTR_RESERVED_100, + OPSTR_RESERVED_101, + OPSTR_RESERVED_102, }; /** @@ -1832,6 +1880,9 @@ public class AppOpsManager { "AUTO_REVOKE_PERMISSIONS_IF_UNUSED", "AUTO_REVOKE_MANAGED_BY_INSTALLER", "NO_ISOLATED_STORAGE", + "RESERVED_100", + "RESERVED_101", + "RESERVED_102", }; /** @@ -1940,6 +1991,9 @@ public class AppOpsManager { null, // no permission for OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED null, // no permission for OP_AUTO_REVOKE_MANAGED_BY_INSTALLER null, // no permission for OP_NO_ISOLATED_STORAGE + null, // OP_RESERVED_100 + null, // OP_RESERVED_101 + null, // OP_RESERVED_102 }; /** @@ -2048,6 +2102,9 @@ public class AppOpsManager { null, // AUTO_REVOKE_PERMISSIONS_IF_UNUSED null, // AUTO_REVOKE_MANAGED_BY_INSTALLER null, // NO_ISOLATED_STORAGE + null, // OP_RESERVED_100 + null, // OP_RESERVED_101 + null, // OP_RESERVED_102 }; /** @@ -2155,6 +2212,9 @@ public class AppOpsManager { null, // AUTO_REVOKE_PERMISSIONS_IF_UNUSED null, // AUTO_REVOKE_MANAGED_BY_INSTALLER null, // NO_ISOLATED_STORAGE + null, // OP_RESERVED_100 + null, // OP_RESERVED_101 + null, // OP_RESERVED_102 }; /** @@ -2261,6 +2321,9 @@ public class AppOpsManager { AppOpsManager.MODE_DEFAULT, // OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED AppOpsManager.MODE_ALLOWED, // OP_AUTO_REVOKE_MANAGED_BY_INSTALLER AppOpsManager.MODE_ERRORED, // OP_NO_ISOLATED_STORAGE + AppOpsManager.MODE_ERRORED, // OP_RESERVED_100 + AppOpsManager.MODE_ERRORED, // OP_RESERVED_101 + AppOpsManager.MODE_ERRORED, // OP_RESERVED_102 }; /** @@ -2371,6 +2434,9 @@ public class AppOpsManager { false, // AUTO_REVOKE_PERMISSIONS_IF_UNUSED false, // AUTO_REVOKE_MANAGED_BY_INSTALLER true, // NO_ISOLATED_STORAGE + false, // OP_RESERVED_100 + false, // OP_RESERVED_101 + false, // OP_RESERVED_102 }; /** diff --git a/core/java/android/security/keymaster/KeymasterDefs.java b/core/java/android/security/keymaster/KeymasterDefs.java index e4ba87c14626..f08756a015b2 100644 --- a/core/java/android/security/keymaster/KeymasterDefs.java +++ b/core/java/android/security/keymaster/KeymasterDefs.java @@ -218,6 +218,7 @@ public final class KeymasterDefs { public static final int KM_ERROR_MISSING_MIN_MAC_LENGTH = -58; public static final int KM_ERROR_UNSUPPORTED_MIN_MAC_LENGTH = -59; public static final int KM_ERROR_CANNOT_ATTEST_IDS = -66; + public static final int KM_ERROR_HARDWARE_TYPE_UNAVAILABLE = -68; public static final int KM_ERROR_DEVICE_LOCKED = -72; public static final int KM_ERROR_UNIMPLEMENTED = -100; public static final int KM_ERROR_VERSION_MISMATCH = -101; @@ -265,6 +266,8 @@ public final class KeymasterDefs { sErrorCodeToString.put(KM_ERROR_INVALID_MAC_LENGTH, "Invalid MAC or authentication tag length"); sErrorCodeToString.put(KM_ERROR_CANNOT_ATTEST_IDS, "Unable to attest device ids"); + sErrorCodeToString.put(KM_ERROR_HARDWARE_TYPE_UNAVAILABLE, "Requested security level " + + "(likely Strongbox) is not available."); sErrorCodeToString.put(KM_ERROR_DEVICE_LOCKED, "Device locked"); sErrorCodeToString.put(KM_ERROR_UNIMPLEMENTED, "Not implemented"); sErrorCodeToString.put(KM_ERROR_UNKNOWN_ERROR, "Unknown error"); diff --git a/core/proto/android/app/enums.proto b/core/proto/android/app/enums.proto index bd5cb62f7fde..98ba029236e6 100644 --- a/core/proto/android/app/enums.proto +++ b/core/proto/android/app/enums.proto @@ -207,4 +207,7 @@ enum AppOpEnum { APP_OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED = 97; APP_OP_AUTO_REVOKE_MANAGED_BY_INSTALLER = 98; APP_OP_NO_ISOLATED_STORAGE = 99; + APP_OP_RESERVED_100 = 100; + APP_OP_RESERVED_101 = 101; + APP_OP_RESERVED_102 = 102; } diff --git a/keystore/java/android/security/Credentials.java b/keystore/java/android/security/Credentials.java index f53a7dc922f0..2162b8ac4885 100644 --- a/keystore/java/android/security/Credentials.java +++ b/keystore/java/android/security/Credentials.java @@ -48,18 +48,38 @@ public class Credentials { public static final String INSTALL_AS_USER_ACTION = "android.credentials.INSTALL_AS_USER"; - /** Key prefix for CA certificates. */ + /** + * Key prefix for CA certificates. + * + * @deprecated Keystore no longer supports unstructured blobs. Public certificates are + * stored in typed slots associated with a given alias. + */ + @Deprecated public static final String CA_CERTIFICATE = "CACERT_"; - /** Key prefix for user certificates. */ + /** + * Key prefix for user certificates. + * + * @deprecated Keystore no longer supports unstructured blobs. Public certificates are + * stored in typed slots associated with a given alias. + */ + @Deprecated public static final String USER_CERTIFICATE = "USRCERT_"; - /** Key prefix for user private and secret keys. */ + /** + * Key prefix for user private and secret keys. + * + * @deprecated Keystore no longer uses alias prefixes to discriminate between entry types. + */ + @Deprecated public static final String USER_PRIVATE_KEY = "USRPKEY_"; - /** Key prefix for user secret keys. - * @deprecated use {@code USER_PRIVATE_KEY} for this category instead. + /** + * Key prefix for user secret keys. + * + * @deprecated use {@code USER_PRIVATE_KEY} for this category instead. */ + @Deprecated public static final String USER_SECRET_KEY = "USRSKEY_"; /** Key prefix for VPN. */ @@ -71,7 +91,13 @@ public class Credentials { /** Key prefix for WIFI. */ public static final String WIFI = "WIFI_"; - /** Key prefix for App Source certificates. */ + /** + * Key prefix for App Source certificates. + * + * @deprecated This was intended for FS-verity but never used. FS-verity is not + * going to use this constant moving forward. + */ + @Deprecated public static final String APP_SOURCE_CERTIFICATE = "FSV_"; /** Key containing suffix of lockdown VPN profile. */ @@ -149,6 +175,7 @@ public class Credentials { pw.close(); return bao.toByteArray(); } + /** * Convert objects from PEM format, which is used for * CA_CERTIFICATE and USER_CERTIFICATE entries. @@ -166,7 +193,8 @@ public class Credentials { PemObject o; while ((o = pr.readPemObject()) != null) { if (o.getType().equals("CERTIFICATE")) { - Certificate c = cf.generateCertificate(new ByteArrayInputStream(o.getContent())); + Certificate c = cf.generateCertificate( + new ByteArrayInputStream(o.getContent())); result.add((X509Certificate) c); } else { throw new IllegalArgumentException("Unknown type " + o.getType()); diff --git a/keystore/java/android/security/KeyPairGeneratorSpec.java b/keystore/java/android/security/KeyPairGeneratorSpec.java index d5b34c432e79..1c1c2eeee794 100644 --- a/keystore/java/android/security/KeyPairGeneratorSpec.java +++ b/keystore/java/android/security/KeyPairGeneratorSpec.java @@ -16,9 +16,9 @@ package android.security; -import android.app.KeyguardManager; import android.annotation.NonNull; import android.annotation.Nullable; +import android.app.KeyguardManager; import android.content.Context; import android.security.keystore.KeyGenParameterSpec; import android.security.keystore.KeyProperties; @@ -78,8 +78,6 @@ public final class KeyPairGeneratorSpec implements AlgorithmParameterSpec { private final Date mEndDate; - private final int mFlags; - /** * Parameter specification for the "{@code AndroidKeyPairGenerator}" * instance of the {@link java.security.KeyPairGenerator} API. The @@ -144,7 +142,6 @@ public final class KeyPairGeneratorSpec implements AlgorithmParameterSpec { mSerialNumber = serialNumber; mStartDate = startDate; mEndDate = endDate; - mFlags = flags; } /** @@ -229,7 +226,7 @@ public final class KeyPairGeneratorSpec implements AlgorithmParameterSpec { * @hide */ public int getFlags() { - return mFlags; + return 0; } /** @@ -243,9 +240,15 @@ public final class KeyPairGeneratorSpec implements AlgorithmParameterSpec { * screen after boot. * * @see KeyguardManager#isDeviceSecure() + * + * @deprecated Encryption at rest is on by default. If extra binding to the lockscreen screen + * credential is desired use + * {@link KeyGenParameterSpec.Builder#setUserAuthenticationRequired(boolean)}. + * This flag will be ignored from Android S. */ + @Deprecated public boolean isEncryptionRequired() { - return (mFlags & KeyStore.FLAG_ENCRYPTED) != 0; + return false; } /** @@ -292,8 +295,6 @@ public final class KeyPairGeneratorSpec implements AlgorithmParameterSpec { private Date mEndDate; - private int mFlags; - /** * Creates a new instance of the {@code Builder} with the given * {@code context}. The {@code context} passed in may be used to pop up @@ -431,10 +432,15 @@ public final class KeyPairGeneratorSpec implements AlgorithmParameterSpec { * secure lock screen after boot. * * @see KeyguardManager#isDeviceSecure() + * + * @deprecated Data at rest encryption is enabled by default. If extra binding to the + * lockscreen credential is desired, use + * {@link KeyGenParameterSpec.Builder#setUserAuthenticationRequired(boolean)}. + * This flag will be ignored from Android S. */ @NonNull + @Deprecated public Builder setEncryptionRequired() { - mFlags |= KeyStore.FLAG_ENCRYPTED; return this; } @@ -455,7 +461,7 @@ public final class KeyPairGeneratorSpec implements AlgorithmParameterSpec { mSerialNumber, mStartDate, mEndDate, - mFlags); + 0); } } } diff --git a/keystore/java/android/security/KeyStoreParameter.java b/keystore/java/android/security/KeyStoreParameter.java index 66c87ed2ec1e..51d29b13ce80 100644 --- a/keystore/java/android/security/KeyStoreParameter.java +++ b/keystore/java/android/security/KeyStoreParameter.java @@ -48,18 +48,16 @@ import java.security.KeyStore.ProtectionParameter; */ @Deprecated public final class KeyStoreParameter implements ProtectionParameter { - private final int mFlags; private KeyStoreParameter( int flags) { - mFlags = flags; } /** * @hide */ public int getFlags() { - return mFlags; + return 0; } /** @@ -74,9 +72,16 @@ public final class KeyStoreParameter implements ProtectionParameter { * screen after boot. * * @see KeyguardManager#isDeviceSecure() + * + * @deprecated Data at rest encryption is enabled by default. If extra binding to the + * lockscreen credential is desired, use + * {@link android.security.keystore.KeyGenParameterSpec + * .Builder#setUserAuthenticationRequired(boolean)}. + * This flag will be ignored from Android S. */ + @Deprecated public boolean isEncryptionRequired() { - return (mFlags & KeyStore.FLAG_ENCRYPTED) != 0; + return false; } /** @@ -100,7 +105,6 @@ public final class KeyStoreParameter implements ProtectionParameter { */ @Deprecated public final static class Builder { - private int mFlags; /** * Creates a new instance of the {@code Builder} with the given @@ -126,14 +130,15 @@ public final class KeyStoreParameter implements ProtectionParameter { * the user unlocks the secure lock screen after boot. * * @see KeyguardManager#isDeviceSecure() + * + * @deprecated Data at rest encryption is enabled by default. If extra binding to the + * lockscreen credential is desired, use + * {@link android.security.keystore.KeyGenParameterSpec + * .Builder#setUserAuthenticationRequired(boolean)}. + * This flag will be ignored from Android S. */ @NonNull public Builder setEncryptionRequired(boolean required) { - if (required) { - mFlags |= KeyStore.FLAG_ENCRYPTED; - } else { - mFlags &= ~KeyStore.FLAG_ENCRYPTED; - } return this; } @@ -145,8 +150,7 @@ public final class KeyStoreParameter implements ProtectionParameter { */ @NonNull public KeyStoreParameter build() { - return new KeyStoreParameter( - mFlags); + return new KeyStoreParameter(0 /* flags */); } } } diff --git a/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java b/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java index 7d766285bdfa..e65614307368 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecMessageValidator.java @@ -343,6 +343,78 @@ public class HdmiCecMessageValidator { return true; } + /** + * Check if the given value is a valid day of month. A valid value is one which falls within the + * range description defined in CEC 1.4 Specification : Operand Descriptions (Section 17) + * + * @param value day of month + * @return true if the day of month is valid + */ + private boolean isValidDayOfMonth(int value) { + return isWithinRange(value, 1, 31); + } + + /** + * Check if the given value is a valid month of year. A valid value is one which falls within + * the range description defined in CEC 1.4 Specification : Operand Descriptions (Section 17) + * + * @param value month of year + * @return true if the month of year is valid + */ + private boolean isValidMonthOfYear(int value) { + return isWithinRange(value, 1, 12); + } + + /** + * Check if the given value is a valid hour. A valid value is one which falls within the range + * description defined in CEC 1.4 Specification : Operand Descriptions (Section 17) + * + * @param value hour + * @return true if the hour is valid + */ + private boolean isValidHour(int value) { + return isWithinRange(value, 0, 23); + } + + /** + * Check if the given value is a valid minute. A valid value is one which falls within the range + * description defined in CEC 1.4 Specification : Operand Descriptions (Section 17) + * + * @param value minute + * @return true if the minute is valid + */ + private boolean isValidMinute(int value) { + return isWithinRange(value, 0, 59); + } + + /** + * Check if the given value is a valid duration hours. A valid value is one which falls within + * the range description defined in CEC 1.4 Specification : Operand Descriptions (Section 17) + * + * @param value duration hours + * @return true if the duration hours is valid + */ + private boolean isValidDurationHours(int value) { + return isWithinRange(value, 0, 99); + } + + /** + * Check if the given value is a valid recording sequence. A valid value is adheres to range + * description defined in CEC 1.4 Specification : Operand Descriptions (Section 17) + * + * @param value recording sequence + * @return true if the given recording sequence is valid + */ + private boolean isValidRecordingSequence(int value) { + value = value & 0xFF; + // Validate bit 7 is set to zero + if ((value & 0x80) != 0x00) { + return false; + } + // Validate than not more than one bit is set + return (Integer.bitCount(value) <= 1); + } + private class PhysicalAddressValidator implements ParameterValidator { @Override public int isValid(byte[] params) { diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java index 71e7c8adc5db..12c24d418611 100644 --- a/services/core/java/com/android/server/net/NetworkStatsService.java +++ b/services/core/java/com/android/server/net/NetworkStatsService.java @@ -552,7 +552,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub { // schedule periodic pall alarm based on {@link NetworkStatsSettings#getPollInterval()}. final PendingIntent pollIntent = - PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_NETWORK_STATS_POLL), 0); + PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_NETWORK_STATS_POLL), + PendingIntent.FLAG_IMMUTABLE); final long currentRealtime = SystemClock.elapsedRealtime(); mAlarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, currentRealtime, diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 56c2500ee295..0e327b42fe3a 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -9160,8 +9160,10 @@ public class TelephonyManager { * app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @param enable Whether to enable mobile data. + * @deprecated use setDataEnabledForReason with reason DATA_ENABLED_REASON_USER instead. * */ + @Deprecated @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(boolean enable) { @@ -9170,19 +9172,16 @@ public class TelephonyManager { /** * @hide - * @deprecated use {@link #setDataEnabled(boolean)} instead. + * @deprecated use {@link #setDataEnabledForReason(int, boolean)} instead. */ @SystemApi @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int subId, boolean enable) { try { - Log.d(TAG, "setDataEnabled: enabled=" + enable); - ITelephony telephony = getITelephony(); - if (telephony != null) - telephony.setUserDataEnabled(subId, enable); - } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#setUserDataEnabled", e); + setDataEnabledForReason(subId, DATA_ENABLED_REASON_USER, enable); + } catch (RuntimeException e) { + Log.e(TAG, "Error calling setDataEnabledForReason e:" + e); } } @@ -9390,15 +9389,12 @@ public class TelephonyManager { @Deprecated @SystemApi public boolean getDataEnabled(int subId) { - boolean retVal = false; try { - ITelephony telephony = getITelephony(); - if (telephony != null) - retVal = telephony.isUserDataEnabled(subId); - } catch (RemoteException | NullPointerException e) { - Log.e(TAG, "Error calling ITelephony#isUserDataEnabled", e); + return isDataEnabledForReason(DATA_ENABLED_REASON_USER); + } catch (RuntimeException e) { + Log.e(TAG, "Error calling isDataEnabledForReason e:" + e); } - return retVal; + return false; } /** @@ -10956,19 +10952,18 @@ public class TelephonyManager { * * @param enabled control enable or disable carrier data. * @see #resetAllCarrierActions() + * @deprecated use {@link #setDataEnabledForReason(int, boolean) with + * reason {@link #DATA_ENABLED_REASON_CARRIER}} instead. * @hide */ + @Deprecated @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean enabled) { try { - ITelephony service = getITelephony(); - if (service != null) { - service.carrierActionSetMeteredApnsEnabled( - getSubId(SubscriptionManager.getDefaultDataSubscriptionId()), enabled); - } - } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#setCarrierDataEnabled", e); + setDataEnabledForReason(DATA_ENABLED_REASON_CARRIER, enabled); + } catch (RuntimeException e) { + Log.e(TAG, "Error calling setDataEnabledForReason e:" + e); } } @@ -11054,18 +11049,142 @@ public class TelephonyManager { /** * Policy control of data connection. Usually used when data limit is passed. * @param enabled True if enabling the data, otherwise disabling. + * @deprecated use {@link #setDataEnabledForReason(int, boolean) with + * reason {@link #DATA_ENABLED_REASON_POLICY}} instead. * @hide */ + @Deprecated @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) public void setPolicyDataEnabled(boolean enabled) { try { + setDataEnabledForReason(DATA_ENABLED_REASON_POLICY, enabled); + } catch (RuntimeException e) { + Log.e(TAG, "Error calling setDataEnabledForReason e:" + e); + } + } + + /** @hide */ + @IntDef({ + DATA_ENABLED_REASON_USER, + DATA_ENABLED_REASON_POLICY, + DATA_ENABLED_REASON_CARRIER, + DATA_ENABLED_REASON_THERMAL + }) + @Retention(RetentionPolicy.SOURCE) + public @interface DataEnabledReason{} + + /** + * To indicate that user enabled or disabled data. + */ + public static final int DATA_ENABLED_REASON_USER = 0; + + /** + * To indicate that data control due to policy. Usually used when data limit is passed. + * Policy data on/off won't affect user settings but will bypass the + * settings and turns off data internally if set to {@code false}. + */ + public static final int DATA_ENABLED_REASON_POLICY = 1; + + /** + * To indicate enable or disable carrier data by the system based on carrier signalling or + * carrier privileged apps. Carrier data on/off won't affect user settings but will bypass the + * settings and turns off data internally if set to {@code false}. + */ + public static final int DATA_ENABLED_REASON_CARRIER = 2; + + /** + * To indicate enable or disable data by thermal service. + * Thermal data on/off won't affect user settings but will bypass the + * settings and turns off data internally if set to {@code false}. + */ + public static final int DATA_ENABLED_REASON_THERMAL = 3; + + /** + * Control of data connection and provide the reason triggering the data connection control. + * This can be called for following reasons + * <ol> + * <li>data limit is passed {@link #DATA_ENABLED_REASON_POLICY} + * <li>data disabled by carrier {@link #DATA_ENABLED_REASON_CARRIER} + * <li>data disabled by user {@link #DATA_ENABLED_REASON_USER} + * <li>data disabled due to thermal {@link #DATA_ENABLED_REASON_THERMAL} + * </ol> + * If any of the reason is off, then it will result in + * bypassing user preference and result in data to be turned off. + * + * <p>If this object has been created with {@link #createForSubscriptionId}, applies + * to the given subId. Otherwise, applies to + * {@link SubscriptionManager#getDefaultDataSubscriptionId()} + * + * + * @param reason the reason the data enable change is taking place + * @param enabled True if enabling the data, otherwise disabling. + * + * <p>Requires Permission: + * The calling app has carrier privileges (see {@link #hasCarrierPrivileges}) if the reason is + * {@link #DATA_ENABLED_REASON_USER} or {@link #DATA_ENABLED_REASON_CARRIER} or the call app + * has {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} irrespective of + * the reason. + * @throws IllegalStateException if the Telephony process is not currently available. + */ + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + public void setDataEnabledForReason(@DataEnabledReason int reason, boolean enabled) { + setDataEnabledForReason(getSubId(), reason, enabled); + } + + private void setDataEnabledForReason(int subId, @DataEnabledReason int reason, + boolean enabled) { + try { ITelephony service = getITelephony(); if (service != null) { - service.setPolicyDataEnabled(enabled, getSubId()); + service.setDataEnabledForReason(subId, reason, enabled); + } else { + throw new IllegalStateException("telephony service is null."); } - } catch (RemoteException e) { - Log.e(TAG, "Error calling ITelephony#setPolicyDataEnabled", e); + } catch (RemoteException ex) { + Log.e(TAG, "Telephony#setDataEnabledForReason RemoteException", ex); + ex.rethrowFromSystemServer(); + } + } + + /** + * Return whether data is enabled for certain reason . + * + * If {@link #isDataEnabledForReason} returns false, it means in data enablement for a + * specific reason is turned off. If any of the reason is off, then it will result in + * bypassing user preference and result in data to be turned off. Call + * {@link #isDataConnectionAllowed} in order to know whether + * data connection is allowed on the device. + * + * <p>If this object has been created with {@link #createForSubscriptionId}, applies + * to the given subId. Otherwise, applies to + * {@link SubscriptionManager#getDefaultDataSubscriptionId()} + * + * @param reason the reason the data enable change is taking place + * @return whether data is enabled for a reason. + * <p>Requires Permission: + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} or + * {@link android.Manifest.permission#ACCESS_NETWORK_STATE} + * @throws IllegalStateException if the Telephony process is not currently available. + */ + @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE, + android.Manifest.permission.READ_PHONE_STATE}) + public boolean isDataEnabledForReason(@DataEnabledReason int reason) { + return isDataEnabledForReason(getSubId(), reason); + } + + private boolean isDataEnabledForReason(int subId, @DataEnabledReason int reason) { + try { + ITelephony service = getITelephony(); + if (service != null) { + return service.isDataEnabledForReason(subId, reason); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + Log.e(TAG, "Telephony#isDataEnabledForReason RemoteException", ex); + ex.rethrowFromSystemServer(); } + return false; } /** @@ -11203,10 +11322,14 @@ public class TelephonyManager { * <LI>And possibly others.</LI> * </UL> * @return {@code true} if the overall data connection is allowed; {@code false} if not. - * @hide + * <p>Requires Permission: + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} or + * {@link android.Manifest.permission#ACCESS_NETWORK_STATE} or + * android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE */ - @SystemApi - @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE, + android.Manifest.permission.READ_PHONE_STATE, + android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE}) public boolean isDataConnectionAllowed() { boolean retVal = false; try { diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 61c22bb09753..79456360c377 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -975,13 +975,6 @@ interface ITelephony { boolean setPreferredNetworkType(int subId, int networkType); /** - * User enable/disable Mobile Data. - * - * @param enable true to turn on, else false - */ - void setUserDataEnabled(int subId, boolean enable); - - /** * Get the user enabled state of Mobile Data. * * TODO: remove and use isUserDataEnabled. @@ -1002,12 +995,29 @@ interface ITelephony { boolean isUserDataEnabled(int subId); /** - * Get the overall enabled state of Mobile Data. - * + * Check if data is enabled on the device. It can be disabled by + * user, carrier, policy or thermal. * @return true on enabled */ boolean isDataEnabled(int subId); + /** + * Control of data connection and provide the reason triggering the data connection control. + * + * @param subId user preferred subId. + * @param reason the reason the data enable change is taking place + * @param enable true to turn on, else false + */ + void setDataEnabledForReason(int subId, int reason, boolean enable); + + /** + * Return whether data is enabled for certain reason + * @param subId user preferred subId. . + * @param reason the reason the data enable change is taking place + * @return true on enabled + */ + boolean isDataEnabledForReason(int subId, int reason); + /** * Checks if manual network selection is allowed. * @@ -1605,15 +1615,6 @@ interface ITelephony { int getCarrierIdFromMccMnc(int slotIndex, String mccmnc, boolean isSubscriptionMccMnc); /** - * Action set from carrier signalling broadcast receivers to enable/disable metered apns - * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required - * @param subId the subscription ID that this action applies to. - * @param enabled control enable or disable metered apns. - * @hide - */ - void carrierActionSetMeteredApnsEnabled(int subId, boolean visible); - - /** * Action set from carrier signalling broadcast receivers to enable/disable radio * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required * @param subId the subscription ID that this action applies to. @@ -1651,14 +1652,6 @@ interface ITelephony { void setCallWaitingStatus(int subId, boolean enabled, IIntegerConsumer callback); /** - * Policy control of data connection. Usually used when data limit is passed. - * @param enabled True if enabling the data, otherwise disabling. - * @param subId Subscription index - * @hide - */ - void setPolicyDataEnabled(boolean enabled, int subId); - - /** * Get Client request stats which will contain statistical information * on each request made by client. * @param callingPackage package making the call. diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index d524299d7ede..ca7efcde4fef 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -494,6 +494,10 @@ public interface RILConstants { int RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS = 210; int RIL_REQUEST_GET_BARRING_INFO = 211; int RIL_REQUEST_ENTER_SIM_DEPERSONALIZATION = 212; + int RIL_REQUEST_ALLOCATE_PDU_SESSION_ID = 215; + int RIL_REQUEST_RELEASE_PDU_SESSION_ID = 216; + int RIL_REQUEST_BEGIN_HANDOVER = 217; + int RIL_REQUEST_CANCEL_HANDOVER = 218; /* Responses begin */ int RIL_RESPONSE_ACKNOWLEDGEMENT = 800; |