SetupWizardTests: Don't crash when there is no GMS
Change-Id: I0bc86384c172c0abb7960f140b9155e75264957c
This commit is contained in:
parent
fa88fbad19
commit
7e9af47d04
@ -59,14 +59,19 @@ public class ManualTestActivity extends Activity {
|
||||
final PackageManager pm = getPackageManager();
|
||||
ComponentName componentName = new ComponentName("com.cyanogenmod.setupwizard", "com.cyanogenmod.setupwizard.ui.SetupWizardActivity");
|
||||
pm.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
try {
|
||||
componentName = new ComponentName("com.google.android.setupwizard", "com.google.android.setupwizard.SetupWizardActivity");
|
||||
pm.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | intent.getFlags());
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void enableGoogleSetup() {
|
||||
try {
|
||||
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0);
|
||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0);
|
||||
Intent intent = new Intent("android.intent.action.MAIN");
|
||||
@ -77,6 +82,9 @@ public class ManualTestActivity extends Activity {
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | intent.getFlags());
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void setSetupComplete() {
|
||||
@ -87,8 +95,12 @@ public class ManualTestActivity extends Activity {
|
||||
final PackageManager pm = getPackageManager();
|
||||
ComponentName componentName = new ComponentName("com.cyanogenmod.setupwizard", "com.cyanogenmod.setupwizard.ui.SetupWizardActivity");
|
||||
pm.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
try {
|
||||
componentName = new ComponentName("com.google.android.setupwizard", "com.google.android.setupwizard.SetupWizardActivity");
|
||||
pm.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | intent.getFlags());
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
Loading…
Reference in New Issue
Block a user