From b213804b87c49e467fa8d67f72a4782f503ef345 Mon Sep 17 00:00:00 2001 From: tomhsu Date: Mon, 12 Aug 2024 05:24:38 +0000 Subject: [PATCH] Fix crash due to UserManager is null. - Instance of UserManager get from onCraete, so we can not use this onAttach. Flag: EXEMPT bug fix Fix: 289232540 Test: Manual test Change-Id: Ieb62d8289db0dbcd5a16280aa66f3b3de8936e26 --- .../network/telephony/MobileNetworkSettings.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/com/android/settings/network/telephony/MobileNetworkSettings.java b/src/com/android/settings/network/telephony/MobileNetworkSettings.java index acf674f3f7c..a5cdb954664 100644 --- a/src/com/android/settings/network/telephony/MobileNetworkSettings.java +++ b/src/com/android/settings/network/telephony/MobileNetworkSettings.java @@ -202,12 +202,6 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme @Override public void onAttach(Context context) { super.onAttach(context); - if (isUiRestricted()) { - Log.d(LOG_TAG, "Mobile network page is disallowed."); - finish(); - return; - } - if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) { Log.d(LOG_TAG, "Invalid subId, get the default subscription to show."); SubscriptionInfo info = SubscriptionUtil.getSubscriptionOrDefault(context, mSubId); @@ -346,6 +340,11 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme setTelephonyAvailabilityStatus(getPreferenceControllersAsList()); super.onCreate(icicle); + if (isUiRestricted()) { + Log.d(LOG_TAG, "Mobile network page is disallowed."); + finish(); + return; + } final Context context = getContext(); mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE); mTelephonyManager = context.getSystemService(TelephonyManager.class)