Make CMParts a protected component manager

This allows to start protected application from the "Protected apps"
activity without re-inserting the secret code.

Change-Id: Iaf727d741ef8e302b76a566ae9cd6a5031c85079
This commit is contained in:
Gabriele M
2017-06-26 23:26:43 +02:00
committed by Abhisek Devkota
parent bd45c58857
commit 62ab051496
2 changed files with 19 additions and 2 deletions

View File

@@ -111,7 +111,7 @@
<bool name="def_swap_volume_keys_on_rotation">false</bool>
<!-- Default values for protected component managers -->
<string name="def_protected_component_managers" translatable="false">com.android.settings|com.android.launcher3|com.cyanogenmod.trebuchet</string>
<string name="def_protected_component_managers" translatable="false">com.android.settings|com.android.launcher3|com.cyanogenmod.trebuchet|org.cyanogenmod.cmparts</string>
<!-- Default temperature unit (CELSIUS) -->
<integer name="def_temperature_unit">2</integer>

View File

@@ -47,7 +47,7 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
private static final boolean LOCAL_LOGV = false;
private static final String DATABASE_NAME = "cmsettings.db";
private static final int DATABASE_VERSION = 7;
private static final int DATABASE_VERSION = 8;
public static class CMTableNames {
public static final String TABLE_SYSTEM = "system";
@@ -259,6 +259,23 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
}
upgradeVersion = 7;
}
if (upgradeVersion < 8) {
db.beginTransaction();
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("UPDATE secure SET value=? WHERE name=?");
stmt.bindString(1, mContext.getResources()
.getString(R.string.def_protected_component_managers));
stmt.bindString(2, CMSettings.Secure.PROTECTED_COMPONENT_MANAGERS);
stmt.execute();
db.setTransactionSuccessful();
} finally {
if (stmt != null) stmt.close();
db.endTransaction();
}
upgradeVersion = 8;
}
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion < newVersion) {