硬件:RK3568
软件:Android 12
需求:设备通过OTA升级,默认打开虚拟键盘
发现编译的img默认是打开虚拟键盘的,但是ota升级包升级的话,虚拟键盘是关闭的。
解决办法,在编译ota升级包时,修改settingprovider里的数据库版本号,并在版本变化时,更新对应的字段(不然会出现别的奇怪bug)
--- a/framework/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/framework/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -3513,7 +3513,7 @@ public class SettingsProvider extends ContentProvider {
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 192;
+ private static final int SETTINGS_VERSION = 193; //修改版本号
private final int mUserId;
@@ -4911,6 +4911,25 @@ public class SettingsProvider extends ContentProvider {
currentVersion = 192;
}
//需要处理,不然会出现奇奇怪怪的bug
+ if (currentVersion == 192) {
+ final SettingsState globalSettings = getGlobalSettingsLocked();
+ globalSettings.insertSettingOverrideableByRestoreLocked(
+ Secure.SHOW_IME_WITH_HARD_KEYBOARD,
+ getContext().getResources().getBoolean(
+ R.bool.def_show_ime_with_hard_keyboard) ? "1" : "0",
+ null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+
+ globalSettings.insertSettingOverrideableByRestoreLocked(
+ Global.BLUETOOTH_ON,
+ getContext().getResources().getBoolean(
+ R.bool.def_bluetooth_on) ? "1" : "0",
+ null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+ currentVersion = 193;
+ }
+
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {