赞
踩
RK3288/RK3368 + Android 7.12
在旧的SDK上, 可以通过设置默认 ro.rk.install_non_market_apps=true, 默认打开安装未知来源应用 在新的代码上此属性不生效
diff --git a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java old mode 100644 new mode 100755 index 9ed6063..dac22e1 --- a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -2522,8 +2522,13 @@ class DatabaseHelper extends SQLiteOpenHelper { loadStringSetting(stmt, Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS, R.string.def_immersive_mode_confirmations); - loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, - R.bool.def_install_non_market_apps); + String propNonMarket = android.os.SystemProperties.get("ro.rk.install_non_market_apps"); + if(propNonMarket.equals("true")){ + loadSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, "1"); + }else{ + loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, + R.bool.def_install_non_market_apps); + } loadBooleanSetting(stmt, Settings.Secure.WAKE_GESTURE_ENABLED, R.bool.def_wake_gesture_enabled);
private void loadSecureSettings(SQLiteDatabase db) {
SQLiteStatement stmt = null;
try {
//...省略代码...
String propNonMarket = android.os.SystemProperties.get("ro.rk.install_non_market_apps");
if(propNonMarket.equals("true")){
loadSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, "1");
}else{
loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS,
R.bool.def_install_non_market_apps);
}
//...省略代码...
}
loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS,
R.bool.def_install_non_market_apps);
String propNonMarket = android.os.SystemProperties.get("ro.rk.install_non_market_apps");
if(propNonMarket.equals("true")){
loadSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, "1");
}
这是无效的, 原因是, 第一行的代码已经往数据库里插入了数据. 见下面SQLiteStatement 的赋值方式:
SQLiteStatement stmt = null;
stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)"
+ " VALUES(?,?);");
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。