[Settings] Remove the intent receiver due to the register exception
Bug: 274899027 Test: atest SystemUIMicrobenchmark:android.platform.test.scenario.sysui.quicksettings Change-Id: Ia19b91cfd1073f22180cc9679025447b4d5fecd9
This commit is contained in:
@@ -36,11 +36,10 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.network.DefaultSubscriptionReceiver;
|
||||
import com.android.settings.network.MobileNetworkRepository;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.mobile.dataservice.MobileNetworkInfoEntity;
|
||||
import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity;
|
||||
import com.android.settingslib.mobile.dataservice.UiccInfoEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -52,7 +51,8 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class DefaultSubscriptionController extends TelephonyBasePreferenceController
|
||||
implements LifecycleObserver, Preference.OnPreferenceChangeListener,
|
||||
MobileNetworkRepository.MobileNetworkCallback {
|
||||
MobileNetworkRepository.MobileNetworkCallback,
|
||||
DefaultSubscriptionReceiver.DefaultSubscriptionListener {
|
||||
private static final String TAG = "DefaultSubController";
|
||||
|
||||
protected ListPreference mPreference;
|
||||
@@ -60,6 +60,7 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
protected TelecomManager mTelecomManager;
|
||||
protected MobileNetworkRepository mMobileNetworkRepository;
|
||||
protected LifecycleOwner mLifecycleOwner;
|
||||
private DefaultSubscriptionReceiver mDataSubscriptionChangedReceiver;
|
||||
|
||||
private static final String EMERGENCY_ACCOUNT_HANDLE_ID = "E";
|
||||
private static final ComponentName PSTN_CONNECTION_SERVICE_COMPONENT =
|
||||
@@ -76,6 +77,7 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
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);
|
||||
@@ -110,12 +112,13 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
// Can not get default subId from database until get the callback, add register by subId
|
||||
// later.
|
||||
mMobileNetworkRepository.addRegisterBySubId(getDefaultSubscriptionId());
|
||||
|
||||
mDataSubscriptionChangedReceiver.registerReceiver();
|
||||
}
|
||||
|
||||
@OnLifecycleEvent(ON_PAUSE)
|
||||
public void onPause() {
|
||||
mMobileNetworkRepository.removeRegister(this);
|
||||
mDataSubscriptionChangedReceiver.unRegisterReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -308,4 +311,16 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
updateEntries();
|
||||
refreshSummary(mPreference);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDefaultVoiceChanged(int defaultVoiceSubId) {
|
||||
updateEntries();
|
||||
refreshSummary(mPreference);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDefaultSmsChanged(int defaultSmsSubId) {
|
||||
updateEntries();
|
||||
refreshSummary(mPreference);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user