Android 系统默认设置
程序员文章站
2022-03-27 21:48:09
目录概述defaults.xml添加默认属性概述Android的系统设置数据存放在com.android.providers.settings/databases/settings.db 中。数据库中的默认数据在frameworks/base/packages/SettingsProvider/res/values/defaults.xml 中定义,通过frameworks\base\packages\SettingsProvider\src\com\android\providers\settin...
目录
概述
Android的系统设置数据存放在com.android.providers.settings/databases/settings.db 中。
数据库中的默认数据在frameworks/base/packages/SettingsProvider/res/values/defaults.xml 中定义,
通过frameworks\base\packages\SettingsProvider\src\com\android\providers\settings\DatabaseHelper.java对数据库结构及初始值进行初始化。
defaults.xml
\frameworks\base\packages\SettingsProvider\res\values\defaults.xml 。
<resources>
<bool name="def_dim_screen">true</bool>//自动关屏 开
<integer name="def_screen_off_timeout">60000</integer>//自动关闭屏幕时间60秒,可以通过设置为非常大的值来达到不息屏的目的
<integer name="def_sleep_timeout">-1</integer>//表示休眠时间,默认如果没有修改的是6000,即6000ms的意思,6s进行休眠,在这里将其改为-1就是让其永远不休眠
<bool name="def_airplane_mode_on">false</bool>//飞行模式 关
<bool name="def_theater_mode_on">false</bool> //电影院模式 关
<!-- Comma-separated list of bluetooth, wifi, and cell. -->
<string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc,wimax</string> //在飞行模式下禁用的功能列表,用逗号分开
<string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string> //在飞行模式下禁用的功能列表中能手动开启的功能列表,用逗号分开
<string name="def_bluetooth_disabled_profiles" translatable="false">0</string>
<bool name="def_auto_time">true</bool> //自动适应时间 开
<bool name="def_auto_time_zone">true</bool> //使用24小时格式 开
<bool name="def_accelerometer_rotation">false</bool> //自动旋转 关
<!-- Default screen brightness, from 0 to 255. 102 is 40%. -->
<integer name="def_screen_brightness">102</integer>//默认屏幕亮度 102
<bool name="def_screen_brightness_automatic_mode">false</bool>//屏幕亮度自适应 关
<fraction name="def_window_animation_scale">100%</fraction> //常规窗口动画的百分比值,为0时禁止窗口动画
<fraction name="def_window_transition_scale">100%</fraction>//activity过度窗口动画的百分比值,为0时禁止窗口动画
<bool name="def_haptic_feedback">false</bool> //触动反馈 关
<bool name="def_bluetooth_on">false</bool>//蓝牙状态 关
<bool name="def_wifi_display_on">false</bool>//Wifi是否开启显示 关
<bool name="def_install_non_market_apps">false</bool> //安装非市场APK 关
<bool name="def_package_verifier_enable">true</bool> //验证应用 开
<!-- 0 == off, 3 == on -->
<integer name="def_location_mode">3</integer>
<bool name="assisted_gps_enabled">false</bool> //GPS定位 关
<bool name="def_netstats_enabled">true</bool> //默认是否开启数据流量 开
<bool name="def_usb_mass_storage_enabled">true</bool> //是否使用USB大容量存储 开
<bool name="def_wifi_on">false</bool> //wifi 关
<!-- == never, == only when plugged in, == always -->
<integer name="def_wifi_sleep_policy">2</integer> //wifi休眠策略,2-永不修改
<bool name="def_wifi_wakeup_enabled">true</bool>
<bool name="def_networks_available_notification_on">true</bool>//当用户使用网络时是否通知 是
<bool name="def_backup_enabled">false</bool>//是否启动设备备份 否
<string name="def_backup_transport" translatable="false">android/com.android.internal.backup.LocalTransport</string>
<!-- Default value for whether or not to pulse the notification LED when there is a
pending notification -->
<bool name="def_notification_pulse">true</bool>//当有通知时LED灯是否一直闪烁
<bool name="def_mount_play_notification_snd">true</bool>//当有MountService事件时是否播放通知音
<bool name="def_mount_ums_autostart">false</bool>//ums自动重启 关
<bool name="def_mount_ums_prompt">true</bool>//
ums启用时是否在通知栏提示
<bool name="def_mount_ums_notify_enabled">true</bool> //ums主机监控时显示在通知栏
<!-- user interface sound effects -->
<integer name="def_power_sounds_enabled">1</integer> //是否播放低电量声音 1--是
<string name="def_low_battery_sound" translatable="false">/system/media/audio/ui/LowBattery.ogg</string>//低电量声音文件
<integer name="def_dock_sounds_enabled">0</integer>//插上充电座是否播放声音 0-否
<integer name="def_dock_sounds_enabled_when_accessibility">0</integer>
<string name="def_desk_dock_sound" translatable="false">/system/media/audio/ui/Dock.ogg</string>//插入家用底座时的音频文件的URI
<string name="def_desk_undock_sound" translatable="false">/system/media/audio/ui/Undock.ogg</string>//拔出家用底座时的音频文件的URI
<string name="def_car_dock_sound" translatable="false">/system/media/audio/ui/Dock.ogg</string>//插入车载底座时音频文件的URI
<string name="def_car_undock_sound" translatable="false">/system/media/audio/ui/Undock.ogg</string>//拔出车载底座时音频文件的URI
<integer name="def_lockscreen_sounds_enabled">1</integer>//锁屏是否播放声音 0-否,1-是
<string name="def_lock_sound" translatable="false">/system/media/audio/ui/Lock.ogg</string>//锁屏声音文件
<string name="def_unlock_sound" translatable="false">/system/media/audio/ui/Unlock.ogg</string>//解锁声音文件
<string name="def_trusted_sound" translatable="false">/system/media/audio/ui/Trusted.ogg</string>
<string name="def_wireless_charging_started_sound" translatable="false">/system/media/audio/ui/WirelessChargingStarted.ogg</string> //开始无线充电音频文件的URI
<string name="def_charging_started_sound" translatable="false">/product/media/audio/ui/ChargingStarted.ogg</string>
<!-- sound trigger detection service default values -->
<integer name="def_max_sound_trigger_detection_service_ops_per_day" translatable="false">1000</integer>
<integer name="def_sound_trigger_detection_service_op_timeout" translatable="false">15000</integer>
<bool name="def_lockscreen_disabled">true</bool> //是否禁用锁屏
<bool name="def_device_provisioned">false</bool> //设备是否已提供
<integer name="def_dock_audio_media_enabled">1</integer>
<!-- Notifications use ringer volume -->
<bool name="def_notifications_use_ring_volume">true</bool> 是否将铃声作为通知铃声使用
<!-- Default for Settings.System.VIBRATE_IN_SILENT -->
<bool name="def_vibrate_in_silent">true</bool>//静音模式是否震动 是
<!-- Default for Settings.Secure.SYNC_PARENT_SOUNDS -->
<bool name="def_sync_parent_sounds">true</bool>
<!-- Default for Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD -->
<bool name="def_accessibility_speak_password">false</bool>// 在可访问模式时是否允许读出密码
<!-- Default for Settings.Secure.TOUCH_EXPLORATION_ENABLED -->
<bool name="def_touch_exploration_enabled">false</bool>
<!-- Default value for Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE -->
<fraction name="def_accessibility_display_magnification_scale">%</fraction> //设置显示放大的百分比
<!-- Default value for Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED -->
<bool name="def_accessibility_display_magnification_enabled">false</bool> //是否启用可设置放大屏幕显示比例 否
<!-- Default value for Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE -->
<bool name="def_accessibility_display_magnification_auto_update">true</bool>//是否允许屏幕放大比例自动更新 是
<!-- Default for Settings.System.USER_ROTATION -->
<integer name="def_user_rotation"></integer>//屏幕旋转策略,默认启用旋转 0--否
<!-- Default for Settings.Secure.DOWNLOAD_MAX_BYTES_OVER_MOBILE. <= if no limit -->
<integer name="def_download_manager_max_bytes_over_mobile">-1</integer> //下载时的最大速度,以字节为单位 -1-不限制
<!-- Default for Settings.Secure.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE. <= if no limit -->
<integer name="def_download_manager_recommended_max_bytes_over_mobile">-1</integer> //下载时推荐的最大速度,以字节为单位 -1-不限制
<!-- Default for Settings.Secure.LONG_PRESS_TIMEOUT_MILLIS -->
<integer name="def_long_press_timeout_millis">500</integer>//设置长按失效时长 500毫秒
<!-- Default for Settings.Secure.MULTI_PRESS_TIMEOUT -->
<integer name="def_multi_press_timeout_millis">300</integer>
<!-- Default for Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD -->
<bool name="def_show_ime_with_hard_keyboard">false</bool>
<!-- Default for Settings.System.POINTER_SPEED -->
<integer name="def_pointer_speed">0</integer> //屏幕是否可以旋转 否
<!-- Default for DTMF tones enabled -->
<bool name="def_dtmf_tones_enabled">true</bool> //在拨号时拨号器是否启用DTMF音调 是
<!-- M: Default for UI touch sounds disabled ,google defaulit is enable -->
<bool name="def_sound_effects_enabled">false</bool> //否启用触屏解锁等音效反馈
<!-- Development settings -->
<bool name="def_stay_on_while_plugged_in">false</bool> //当充电时,是否保持唤醒状态 否
<!-- Number of retries for connecting to DHCP.
Value here is the same as WifiStateMachine.DEFAULT_MAX_DHCP_RETRIES -->
<integer name="def_max_dhcp_retries">9</integer> //最大重连次数
<!-- Default for Settings.Secure.USER_SETUP_COMPLETE -->
<bool name="def_user_setup_complete">false</bool> 当前用户是否已经通过安装向导设置 否
<!-- Default for Settings.Secure.USER_SETUP_COMPLETE -->
<bool name="def_user_setup_complete">true</bool>
<!-- Default for Settings.Global.LOW_BATTERY_SOUND_TIMEOUT.
means no timeout; battery sounds will always play
> is milliseconds of screen-off time after which battery sounds will not play -->
<integer name="def_low_battery_sound_timeout">0</integer>//低电量声音在屏幕关闭后是否超时播放 0-代表超时毫秒
<!-- Initial value for the Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS setting,
which is a comma separated list of packages that no longer need confirmation
for immersive mode.
Override to disable immersive mode confirmation for certain packages. -->
<string name="def_immersive_mode_confirmations" translatable="false"></string>是否需要沉浸式模式
<!-- Default for Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE -->
<integer name="def_wifi_scan_always_available">0</integer>//Wifi 是否一致扫描
<!-- Default for Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, ==on -->
<integer name="def_lock_screen_show_notifications">1</integer>//锁屏界面上展示通知
<!-- Default for Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS -->
<bool name="def_lock_screen_allow_private_notifications">true</bool> //锁屏界面是否一直展示通知
<!-- Default for Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED, ==on -->
<integer name="def_heads_up_enabled">1</integer>
<!-- Default for Settings.Global.DEVICE_NAME $1=MANUFACTURER $2=MODEL-->
<string name="def_device_name">%1$s %2$s</string>//设置多个设备名称
<!-- Default for Settings.Global.DEVICE_NAME $=MODEL -->
<string name="def_device_name_simple">%1$s</string>//设置单个设备名称
<!-- Default for Settings.Secure.WAKE_GESTURE_ENABLED -->
<bool name="def_wake_gesture_enabled">true</bool>//手势唤醒是否可用
<!-- Default state of tap to wake -->
<bool name="def_double_tap_to_wake">true</bool>
<!-- Default for Settings.Secure.NFC_PAYMENT_COMPONENT -->
<string name="def_nfc_payment_component"></string>
<!-- Default setting for ability to add users from the lock screen -->
<bool name="def_add_users_from_lockscreen">false</bool>
<!-- default setting for Settings.System.END_BUTTON_BEHAVIOR : END_BUTTON_BEHAVIOR_SLEEP -->
<integer name="def_end_button_behavior">0x2</integer>
<!-- default setting for Settings.Global.DEFAULT_RESTRICT_BACKGROUND_DATA -->
<bool name="def_restrict_background_data">false</bool>
<!-- Default for Settings.Secure.BACKUP_MANAGER_CONSTANTS -->
<string name="def_backup_manager_constants"></string>
<!-- Default setting for Settings.Global.MOBILE_DATA_ALWAYS_ON -->
<bool name="def_mobile_data_always_on">true</bool>
<!-- Default for Settings.Secure.BACKUP_LOCAL_TRANSPORT_PARAMETERS -->
<string name="def_backup_local_transport_parameters"></string>
<!-- 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.Global.NTP_SERVER_2's property name -->
<string name="def_ntp_server_2" translatable="false">persist.vendor.ntp.svr_2</string>
<!-- 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>
<!-- Default for Settings.System.TIME_12_24 -->
<string name="def_time_format" translatable="false">12</string>
</resources>
添加默认属性
如果要在系统中添加默认设置,需要如下步骤(以带物理键盘的系统中默认打开软键盘为例):
1、在defaults.xml中为新加的数据定义一个默认值
<integer name="show_ime_with_hard_keyboard">1</integer>
2、在DatabaseHelper.java中的loadSecureSettings(SQLiteDatabase db)方法中加入新字段的添加代码
loadStringSetting(stmt, Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD,
R.string.show_ime_with_hard_keyboar);
3、重新编译。
本文地址:https://blog.csdn.net/shenfengchen/article/details/109612716
推荐阅读
-
罗技键鼠win10可以用吗?现售PC外设都支持Windows 10系统
-
win7系统中罗技M558鼠标不能自动连接的详细解决办法
-
iPad总提示IOS系统更新怎么办 iPad关闭系统更新提醒的设置方法
-
IBM X System ServerGuide 8.41 服务器 系统安装 引导盘图文教程
-
视频:苹果OS X系统再曝新漏洞,用户信息唾手可得
-
电脑虚拟键盘怎么打开?两种方式打开系统虚拟键盘功能
-
驰为V89 PRO双系统平板怎么样? 驰为V89 PRO开箱测评
-
搭载Flyme系统 1499元京东JDtab平板电脑开箱图赏
-
Win7旗舰版系统下 快速检测并判断u盘是否中毒的技巧
-
昂达116W双系统寸平板性能如何?