Fix the BasePreferenceController.createInstance's IllegalStateException am: 7489c93347

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/27358857

Change-Id: I7fe4219091a7428f42e4b33d0ccc4445b66569f3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
songferngwang
2024-05-15 12:39:26 +00:00
committed by Automerger Merge Worker
6 changed files with 38 additions and 12 deletions

View File

@@ -64,16 +64,20 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
public DefaultSubscriptionController(Context context, String preferenceKey, Lifecycle lifecycle,
LifecycleOwner lifecycleOwner) {
this(context, preferenceKey);
mLifecycleOwner = lifecycleOwner;
if (lifecycle != null) {
lifecycle.addObserver(this);
}
}
public DefaultSubscriptionController(Context context, String preferenceKey) {
super(context, preferenceKey);
mManager = context.getSystemService(SubscriptionManager.class);
mIsRtlMode = context.getResources().getConfiguration().getLayoutDirection()
== View.LAYOUT_DIRECTION_RTL;
mMobileNetworkRepository = MobileNetworkRepository.getInstance(context);
mDataSubscriptionChangedReceiver = new DefaultSubscriptionReceiver(context, this);
mLifecycleOwner = lifecycleOwner;
if (lifecycle != null) {
lifecycle.addObserver(this);
}
}
/** @return the id of the default subscription for the service, or