SetupWizard: add a CM-specific setup-complete settings key

Android uses Settings.Global.DEVICE_PROVISIONED and
Settings.Secure.USER_SETUP_COMPLETE and the system responds to those
database entries, such as allowing the keyguard to be visible, or maybe
pulling the statusbar down.

Since we still depend on some of Google's setup wizard, it also keys off
the same table rows and it may decide that the device is now provisioned
when we still haven't finished our own setup wizard, so let's add
another key that we have control over to show the real state of OUR
setup wizard.

Ticket: CYNGNOS-2431

Change-Id: Ic21689625f6d80e209161762ace741918b972aba
Signed-off-by: Roman Birg <roman@cyngn.com>
This commit is contained in:
Roman Birg 2016-04-15 13:09:25 -07:00
parent e5c2b92590
commit fccccda787
3 changed files with 13 additions and 0 deletions

View File

@ -26,6 +26,8 @@ import android.provider.Settings;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils; import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
import cyanogenmod.providers.CMSettings;
public class SetupWizardApp extends Application { public class SetupWizardApp extends Application {
public static final String TAG = SetupWizardApp.class.getSimpleName(); public static final String TAG = SetupWizardApp.class.getSimpleName();
@ -108,6 +110,8 @@ public class SetupWizardApp extends Application {
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
Settings.Secure.putInt(getContentResolver(), Settings.Secure.putInt(getContentResolver(),
Settings.Secure.USER_SETUP_COMPLETE, 1); Settings.Secure.USER_SETUP_COMPLETE, 1);
CMSettings.Secure.putInt(getContentResolver(),
CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED, 1);
SetupWizardUtils.disableGMSSetupWizard(SetupWizardApp.this); SetupWizardUtils.disableGMSSetupWizard(SetupWizardApp.this);
SetupWizardUtils.disableSetupWizard(SetupWizardApp.this); SetupWizardUtils.disableSetupWizard(SetupWizardApp.this);
if (!isOwner) { if (!isOwner) {

View File

@ -51,6 +51,7 @@ import com.cyanogenmod.setupwizard.setup.SetupDataCallbacks;
import com.cyanogenmod.setupwizard.util.EnableAccessibilityController; import com.cyanogenmod.setupwizard.util.EnableAccessibilityController;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils; import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
import cyanogenmod.providers.CMSettings;
import cyanogenmod.themes.ThemeManager; import cyanogenmod.themes.ThemeManager;
import java.util.ArrayList; import java.util.ArrayList;
@ -466,6 +467,8 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
Settings.Secure.putInt(getContentResolver(), Settings.Secure.putInt(getContentResolver(),
Settings.Secure.USER_SETUP_COMPLETE, 1); Settings.Secure.USER_SETUP_COMPLETE, 1);
CMSettings.Secure.putInt(getContentResolver(),
CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED, 1);
if (mEnableAccessibilityController != null) { if (mEnableAccessibilityController != null) {
mEnableAccessibilityController.onDestroy(); mEnableAccessibilityController.onDestroy();
} }

View File

@ -30,6 +30,8 @@ import android.provider.Settings;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import cyanogenmod.providers.CMSettings;
public class ManualTestActivity extends Activity { public class ManualTestActivity extends Activity {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -59,6 +61,8 @@ public class ManualTestActivity extends Activity {
private void enableSetup() { private void enableSetup() {
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0); Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0);
Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0); Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0);
CMSettings.Secure.putInt(getContentResolver(),
CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED, 0);
Intent intent = new Intent("android.intent.action.MAIN"); Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME"); intent.addCategory("android.intent.category.HOME");
final PackageManager pm = getPackageManager(); final PackageManager pm = getPackageManager();
@ -117,6 +121,8 @@ public class ManualTestActivity extends Activity {
private void setSetupComplete() { private void setSetupComplete() {
Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1); Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1);
CMSettings.Secure.putInt(getContentResolver(),
CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED, 1);
Intent intent = new Intent("android.intent.action.MAIN"); Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME"); intent.addCategory("android.intent.category.HOME");
final PackageManager pm = getPackageManager(); final PackageManager pm = getPackageManager();