LineageSettingsProvider: Cleanup after LINEAGE_SETUP_WIZARD_COMPLETED deprecation

Change-Id: I997759d1f79fae514566e6474ea7802c2c7d1f53
This commit is contained in:
Sam Mortimer
2018-08-14 19:33:50 -07:00
committed by Daniel Hillenbrand
parent c5e6a03d01
commit cd0ec5ba84
2 changed files with 17 additions and 40 deletions

View File

@@ -232,21 +232,9 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
}
if (upgradeVersion < 4) {
if (mUserHandle == UserHandle.USER_OWNER) {
db.beginTransaction();
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("INSERT INTO secure(name,value)"
+ " VALUES(?,?);");
final String provisionedFlag = Settings.Global.getString(
mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED);
loadSetting(stmt, LineageSettings.Secure.LINEAGE_SETUP_WIZARD_COMPLETED, provisionedFlag);
db.setTransactionSuccessful();
} finally {
if (stmt != null) stmt.close();
db.endTransaction();
}
}
/* Was set LineageSettings.Secure.LINEAGE_SETUP_WIZARD_COMPLETE
* but this is no longer used
*/
upgradeVersion = 4;
}
@@ -339,6 +327,7 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
if (upgradeVersion < 10) {
if (mUserHandle == UserHandle.USER_OWNER) {
// Update STATUS_BAR_CLOCK
db.beginTransaction();
SQLiteStatement stmt = null;
try {
@@ -359,6 +348,19 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
if (stmt != null) stmt.close();
db.endTransaction();
}
// Remove LINEAGE_SETUP_WIZARD_COMPLETED
db.beginTransaction();
stmt = null;
try {
stmt = db.compileStatement("DELETE FROM secure WHERE name=?");
stmt.bindString(1, LineageSettings.Secure.LINEAGE_SETUP_WIZARD_COMPLETED);
stmt.execute();
db.setTransactionSuccessful();
} finally {
if (stmt != null) stmt.close();
db.endTransaction();
}
}
upgradeVersion = 10;
}

View File

@@ -119,31 +119,6 @@ import java.util.Map;
assertEquals(lineageProviderValue, settingsProviderValue);
}
/**
* The new {@link LineageSettings.Secure#LINEAGE_SETUP_WIZARD_COMPLETED} lineage specific provisioned flag
* should be equal to the old {@link Settings.Global#DEVICE_PROVISIONED} flag on boot, or on
* upgrade. These flags will almost always be equal, except during the provisioning process,
* they may change at slightly different times.
*
* Test whether the setting was properly set and is not null.
*
* @deprecated Replaced by {@link Settings.Global#DEVICE_PROVISIONED}
* or {@link Settings.Secure#USER_SETUP_COMPLETE}
*/
@Deprecated
@SmallTest
public void testLineageProvisionedFlagFallbackSet() {
final String newLineageFlag = LineageSettings.Secure.getStringForUser(
getContext().getContentResolver(), LineageSettings.Secure.LINEAGE_SETUP_WIZARD_COMPLETED,
UserHandle.USER_OWNER);
assertNotNull(newLineageFlag);
final String previousFlag = Settings.Global.getStringForUser(
getContext().getContentResolver(), Settings.Global.DEVICE_PROVISIONED,
UserHandle.USER_OWNER);
assertEquals(previousFlag, newLineageFlag);
}
private void testMigrateSettingsForUser(int userId) {
// Setup values in Settings
/*final String expectedPullDownValue = "testQuickPullDownValue";