Merge "Handle failing calls to TelephonyManager" into main

This commit is contained in:
Yomna N
2025-03-03 14:35:40 -08:00
committed by Android (Google) Code Review

View File

@@ -75,7 +75,7 @@ public class CellularSecurityPreferenceController extends BasePreferenceControll
} }
if (mTelephonyManager == null) { if (mTelephonyManager == null) {
Log.w(LOG_TAG, "Telephony manager not yet initialized"); Log.w(LOG_TAG, "Telephony manager not yet initialized");
mTelephonyManager = mContext.getSystemService(TelephonyManager.class); return CONDITIONALLY_UNAVAILABLE;
} }
// Check there are valid SIM cards which can be displayed to the user, otherwise this // Check there are valid SIM cards which can be displayed to the user, otherwise this
@@ -184,7 +184,7 @@ public class CellularSecurityPreferenceController extends BasePreferenceControll
protected boolean areNotificationsEnabled() { protected boolean areNotificationsEnabled() {
if (mTelephonyManager == null) { if (mTelephonyManager == null) {
Log.w(LOG_TAG, "Telephony manager not yet initialized"); Log.w(LOG_TAG, "Telephony manager not yet initialized");
mTelephonyManager = mContext.getSystemService(TelephonyManager.class); return false;
} }
return mTelephonyManager.isNullCipherNotificationsEnabled() return mTelephonyManager.isNullCipherNotificationsEnabled()