SetupWizard: Turn off signal strength listener prior to detach

Change-Id: I4c4b4a3e82067704b6895b9d46997d6e72b38786
This commit is contained in:
cretin45 2015-01-27 14:41:35 -08:00
parent d28a24dfa2
commit 3ce798f2ba
2 changed files with 6 additions and 2 deletions

View File

@ -150,10 +150,10 @@ public class ChooseDataSimPage extends SetupPage {
@Override
public void onDetach() {
super.onDetach();
for (int i = 0; i < mPhoneStateListeners.size(); i++) {
mPhone.listen(mPhoneStateListeners.get(i), PhoneStateListener.LISTEN_NONE);
}
super.onDetach();
}
private PhoneStateListener createPhoneStateListener(final SubInfoRecord subInfoRecord) {

View File

@ -83,12 +83,14 @@ public class MobileDataPage extends SetupPage {
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
if (isDetached()) return;
mSignalStrength = signalStrength;
updateSignalStrength();
}
@Override
public void onServiceStateChanged(ServiceState state) {
if (isDetached()) return;
mServiceState = state;
updateSignalStrength();
}
@ -138,11 +140,12 @@ public class MobileDataPage extends SetupPage {
@Override
public void onDetach() {
super.onDetach();
mPhone.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
super.onDetach();
}
private void updateCarrierText() {
if (isDetached()) return;
String name = mPhone.getNetworkOperatorName(SubscriptionManager.getDefaultDataSubId());
if (TextUtils.isEmpty(name)) {
if (mServiceState != null && mServiceState.isEmergencyOnly()) {
@ -155,6 +158,7 @@ public class MobileDataPage extends SetupPage {
}
private void updateSignalStrength() {
if (isDetached()) return;
if (!hasService()) {
mSignalView.setImageResource(R.drawable.ic_signal_no_signal);
} else {