SetupWizardTest: Add a test to mark as setup complete

Change-Id: I9d76e66dc68eb85094060548309e948bf91c4eeb
This commit is contained in:
cretin45 2015-01-26 16:25:28 -08:00
parent 202f9273e0
commit 8f363092bb
3 changed files with 27 additions and 0 deletions

View File

@ -31,5 +31,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:text="@string/enable_google_setup"/> android:text="@string/enable_google_setup"/>
<Button android:id="@+id/setup_complete_flag"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/user_setup_complete"/>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@ -18,4 +18,5 @@
<string name="app_test">SetupWizard Test</string> <string name="app_test">SetupWizard Test</string>
<string name="enable_setup">Enable Setup Wizard</string> <string name="enable_setup">Enable Setup Wizard</string>
<string name="enable_google_setup">Enable Google Setup Wizard</string> <string name="enable_google_setup">Enable Google Setup Wizard</string>
<string name="user_setup_complete">Set SetupWizard complete</string>
</resources> </resources>

View File

@ -43,6 +43,12 @@ public class ManualTestActivity extends Activity {
enableGoogleSetup(); enableGoogleSetup();
} }
}); });
findViewById(R.id.setup_complete_flag).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setSetupComplete();
}
});
} }
private void enableSetup() { private void enableSetup() {
@ -73,4 +79,19 @@ public class ManualTestActivity extends Activity {
finish(); finish();
} }
private void setSetupComplete() {
Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1);
Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0);
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME");
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);
componentName = new ComponentName("com.google.android.setupwizard", "com.google.android.setupwizard.SetupWizardActivity");
pm.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | intent.getFlags());
startActivity(intent);
finish();
}
} }