SetupWizard: Ensure UI doesn't show when user is guest

Issue-id: CYNGNOS-1736

Change-Id: Ibcd85ca3f90a6ab35a3ae6da622f59786ddcbcd3
This commit is contained in:
cretin45 2016-02-01 15:16:05 -08:00
parent 5b276ea335
commit 1b1b991da5
2 changed files with 29 additions and 12 deletions

View File

@ -99,14 +99,20 @@ public class SetupWizardApp extends Application {
if (!isOwner
|| Settings.Secure.getInt(getContentResolver(),
Settings.Secure.USER_SETUP_COMPLETE) == 1) {
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(this);
SetupWizardUtils.disableSetupWizard(this);
SetupWizardUtils.disableGMSSetupWizard(SetupWizardApp.this);
SetupWizardUtils.disableSetupWizard(SetupWizardApp.this);
if (!isOwner) {
disableThemeComponentsForSecondaryUser();
}
}
};
t.run();
} else {
disableCaptivePortalDetection();
}

View File

@ -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,16 +181,20 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
@Override
protected void onPause() {
super.onPause();
if (mSetupData != null) {
mSetupData.onPause();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mSetupData != null) {
mSetupData.onDestroy();
mSetupData.unregisterListener(this);
unregisterReceiver(mSetupData);
}
}
@Override
public Object onRetainNonConfigurationInstance() {