SetupWizard. Don't show account pages if no connectivity
Change-Id: I36e181f67e9fc0efef39cc58f7dc80bbbfd5b49d
This commit is contained in:
parent
97fdf91ee8
commit
16486aead0
|
@ -19,6 +19,8 @@ package com.cyanogenmod.setupwizard.setup;
|
||||||
import android.content.Context;
|
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.NetworkInfo;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
|
||||||
import com.android.internal.telephony.TelephonyIntents;
|
import com.android.internal.telephony.TelephonyIntents;
|
||||||
|
@ -53,10 +55,10 @@ public class CMSetupWizardData extends AbstractSetupData {
|
||||||
.setHidden(!isSimInserted() || SetupWizardUtils.isMobileDataEnabled(mContext)));
|
.setHidden(!isSimInserted() || SetupWizardUtils.isMobileDataEnabled(mContext)));
|
||||||
}
|
}
|
||||||
if (SetupWizardUtils.hasGMS(mContext)) {
|
if (SetupWizardUtils.hasGMS(mContext)) {
|
||||||
pages.add(new GmsAccountPage(mContext, this));
|
pages.add(new GmsAccountPage(mContext, this).setHidden(true));
|
||||||
}
|
}
|
||||||
if (SetupWizardUtils.isOwner()) {
|
if (SetupWizardUtils.isOwner()) {
|
||||||
pages.add(new CyanogenServicesPage(mContext, this));
|
pages.add(new CyanogenServicesPage(mContext, this).setHidden(true));
|
||||||
pages.add(new CyanogenSettingsPage(mContext, this));
|
pages.add(new CyanogenSettingsPage(mContext, this));
|
||||||
pages.add(new OtherSettingsPage(mContext, this));
|
pages.add(new OtherSettingsPage(mContext, this));
|
||||||
pages.add(new DateTimePage(mContext, this));
|
pages.add(new DateTimePage(mContext, this));
|
||||||
|
@ -80,9 +82,13 @@ public class CMSetupWizardData extends AbstractSetupData {
|
||||||
simCardMissingPage.setHidden(isSimInserted());
|
simCardMissingPage.setHidden(isSimInserted());
|
||||||
}
|
}
|
||||||
showHideMobileDataPage();
|
showHideMobileDataPage();
|
||||||
|
} else if (intent.getAction()
|
||||||
|
.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
|
||||||
|
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)) {
|
||||||
showHideMobileDataPage();
|
showHideMobileDataPage();
|
||||||
|
showHideAccountPages();
|
||||||
} else if (intent.getAction().equals(Intent.ACTION_TIMEZONE_CHANGED) ||
|
} else if (intent.getAction().equals(Intent.ACTION_TIMEZONE_CHANGED) ||
|
||||||
intent.getAction().equals(TelephonyIntents.ACTION_NETWORK_SET_TIMEZONE)) {
|
intent.getAction().equals(TelephonyIntents.ACTION_NETWORK_SET_TIMEZONE)) {
|
||||||
mTimeZoneSet = true;
|
mTimeZoneSet = true;
|
||||||
|
@ -94,6 +100,20 @@ public class CMSetupWizardData extends AbstractSetupData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showHideAccountPages() {
|
||||||
|
boolean isConnected = SetupWizardUtils.isNetworkConnected(mContext);
|
||||||
|
GmsAccountPage gmsAccountPage =
|
||||||
|
(GmsAccountPage) getPage(GmsAccountPage.TAG);
|
||||||
|
if (gmsAccountPage != null) {
|
||||||
|
gmsAccountPage.setHidden(!isConnected);
|
||||||
|
}
|
||||||
|
CyanogenServicesPage cyanogenServicesPage =
|
||||||
|
(CyanogenServicesPage) getPage(CyanogenServicesPage.TAG);
|
||||||
|
if (cyanogenServicesPage != null) {
|
||||||
|
cyanogenServicesPage.setHidden(!isConnected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void showHideMobileDataPage() {
|
private void showHideMobileDataPage() {
|
||||||
MobileDataPage mobileDataPage =
|
MobileDataPage mobileDataPage =
|
||||||
(MobileDataPage) getPage(MobileDataPage.TAG);
|
(MobileDataPage) getPage(MobileDataPage.TAG);
|
||||||
|
@ -116,6 +136,7 @@ public class CMSetupWizardData extends AbstractSetupData {
|
||||||
filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
|
filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
|
||||||
filter.addAction(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
|
filter.addAction(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
|
||||||
}
|
}
|
||||||
|
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||||
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
|
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
|
||||||
filter.addAction(Intent.ACTION_TIME_CHANGED);
|
filter.addAction(Intent.ACTION_TIME_CHANGED);
|
||||||
filter.addAction(TelephonyIntents.ACTION_NETWORK_SET_TIME);
|
filter.addAction(TelephonyIntents.ACTION_NETWORK_SET_TIME);
|
||||||
|
|
Loading…
Reference in New Issue