diff options
author | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-08-20 16:01:51 +0100 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2015-08-20 09:25:15 -0700 |
commit | 7e1a0aaffaabb4a0170f01a6fbd3abdf46abd210 (patch) | |
tree | 8802190dc131d7fcfb330877aee7490f834c0595 /src/com/cyanogenmod/setupwizard/setup | |
parent | 4ef509ac489465cb0a7a9679b39f2b029634a869 (diff) | |
download | packages_apps_SetupWizard-7e1a0aaffaabb4a0170f01a6fbd3abdf46abd210.zip packages_apps_SetupWizard-7e1a0aaffaabb4a0170f01a6fbd3abdf46abd210.tar.gz packages_apps_SetupWizard-7e1a0aaffaabb4a0170f01a6fbd3abdf46abd210.tar.bz2 |
SetupWizard: Don't wait for data connection to present the data toggle
We can proceed to the data enablement screen as soon as the device
confirms the requested slot is active. Waiting for an actual data
connection kinda breaks the point of that screen :)
Addresses CYNGNOS-660 and CRACKLING-503
Change-Id: I975508852b37c0e4b112612ac10aacb71ded97b3
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup')
-rw-r--r-- | src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java index 082913d..255cbad 100644 --- a/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java +++ b/src/com/cyanogenmod/setupwizard/setup/ChooseDataSimPage.java @@ -16,9 +16,13 @@ package com.cyanogenmod.setupwizard.setup; +import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; +import android.content.BroadcastReceiver; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.os.Bundle; import android.os.Handler; import android.telephony.PhoneStateListener; @@ -39,6 +43,8 @@ import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; +import com.android.internal.telephony.TelephonyIntents; + import com.cyanogenmod.setupwizard.R; import com.cyanogenmod.setupwizard.SetupWizardApp; import com.cyanogenmod.setupwizard.cmstats.SetupStats; @@ -207,6 +213,11 @@ public class ChooseDataSimPage extends SetupPage { if (mRadioReady) { checkSimChangingState(); } + // Register for DDS changes + IntentFilter filter = new IntentFilter(); + filter.addAction(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED); + getActivity().registerReceiver(mIntentReceiver, filter, null, null); + } @Override @@ -216,6 +227,15 @@ public class ChooseDataSimPage extends SetupPage { for (int i = 0; i < mPhoneStateListeners.size(); i++) { mPhone.listen(mPhoneStateListeners.valueAt(i), PhoneStateListener.LISTEN_NONE); } + getActivity().unregisterReceiver(mIntentReceiver); + } + + private void ddsHasChanged() { + mCurrentDataPhoneId = mSubscriptionManager.getDefaultDataPhoneId(); + if (mCurrentDataPhoneId == sChangingToDataPhoneId) { + hideProgress(); + enableViews(true); + } } private PhoneStateListener createPhoneStateListener(final SubscriptionInfo subInfoRecord) { @@ -458,6 +478,17 @@ public class ChooseDataSimPage extends SetupPage { } return retVal; } + + private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + final Activity activity = getActivity(); + if (activity != null) { + ddsHasChanged(); + } + } + }; + } } |