diff options
author | cretin45 <cretin45@gmail.com> | 2016-02-01 15:16:05 -0800 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2016-02-01 15:23:19 -0800 |
commit | 1b1b991da5dda15294e147cc6b48da8e44225f83 (patch) | |
tree | eb635cd030d6fc5e0df8b22a3060462f4419974c | |
parent | 5b276ea33563d474d8d530b1f9bd7111be872bac (diff) | |
download | packages_apps_SetupWizard-1b1b991da5dda15294e147cc6b48da8e44225f83.zip packages_apps_SetupWizard-1b1b991da5dda15294e147cc6b48da8e44225f83.tar.gz packages_apps_SetupWizard-1b1b991da5dda15294e147cc6b48da8e44225f83.tar.bz2 |
SetupWizard: Ensure UI doesn't show when user is guest
Issue-id: CYNGNOS-1736
Change-Id: Ibcd85ca3f90a6ab35a3ae6da622f59786ddcbcd3
-rw-r--r-- | src/com/cyanogenmod/setupwizard/SetupWizardApp.java | 22 | ||||
-rw-r--r-- | src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java | 19 |
2 files changed, 29 insertions, 12 deletions
diff --git a/src/com/cyanogenmod/setupwizard/SetupWizardApp.java b/src/com/cyanogenmod/setupwizard/SetupWizardApp.java index dabd4c7..cdcfcf8 100644 --- a/src/com/cyanogenmod/setupwizard/SetupWizardApp.java +++ b/src/com/cyanogenmod/setupwizard/SetupWizardApp.java @@ -99,14 +99,20 @@ public class SetupWizardApp extends Application { if (!isOwner || Settings.Secure.getInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE) == 1) { - Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); - Settings.Secure.putInt(getContentResolver(), - Settings.Secure.USER_SETUP_COMPLETE, 1); - SetupWizardUtils.disableGMSSetupWizard(this); - SetupWizardUtils.disableSetupWizard(this); - if (!isOwner) { - disableThemeComponentsForSecondaryUser(); - } + Thread t = new Thread(){ + @Override + public void run() { + Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); + Settings.Secure.putInt(getContentResolver(), + Settings.Secure.USER_SETUP_COMPLETE, 1); + SetupWizardUtils.disableGMSSetupWizard(SetupWizardApp.this); + SetupWizardUtils.disableSetupWizard(SetupWizardApp.this); + if (!isOwner) { + disableThemeComponentsForSecondaryUser(); + } + } + }; + t.run(); } else { disableCaptivePortalDetection(); } diff --git a/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java b/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java index 37eadbb..d8a5abb 100644 --- a/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java +++ b/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java @@ -84,6 +84,10 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks, public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + final boolean isOwner = SetupWizardUtils.isOwner(); + if (!isOwner) { + finish(); + } final View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(UI_FLAGS); decorView.setOnSystemUiVisibilityChangeListener( @@ -157,6 +161,9 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks, final View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(UI_FLAGS); super.onResume(); + if (isFinishing()) { + return; + } if (mSetupData.isFinished()) { mHandler.postDelayed(new Runnable() { @Override @@ -174,15 +181,19 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks, @Override protected void onPause() { super.onPause(); - mSetupData.onPause(); + if (mSetupData != null) { + mSetupData.onPause(); + } } @Override protected void onDestroy() { super.onDestroy(); - mSetupData.onDestroy(); - mSetupData.unregisterListener(this); - unregisterReceiver(mSetupData); + if (mSetupData != null) { + mSetupData.onDestroy(); + mSetupData.unregisterListener(this); + unregisterReceiver(mSetupData); + } } @Override |