SetupWizard: Don't show wifi setup on wifi-less devices

Altough uncommon, development boards and emulators don't have a wireless
interface. In those cases, don't show the wireless setup page.

Change-Id: I0017b2277defdccf7f0bd61cb9606254509f78cc
This commit is contained in:
Diogo Ferreira 2016-09-07 17:44:31 +01:00 committed by Abhisek Devkota
parent 35b91edd9a
commit 65d6ac1299
2 changed files with 8 additions and 1 deletions

View File

@ -51,7 +51,9 @@ public class CMSetupWizardData extends AbstractSetupData {
pages.add(new BluetoothSetupPage(mContext, this)); pages.add(new BluetoothSetupPage(mContext, this));
} }
pages.add(new WelcomePage(mContext, this)); pages.add(new WelcomePage(mContext, this));
pages.add(new WifiSetupPage(mContext, this)); if (SetupWizardUtils.hasWifi(mContext)) {
pages.add(new WifiSetupPage(mContext, this));
}
if (SetupWizardUtils.hasTelephony(mContext)) { if (SetupWizardUtils.hasTelephony(mContext)) {
pages.add(new SimCardMissingPage(mContext, this) pages.add(new SimCardMissingPage(mContext, this)
.setHidden(isSimInserted())); .setHidden(isSimInserted()));

View File

@ -101,6 +101,11 @@ public class SetupWizardUtils {
} }
} }
public static boolean hasWifi(Context context) {
PackageManager packageManager = context.getPackageManager();
return packageManager.hasSystemFeature(PackageManager.FEATURE_WIFI);
}
public static boolean hasTelephony(Context context) { public static boolean hasTelephony(Context context) {
PackageManager packageManager = context.getPackageManager(); PackageManager packageManager = context.getPackageManager();
return packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); return packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);