diff options
author | Weijie Wang <weijiew@codeaurora.org> | 2021-06-03 09:51:44 +0800 |
---|---|---|
committer | Weijie Wang <weijiew@codeaurora.org> | 2021-06-03 02:56:13 +0000 |
commit | 735f66a2fe70d900d6d69d2b679ba3463105970c (patch) | |
tree | b9425e891eb452905352004f26e3ee0c7b44a032 /packages/SystemUI/src/com/android/keyguard/EmergencyButtonController.java | |
parent | 13735ba8b44835958d7f7ed847d9762beced523d (diff) |
SystemUI: Handle telephony exception during bootup
TelephonyManager.requestCellInfoUpdate will throw an exception
while telephony service not available, which will cause SystemUI
to fail to launch, so catch the exception to avoid the failing.
Change-Id: I138605730db2685697d216d793aeaa41a0dd8aa2
CRs-Fixed: 2956670
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/EmergencyButtonController.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/EmergencyButtonController.java | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/EmergencyButtonController.java b/packages/SystemUI/src/com/android/keyguard/EmergencyButtonController.java index dda5d4b13370..920cf003a893 100644 --- a/packages/SystemUI/src/com/android/keyguard/EmergencyButtonController.java +++ b/packages/SystemUI/src/com/android/keyguard/EmergencyButtonController.java @@ -173,22 +173,26 @@ public class EmergencyButtonController extends ViewController<EmergencyButton> { private void requestCellInfoUpdate(){ TelephonyManager tmWithoutSim = mTelephonyManager .createForSubscriptionId(SubscriptionManager.INVALID_SUBSCRIPTION_ID); - tmWithoutSim.requestCellInfoUpdate(getContext().getMainExecutor(), - new TelephonyManager.CellInfoCallback() { - @Override - public void onCellInfo(List<CellInfo> cellInfo) { - if (KeyguardConstants.DEBUG_SIM_STATES) { - Log.d(LOG_TAG, "requestCellInfoUpdate.onCellInfo cellInfoList.size=" - + (cellInfo == null ? 0 : cellInfo.size())); + try { + tmWithoutSim.requestCellInfoUpdate(getContext().getMainExecutor(), + new TelephonyManager.CellInfoCallback() { + @Override + public void onCellInfo(List<CellInfo> cellInfo) { + if (KeyguardConstants.DEBUG_SIM_STATES) { + Log.d(LOG_TAG, "requestCellInfoUpdate.onCellInfo cellInfoList.size=" + + (cellInfo == null ? 0 : cellInfo.size())); + } + if (cellInfo == null || cellInfo.isEmpty()) { + mIsCellAvailable = false; + } else { + mIsCellAvailable = true; + } + updateEmergencyCallButton(); } - if ( cellInfo == null || cellInfo.isEmpty()) { - mIsCellAvailable = false; - }else{ - mIsCellAvailable = true; - } - updateEmergencyCallButton(); - } - }); + }); + } catch (IllegalStateException exception) { + Log.e(LOG_TAG, "Fail to call TelephonyManager.requestCellInfoUpdate ", exception); + } } private boolean isEmergencyCapable() { |