SetupWizard: Use the system property mobile data page visibility

Change-Id: I3a3301bcdbc2200ba62067188e59c886a0891788
This commit is contained in:
cretin45 2015-05-07 14:05:29 -07:00
parent b076a55991
commit 4d08b90df3

View File

@ -20,6 +20,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.os.SystemProperties;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
@ -34,6 +35,8 @@ public class CMSetupWizardData extends AbstractSetupData {
private boolean mTimeSet = false; private boolean mTimeSet = false;
private boolean mTimeZoneSet = false; private boolean mTimeZoneSet = false;
private boolean mMobileDataEnabled = SystemProperties
.getBoolean("ro.com.android.mobiledata", true);
public CMSetupWizardData(Context context) { public CMSetupWizardData(Context context) {
super(context); super(context);
@ -57,7 +60,7 @@ public class CMSetupWizardData extends AbstractSetupData {
} }
if (SetupWizardUtils.hasTelephony(mContext)) { if (SetupWizardUtils.hasTelephony(mContext)) {
pages.add(new MobileDataPage(mContext, this) pages.add(new MobileDataPage(mContext, this)
.setHidden(!isSimInserted() || SetupWizardUtils.isMobileDataEnabled(mContext))); .setHidden(!isSimInserted() || mMobileDataEnabled));
} }
if (SetupWizardUtils.hasGMS(mContext)) { if (SetupWizardUtils.hasGMS(mContext)) {
pages.add(new GmsAccountPage(mContext, this).setHidden(true)); pages.add(new GmsAccountPage(mContext, this).setHidden(true));
@ -83,6 +86,7 @@ public class CMSetupWizardData extends AbstractSetupData {
.equals(ConnectivityManager.CONNECTIVITY_ACTION) || .equals(ConnectivityManager.CONNECTIVITY_ACTION) ||
intent.getAction() intent.getAction()
.equals(ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE)) { .equals(ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE)) {
showHideMobileDataPage();
showHideAccountPages(); showHideAccountPages();
} else if (intent.getAction() } else if (intent.getAction()
.equals(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) { .equals(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) {
@ -136,7 +140,7 @@ public class CMSetupWizardData extends AbstractSetupData {
MobileDataPage mobileDataPage = MobileDataPage mobileDataPage =
(MobileDataPage) getPage(MobileDataPage.TAG); (MobileDataPage) getPage(MobileDataPage.TAG);
if (mobileDataPage != null) { if (mobileDataPage != null) {
mobileDataPage.setHidden(!isSimInserted()); mobileDataPage.setHidden(!isSimInserted() || mMobileDataEnabled);
} }
} }