From 8f363092bbcecf34c3751e7b76ac92d387aee80e Mon Sep 17 00:00:00 2001 From: cretin45 Date: Mon, 26 Jan 2015 16:25:28 -0800 Subject: SetupWizardTest: Add a test to mark as setup complete Change-Id: I9d76e66dc68eb85094060548309e948bf91c4eeb --- .../account/tests/ManualTestActivity.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/src') diff --git a/tests/src/com/cyanogenmod/account/tests/ManualTestActivity.java b/tests/src/com/cyanogenmod/account/tests/ManualTestActivity.java index 9caf5a1..d7fa3ed 100644 --- a/tests/src/com/cyanogenmod/account/tests/ManualTestActivity.java +++ b/tests/src/com/cyanogenmod/account/tests/ManualTestActivity.java @@ -43,6 +43,12 @@ public class ManualTestActivity extends Activity { enableGoogleSetup(); } }); + findViewById(R.id.setup_complete_flag).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + setSetupComplete(); + } + }); } private void enableSetup() { @@ -73,4 +79,19 @@ public class ManualTestActivity extends Activity { 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(); + } + } \ No newline at end of file -- cgit v1.1