Handle failing calls to TelephonyManager
If the phone process has died, Settings cannot make calls to TelephonyManager. Update the handling of this case to new best practices. Bug: b/394077023 Test: m & atest CellularSecurityPreferenceController Flag: EXEMPT bugfix Change-Id: I64ecb143d0830873b590ce4a397c398d8b41943f
This commit is contained in:
@@ -77,7 +77,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
|
||||||
@@ -186,7 +186,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()
|
||||||
|
|||||||
Reference in New Issue
Block a user