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
This commit is contained in:
tomhsu
2024-08-12 05:24:38 +00:00
committed by Tom Hsu
parent 0373a46e81
commit b213804b87

View File

@@ -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)