diff options
-rw-r--r-- | tests/res/layout/cmaccount_test.xml | 5 | ||||
-rw-r--r-- | tests/res/values/strings.xml | 1 | ||||
-rw-r--r-- | tests/src/com/cyanogenmod/account/tests/ManualTestActivity.java | 21 |
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/res/layout/cmaccount_test.xml b/tests/res/layout/cmaccount_test.xml index 645b8bb..488f691 100644 --- a/tests/res/layout/cmaccount_test.xml +++ b/tests/res/layout/cmaccount_test.xml @@ -31,5 +31,10 @@ android:layout_width="match_parent" 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> </ScrollView> diff --git a/tests/res/values/strings.xml b/tests/res/values/strings.xml index b396dd8..0bba372 100644 --- a/tests/res/values/strings.xml +++ b/tests/res/values/strings.xml @@ -18,4 +18,5 @@ <string name="app_test">SetupWizard Test</string> <string name="enable_setup">Enable Setup Wizard</string> <string name="enable_google_setup">Enable Google Setup Wizard</string> + <string name="user_setup_complete">Set SetupWizard complete</string> </resources> 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 |