CMSettings: add CM_SETUP_WIZARD_COMPLETED key
We need to store the state of _our_ setup wizard. To not break existing devices' provisioning, copy the current state of the global provisioned flag to the new key value. Ticket: CYNGNOS-2431 Change-Id: I3d88361edc126788f42b28efd11f3c7598117138 Signed-off-by: Roman Birg <roman@cyngn.com>
This commit is contained in:
parent
7a4fed9640
commit
bf5261c360
|
@ -46,7 +46,7 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
|
||||||
private static final boolean LOCAL_LOGV = false;
|
private static final boolean LOCAL_LOGV = false;
|
||||||
|
|
||||||
private static final String DATABASE_NAME = "cmsettings.db";
|
private static final String DATABASE_NAME = "cmsettings.db";
|
||||||
private static final int DATABASE_VERSION = 3;
|
private static final int DATABASE_VERSION = 4;
|
||||||
|
|
||||||
public static class CMTableNames {
|
public static class CMTableNames {
|
||||||
public static final String TABLE_SYSTEM = "system";
|
public static final String TABLE_SYSTEM = "system";
|
||||||
|
@ -184,6 +184,23 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
|
||||||
upgradeVersion = 3;
|
upgradeVersion = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (upgradeVersion < 4) {
|
||||||
|
db.beginTransaction();
|
||||||
|
SQLiteStatement stmt = null;
|
||||||
|
try {
|
||||||
|
stmt = db.compileStatement("INSERT INTO secure(name,value)"
|
||||||
|
+ " VALUES(?,?);");
|
||||||
|
loadSetting(stmt, CMSettings.Secure.CM_SETUP_WIZARD_COMPLETED,
|
||||||
|
Settings.Global.getString(mContext.getContentResolver(),
|
||||||
|
Settings.Global.DEVICE_PROVISIONED));
|
||||||
|
db.setTransactionSuccessful();
|
||||||
|
} finally {
|
||||||
|
if (stmt != null) stmt.close();
|
||||||
|
db.endTransaction();
|
||||||
|
}
|
||||||
|
upgradeVersion = 4;
|
||||||
|
}
|
||||||
|
|
||||||
// *** Remember to update DATABASE_VERSION above!
|
// *** Remember to update DATABASE_VERSION above!
|
||||||
|
|
||||||
if (upgradeVersion < newVersion) {
|
if (upgradeVersion < newVersion) {
|
||||||
|
|
|
@ -2729,6 +2729,14 @@ public final class CMSettings {
|
||||||
*/
|
*/
|
||||||
public static final String WEATHER_PROVIDER_SERVICE = "weather_provider_service";
|
public static final String WEATHER_PROVIDER_SERVICE = "weather_provider_service";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to 0 when we enter the CM Setup Wizard.
|
||||||
|
* Set to 1 when we exit the CM Setup Wizard.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String CM_SETUP_WIZARD_COMPLETED = "cm_setup_wizard_completed";
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue