202301209将RK3399的挖掘机开发板在Android10下设置系统默认为24小时制
2023/12/9 22:07
应该也可以适用于RK3399的Android12系统
--- a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
+++ b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -266,5 +266,7 @@
<!-- should show the screenshot button default -->
<integer name="def_screenshot_button_show">0</integer>
+
+ <string name="time_12_24">24</string>
</resources>
Z:\Rockchip_Android10.0_SDK_Release\frameworks\base\packages\SettingsProvider\res\values\defaults.xml
<!-- Default for Settings.Global.ZEN_DURATION
If 0, turning on dnd manually will last indefinitely.
Else if non-negative, turning on dnd manually will last for this many minutes.
Else (if negative), turning on dnd manually will surface a dialog that prompts
user to specify a duration.-->
<integer name="def_zen_duration">0</integer>
<!-- Default for Settings.Global.BACKUP_AGENT_TIMEOUT_PARAMETERS -->
<string name="def_backup_agent_timeout_parameters"></string>
<!-- Default for Settings.System.VIBRATE_WHEN_RINGING -->
<bool name="def_vibrate_when_ringing">false</bool>
<!-- Default for Settings.Global.APPLY_RAMPING_RINGER -->
<bool name="def_apply_ramping_ringer">false</bool>
<!-- Default for Settings.Secure.CHARGING_VIBRATION_ENABLED -->
<bool name="def_charging_vibration_enabled">true</bool>
<!-- Default for Settings.Secure.CHARGING_SOUNDS_ENABLED -->
<bool name="def_charging_sounds_enabled">true</bool>
<!-- Default for Settings.Secure.NOTIFICATION_BUBBLES -->
<bool name="def_notification_bubbles">false</bool>
<!-- Default for Settings.Secure.AWARE_ENABLED -->
<bool name="def_aware_enabled">false</bool>
<!-- Default for Settings.Secure.SKIP_GESTURE -->
<bool name="def_skip_gesture">false</bool>
<!-- Default for Settings.Secure.SILENCE_GESTURE -->
<bool name="def_silence_gesture">false</bool>
<!-- Default for Settings.Secure.AWARE_LOCK_ENABLED -->
<bool name="def_aware_lock_enabled">false</bool>
<!-- should show the screenshot button default -->
<integer name="def_screenshot_button_show">0</integer>
<string name="time_12_24">24</string>
</resources>
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
index 7f9ce0e005..42c6c048cc 100755
--- a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -2279,6 +2279,8 @@ class DatabaseHelper extends SQLiteOpenHelper {
loadIntegerSetting(stmt, Settings.System.SCREENSHOT_BUTTON_SHOW,
R.integer.def_screenshot_button_show);
+
+ loadStringSetting(stmt, Settings.System.TIME_12_24, R.string.time_12_24);
/*
* IMPORTANT: Do not add any more upgrade steps here as the global,
@@ -2408,6 +2410,8 @@ class DatabaseHelper extends SQLiteOpenHelper {
loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,
R.string.def_enabled_method);
+
+
/*
* IMPORTANT: Do not add any more upgrade steps here as the global,
Z:\Rockchip_Android10.0_SDK_Release\frameworks\base\packages\SettingsProvider\src\com\android\providers\settings\DatabaseHelper.java
private void loadSystemSettings(SQLiteDatabase db) {
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)"
+ " VALUES(?,?);");
loadBooleanSetting(stmt, Settings.System.DIM_SCREEN,
R.bool.def_dim_screen);
loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT,
R.integer.def_screen_off_timeout);
// Set default cdma DTMF type
loadSetting(stmt, Settings.System.DTMF_TONE_TYPE_WHEN_DIALING, 0);
// Set default hearing aid
loadSetting(stmt, Settings.System.HEARING_AID, 0);
// Set default tty mode
loadSetting(stmt, Settings.System.TTY_MODE, 0);
loadIntegerSetting(stmt, Settings.System.SCREEN_BRIGHTNESS,
R.integer.def_screen_brightness);
loadIntegerSetting(stmt, Settings.System.SCREEN_BRIGHTNESS_FOR_VR,
com.android.internal.R.integer.config_screenBrightnessForVrSettingDefault);
loadBooleanSetting(stmt, Settings.System.SCREEN_BRIGHTNESS_MODE,
R.bool.def_screen_brightness_automatic_mode);
loadBooleanSetting(stmt, Settings.System.ACCELEROMETER_ROTATION,
R.bool.def_accelerometer_rotation);
loadDefaultHapticSettings(stmt);
loadBooleanSetting(stmt, Settings.System.NOTIFICATION_LIGHT_PULSE,
R.bool.def_notification_pulse);
loadUISoundEffectsSettings(stmt);
loadIntegerSetting(stmt, Settings.System.POINTER_SPEED,
R.integer.def_pointer_speed);
loadIntegerSetting(stmt, Settings.System.SCREENSHOT_BUTTON_SHOW,
R.integer.def_screenshot_button_show);
loadStringSetting(stmt, Settings.System.TIME_12_24, R.string.time_12_24);
/*
* IMPORTANT: Do not add any more upgrade steps here as the global,
* secure, and system settings are no longer stored in a database
* but are kept in memory and persisted to XML.
*
* See: SettingsProvider.UpgradeController#onUpgradeLocked
*/
} finally {
if (stmt != null) stmt.close();
}
}
diff --git a/packages/apps/Settings/res/xml/date_time_prefs.xml b/packages/apps/Settings/res/xml/date_time_prefs.xml
index 9ccc64e9f7..4a5f1583ef 100755
--- a/packages/apps/Settings/res/xml/date_time_prefs.xml
+++ b/packages/apps/Settings/res/xml/date_time_prefs.xml
@@ -68,9 +68,9 @@
android:key="time_format_preference_category"
android:title="@string/time_format_category_title"
settings:keywords="@string/keywords_time_format">
- <SwitchPreference
+ <!--<SwitchPreference
android:key="auto_24hour"
- android:title="@string/date_time_24hour_auto"/>
+ android:title="@string/date_time_24hour_auto"/>-->
<SwitchPreference
android:key="24 hour"
Z:\Rockchip_Android10.0_SDK_Release\packages\apps\Settings\res\xml\date_time_prefs.xml
<PreferenceCategory
android:key="time_format_preference_category"
android:title="@string/time_format_category_title"
settings:keywords="@string/keywords_time_format">
<SwitchPreference
android:key="auto_24hour"
android:title="@string/date_time_24hour_auto"/>
<SwitchPreference
android:key="24 hour"
android:title="@string/date_time_24hour" />
</PreferenceCategory>
修改为:
<PreferenceCategory
android:key="time_format_preference_category"
android:title="@string/time_format_category_title"
settings:keywords="@string/keywords_time_format">
<!--<SwitchPreference
android:key="auto_24hour"
android:title="@string/date_time_24hour_auto"/>-->
<SwitchPreference
android:key="24 hour"
android:title="@string/date_time_24hour" />
</PreferenceCategory>
参考资料:
https://blog.csdn.net/u011774634/article/details/130582917
RK3588S Android12设置系统默认为24小时制
潇然四叶草 已于 2023-05-09 18:03:27 修改