SetupWizard: Don't broadcast finished if guest user

Change-Id: Id30a52902444769ea48db4cbbd039d31d2abe5d6
This commit is contained in:
cretin45 2015-02-06 13:00:30 -08:00
parent c03556f5ae
commit b168a71af0

View File

@ -25,6 +25,7 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.view.MotionEvent;
@ -56,6 +57,8 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
private final Handler mHandler = new Handler();
private boolean mIsGuestUser = false;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.setup_main);
@ -110,7 +113,8 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
// Continue with setup
}
UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
if (userManager.isGuestUser()) {
mIsGuestUser = userManager.isGuestUser();
if (mIsGuestUser) {
finishSetup();
}
registerReceiver(mSetupData, mSetupData.getIntentFilter());
@ -272,7 +276,10 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
}
private void finishSetup() {
getApplication().sendBroadcast(new Intent(SetupWizardApp.ACTION_FINISHED));
if (!mIsGuestUser) {
getApplication().sendBroadcastAsUser(new Intent(SetupWizardApp.ACTION_FINISHED),
UserHandle.getCallingUserHandle());
}
mSetupData.finishPages();
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1);