public static final String DATABASE_DOWNGRADE_REASON = "database_downgrade_reason";
/**
+ * The build id of when the settings database was first created (or re-created due it
+ * being missing).
+ *
+ * Type: string
+ *
+ * @hide
+ */
+ public static final String DATABASE_CREATION_BUILDID = "database_creation_buildid";
+
+ /**
* Flag to toggle journal mode WAL on or off for the contacts database. WAL is enabled by
* default. Set to 0 to disable.
*
Settings.Global.CONTACTS_DATABASE_WAL_ENABLED,
Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE,
Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI,
+ Settings.Global.DATABASE_CREATION_BUILDID,
Settings.Global.DATABASE_DOWNGRADE_REASON,
Settings.Global.DATA_ROAMING,
Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS,
private final BackupManager mBackupManager;
+ private String mSettingsCreationBuildId;
+
public SettingsRegistry() {
mHandler = new MyHandler(getContext().getMainLooper());
mGenerationRegistry = new GenerationRegistry(mLock);
return;
}
+ mSettingsCreationBuildId = Build.ID;
+
final long identity = Binder.clearCallingIdentity();
try {
List<UserInfo> users = mUserManager.getUsers(true);
ensureSettingsStateLocked(globalKey);
SettingsState globalSettings = mSettingsStates.get(globalKey);
migrateLegacySettingsLocked(globalSettings, database, TABLE_GLOBAL);
+ // If this was just created
+ if (mSettingsCreationBuildId != null) {
+ globalSettings.insertSettingLocked(Settings.Global.DATABASE_CREATION_BUILDID,
+ mSettingsCreationBuildId, null, true,
+ SettingsState.SYSTEM_PACKAGE_NAME);
+ }
globalSettings.persistSyncLocked();
}