diff options
| author | 2022-12-06 22:26:48 +0000 | |
|---|---|---|
| committer | 2022-12-12 19:57:02 +0000 | |
| commit | caf1f3d8b47f50bf55f7c0b20014b587e2a0bac0 (patch) | |
| tree | bfbe1a10bcc96840863901e76102acef12fc7bd0 | |
| parent | 4190b8577be58aeeabcbc793ccb39733d633f0cc (diff) | |
Add Null Cipher Getter/Setter Telephony API
Bug: 260844152
Test: atest PhoneInterfaceManagerTest
Change-Id: I61ce88b41a11ea63c6d96bd9c05e7f52f3184d4a
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 54 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 22 |
2 files changed, 76 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 851697a0f25d..09daa2d25168 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -17767,4 +17767,58 @@ public class TelephonyManager { } return TelephonyManager.SIM_STATE_UNKNOWN; } + + /** + * Set the UE's ability to accept/reject null ciphered and null integrity-protected connections. + * + * The modem is required to ignore this in case of an emergency call. + * + * <p>Requires permission: android.Manifest.MODIFY_PHONE_STATE</p> + * + * @param enabled if null ciphered and null integrity protected connections are permitted + * @throws IllegalStateException if the Telephony process is not currently available + * @throws SecurityException if the caller does not have the required privileges + * @throws UnsupportedOperationException if the modem does not support disabling null ciphers. + * @hide + */ + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public void setNullCipherAndIntegrityEnabled(boolean enabled) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.setNullCipherAndIntegrityEnabled(enabled); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + Rlog.e(TAG, "setNullCipherAndIntegrityEnabled RemoteException", ex); + ex.rethrowFromSystemServer(); + } + } + + /** + * Get the value of the global preference for null cipher and integriy enablement. + * Note: This does not return the state of the modem, only the persisted global preference. + * + * <p>Requires permission: android.Manifest.READ_PHONE_STATE</p> + * + * @throws IllegalStateException if the Telephony process is not currently available + * @throws SecurityException if the caller does not have the required privileges + * @throws UnsupportedOperationException if the modem does not support disabling null ciphers. + * @hide + */ + @RequiresPermission(Manifest.permission.READ_PHONE_STATE) + public void isNullCipherAndIntegrityPreferenceEnabled() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.isNullCipherAndIntegrityPreferenceEnabled(); + } else { + throw new IllegalStateException("telephony service is null."); + } + } catch (RemoteException ex) { + Rlog.e(TAG, "isNullCipherAndIntegrityPreferenceEnabled RemoteException", ex); + ex.rethrowFromSystemServer(); + } + } } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 7ede4abd1dc2..9445d0763c98 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -2636,4 +2636,26 @@ interface ITelephony { * @param slotIndex Logical SIM slot index. */ int getSimStateForSlotIndex(int slotIndex); + + /** + * Set whether the radio is able to connect with null ciphering or integrity + * algorithms. This is a global setting and will apply to all active subscriptions + * and all new subscriptions after this. + * + * <p>Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * + * @param enabled when true, null cipher and integrity algorithms are allowed. + * @hide + */ + void setNullCipherAndIntegrityEnabled(boolean enabled); + + /** + * Get whether the radio is able to connect with null ciphering or integrity + * algorithms. Note that this retrieves the phone-global preference and not + * the state of the radio. + * + * @hide + */ + boolean isNullCipherAndIntegrityPreferenceEnabled(); } |