lineage-sdk: Update path for custom charging sound

Audio files were moved to /product on Android 10.
Moreover, align with AOSP and use the wireless sound
for wired usecase too.

In order to perform upgrade properly, handle the migration
for custom charging sound setting.

Change-Id: Ifb2085e3f56d777091d66544a72cdd75c843fb56
This commit is contained in:
Chippa-a
2019-10-03 18:40:45 +03:00
committed by Bruno Martins
parent b485a25aa3
commit 5802c11140
2 changed files with 22 additions and 2 deletions

View File

@@ -74,7 +74,7 @@
<bool name="def_power_notifications_vibrate">false</bool>
<!-- Default for LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE -->
<string name="def_power_notifications_ringtone" translatable="false">/system/media/audio/ui/ChargingStarted.ogg</string>
<string name="def_power_notifications_ringtone" translatable="false">/system/product/media/audio/ui/WirelessChargingStarted.ogg</string>
<!-- Default value for the battery LEDs brightness -->
<integer name="def_battery_brightness_level">255</integer>

View File

@@ -48,7 +48,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 = 12;
private static final int DATABASE_VERSION = 13;
private static final String DATABASE_NAME_OLD = "cmsettings.db";
@@ -426,6 +426,26 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
}
upgradeVersion = 12;
}
if (upgradeVersion < 13) {
// Update custom charging sound setting
if (mUserHandle == UserHandle.USER_OWNER) {
db.beginTransaction();
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("UPDATE global SET value=? WHERE name=?");
stmt.bindString(1, mContext.getResources()
.getString(R.string.def_power_notifications_ringtone));
stmt.bindString(2, LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE);
stmt.execute();
db.setTransactionSuccessful();
} finally {
if (stmt != null) stmt.close();
db.endTransaction();
}
}
upgradeVersion = 13;
}
// *** Remember to update DATABASE_VERSION above!
}