Add Checks For Modem Support of Null Ciphers to Telephony Service
When isNullCipherAndIntegrityPreferenceEnabled or
setNullCipherAndIntegrityEnabled are called, a check is added for
modem support of the feature. When the check fails, an
UnsupportedOperationException is thrown.
Bug: 264574296
Test: atest PhoneInterfaceManagerTest
Change-Id: I5a2e441c65873d4dc16675be864477d13c83508d
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index c4449d8..7bc5632 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -2429,7 +2429,11 @@
return mTelephonySharedPreferences;
}
- private Phone getDefaultPhone() {
+ /**
+ * Get the default phone for this device.
+ */
+ @VisibleForTesting
+ public Phone getDefaultPhone() {
Phone thePhone = getPhone(getDefaultSubscription());
return (thePhone != null) ? thePhone : PhoneFactory.getDefaultPhone();
}
@@ -11743,6 +11747,10 @@
throw new UnsupportedOperationException(
"Null cipher and integrity operations require HAL 2.1 or above");
}
+ if (!getDefaultPhone().isNullCipherAndIntegritySupported()) {
+ throw new UnsupportedOperationException(
+ "Null cipher and integrity operations unsupported by modem");
+ }
}
/**