Migrate side FPS settings

* Really shouldn't have touched an existing migration before
* Anywho, let's change it back to what it was but make it compile
* Then, let's migrate that old setting to the new AOSP setting,
  but flip it since it works differently.

Change-Id: I342d8c78aa8faeda5dcaafe9199deb51c570efd0
This commit is contained in:
Chirayu Desai
2023-06-27 21:14:36 +05:30
committed by Michael Bestas
parent c407667d38
commit 173b6d8693
3 changed files with 31 additions and 4 deletions

View File

@@ -288,6 +288,12 @@
(needed for some older vendor fingerprint HAL implementations) -->
<bool name="config_fingerprintPostResetRunnableForAllClients">false</bool>
<!-- Should we listen for fingerprints when the screen is off? Devices
with a rear-mounted sensor want this, but certain devices have
the sensor embedded in the power key and listening all the time
causes a poor experience. -->
<bool name="config_fingerprintWakeAndUnlock">true</bool>
<!-- The list of components which should be automatically disabled for a specific device.
Note: this MUST not be used to randomly disable components, ask for approval first! -->
<string-array name="config_deviceDisabledComponents" translatable="false" />

View File

@@ -173,6 +173,12 @@
(needed for some older vendor fingerprint HAL implementations) -->
<java-symbol type="bool" name="config_fingerprintPostResetRunnableForAllClients" />
<!-- Should we listen for fingerprints when the screen is off? Devices
with a rear-mounted sensor want this, but certain devices have
the sensor embedded in the power key and listening all the time
causes a poor experience. -->
<java-symbol type="bool" name="config_fingerprintWakeAndUnlock" />
<!-- Package Manager -->
<java-symbol type="array" name="config_deviceDisabledComponents" />
<java-symbol type="array" name="config_globallyDisabledComponents" />

View File

@@ -60,7 +60,7 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
private static final boolean LOCAL_LOGV = false;
private static final String DATABASE_NAME = "lineagesettings.db";
private static final int DATABASE_VERSION = 18;
private static final int DATABASE_VERSION = 19;
private static final String DATABASE_NAME_OLD = "cmsettings.db";
@@ -447,18 +447,33 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
}
} catch (SQLiteDoneException ex) {
// LineageSettings.System.FINGERPRINT_WAKE_UNLOCK was not set,
// default to config_performantAuthDefault value
// set default value based on config_fingerprintWakeAndUnlock
oldSetting = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_performantAuthDefault) ? 1 : 0;
org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock)
? 0 : 1;
} finally {
if (stmt != null) stmt.close();
db.endTransaction();
}
// Previously Settings.Secure.SFPS_REQUIRE_SCREEN_ON_TO_AUTH_ENABLED
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.SFPS_PERFORMANT_AUTH_ENABLED,
"sfps_require_screen_on_to_auth_enabled",
oldSetting);
upgradeVersion = 18;
}
if (upgradeVersion < 19) {
// Set default value based on config_fingerprintWakeAndUnlock
boolean fingerprintWakeAndUnlock = mContext.getResources().getBoolean(
org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock);
// Previously Settings.Secure.SFPS_REQUIRE_SCREEN_ON_TO_AUTH_ENABLED
Integer oldSetting = Settings.Secure.getInt(mContext.getContentResolver(),
"sfps_require_screen_on_to_auth_enabled", fingerprintWakeAndUnlock ? 0 : 1);
// Flip value
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.SFPS_PERFORMANT_AUTH_ENABLED, oldSetting.equals(1) ? 0 : 1);
upgradeVersion = 19;
}
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion != newVersion) {
Log.wtf(TAG, "warning: upgrading settings database to version "