cm-14.1 Android系统定制(三):Setting相关的默认值、系统属性

声明

  • 通常情况下,Android系统定制的一个重要环节是对系统性功能的裁剪、增加,最能体现系统功能的就是Setting应用中的设置项,系统功能的多少一般都会体现在Setting中。
  • 另外就是系统的属性

1 Settings应用的默认值

    在源码目录~/LineageOS/frameworks/base/packages/SettingsProvider/res/values/defaults.xml中:

<?xml version="1.0" encoding="utf-8"?>
<!--
/**
 * Copyright (c) 2009, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->
<resources>
    <bool name="def_dim_screen">true</bool>
    <integer name="def_screen_off_timeout">60000</integer>
    <integer name="def_sleep_timeout">-1</integer>
    <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>
    <bool name="def_accelerometer_rotation">true</bool>
    <!-- Default screen brightness, from 0 to 255.  102 is 40%. -->
    <integer name="def_screen_brightness">102</integer>
    <bool name="def_screen_brightness_automatic_mode">false</bool>
    <fraction name="def_window_animation_scale">100%</fraction>
    <fraction name="def_window_transition_scale">100%</fraction>
    <bool name="def_haptic_feedback">true</bool>

    <bool name="def_bluetooth_on">false</bool>
    <bool name="def_wifi_display_on">false</bool>
    <bool name="def_install_non_market_apps">false</bool>
    <bool name="def_package_verifier_enable">true</bool>
    <!-- Comma-separated list of location providers.
         Network location is off by default because it requires
         user opt-in via Setup Wizard or Settings.
    -->
    <string name="def_location_providers_allowed" translatable="false">gps</string>
    <bool name="assisted_gps_enabled">true</bool>
    <bool name="def_netstats_enabled">true</bool>
    <bool name="def_usb_mass_storage_enabled">true</bool>
    <bool name="def_wifi_on">false</bool>
    <bool name="def_show_password_on">true</bool>
    <bool name="config_show_password_on">false</bool>
    <!-- 0 == never, 1 == only when plugged in, 2 == always -->
    <integer name="def_wifi_sleep_policy">2</integer>
    <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>

    <bool name="def_mount_play_notification_snd">true</bool>
    <bool name="def_mount_ums_autostart">false</bool>
    <bool name="def_mount_ums_prompt">true</bool>
    <bool name="def_mount_ums_notify_enabled">true</bool>

    <!-- user interface sound effects -->
    <integer name="def_power_sounds_enabled">1</integer>
    <string name="def_low_battery_sound" translatable="false">/system/media/audio/ui/LowBattery.ogg</string>
    <integer name="def_dock_sounds_enabled">0</integer>
    <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>
    <string name="def_desk_undock_sound" translatable="false">/system/media/audio/ui/Undock.ogg</string>
    <string name="def_car_dock_sound" translatable="false">/system/media/audio/ui/Dock.ogg</string>
    <string name="def_car_undock_sound" translatable="false">/system/media/audio/ui/Undock.ogg</string>
    <integer name="def_lockscreen_sounds_enabled">1</integer>
    <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>

    <bool name="def_lockscreen_disabled">false</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.ACCESSIBILITY_SCRIPT_INJECTION -->
    <bool name="def_accessibility_script_injection">false</bool>

    <!-- Default for Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD -->
    <bool name="def_accessibility_speak_password">false</bool>

    <!-- Default for Settings.Secure.ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS -->
    <string name="def_accessibility_web_content_key_bindings" translatable="false">
            <!-- DPAD/Trackball UP - traverse previous on current axis and send an event. -->
            0x13=0x01000100;
            <!-- DPAD/Trackball DOWN - traverse next on current axis and send an event. -->
            0x14=0x01010100;
            <!-- DPAD/Trackball LEFT - traverse previous on the character navigation axis and send event. -->
            0x15=0x02000001;
            <!-- DPAD/Trackball RIGHT - traverse next on the character navigation axis end send event. -->
            0x16=0x02010001;
            <!-- Alt+DPAD/Trackball UP - go to the top of the document. -->
            0x200000013=0x02000601;
            <!-- Alt+DPAD/Trackball DOWN - go to the bottom of the document. -->
            0x200000014=0x02010601;
            <!-- Alt+DPAD/Trackball LEFT - transition from an axis to another and sends an event.-->
            <!-- Axis transitions: 2 -> 1; -->
            0x200000015=0x03020101;
            <!-- Alt+DPAD/Trackball RIGHT - transition from an axis to another and sends an event. -->
            <!-- Axis transitions:  1 -> 2; -->
            0x200000016=0x03010201;
            <!-- Alt+g - go to the previous heading and send an event. -->
            0x200000023=0x02000301;
            <!-- Alt+h - go to the next heading and send an event. -->
            0x200000024=0x02010301;
            <!-- Alt+COMMA - transition to sentence navigation axis and send an event. -->
            <!-- Axis transitions:  7 -> 2; -->
            0x200000037=0x03070201;
            <!-- Alt+PERIOD - transition to default web view behavior axis and send an event. -->
            <!-- Axis transitions:  0 -> 7; 1 - > 7; 2 -> 7; -->
            0x200000038=0x03000701:0x03010701:0x03020701;
    </string>

    <!-- Default for Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION_URL -->
    <string name="def_accessibility_screen_reader_url" translatable="false">
        https://ssl.gstatic.com/accessibility/javascript/android/AndroidVox_v1.js
    </string>

    <!-- 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">200%</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">0</integer>

    <!-- Default for Settings.Secure.DOWNLOAD_MAX_BYTES_OVER_MOBILE. <=0 if no limit -->
    <integer name="def_download_manager_max_bytes_over_mobile">-1</integer>
    <!-- Default for Settings.Secure.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE. <=0 if no limit -->
    <integer name="def_download_manager_recommended_max_bytes_over_mobile">-1</integer>

    <!-- Default for Settings.Secure.LONG_PRESS_TIMEOUT_MILLIS -->
    <integer name="def_long_press_timeout_millis">400</integer>

    <!-- 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>
    <!-- Default for UI touch sounds enabled -->
    <bool name="def_sound_effects_enabled">true</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.Global.LOW_BATTERY_SOUND_TIMEOUT.
         0 means no timeout; battery sounds will always play
         >0 is milliseconds of screen-off time after which battery sounds will not play -->
    <integer name="def_low_battery_sound_timeout">0</integer>

    <!-- 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>

    <!-- Default for Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 1==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, 1==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 $1=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>

    <!-- custom system sound or not -->
    <bool name="def_custom_sys_volume">false</bool>

    <!-- Ringtone Volume,its value is from 0 to 7,default value is 5 -->
    <integer name="def_ringtone_volume" translatable="false">5</integer>

    <!-- Music Volume,its value is from 0 to 15,default value is 11 -->
    <integer name="def_music_volume" translatable="false">11</integer>

    <!-- Voice Call Volume,its value is from 0 to 5,default value is 4 -->
    <integer name="def_voice_call_volume" translatable="false">4</integer>

    <!-- Alarm Volume,its value is from 0 to 7,default value is 6 -->
    <integer name="def_alarm_volume" translatable="false">6</integer>

    <!-- Notification Volume,its value is from 0 to 7,default value is 5 -->
    <integer name="def_notification_volume" translatable="false">5</integer>

    <!-- Ringtone headset Volume,its value is from 0 to 7,default value is 5 -->
    <integer name="def_ringtone_headset_volume" translatable="false">5</integer>

    <!-- Music headset Volume,its value is from 0 to 15,default value is 11 -->
    <integer name="def_music_headset_volume" translatable="false">11</integer>

    <!-- Voice Call headset Volume,its value is from 0 to 5,default value is 4 -->
    <integer name="def_voice_call_headset_volume" translatable="false">4</integer>

    <!-- Alarm headset Volume,its value is from 0 to 7,default value is 6 -->
    <integer name="def_alarm_headset_volume" translatable="false">6</integer>

    <!-- Notification headset Volume,its value is from 0 to 7,default value is 5 -->
    <integer name="def_notification_headset_volume" translatable="false">5</integer>

    <!-- Ringtone speaker Volume,its value is from 0 to 7,default value is 5 -->
    <integer name="def_ringtone_speaker_volume" translatable="false">5</integer>

    <!-- Music speaker Volume,its value is from 0 to 15,default value is 11 -->
    <integer name="def_music_speaker_volume" translatable="false">11</integer>

    <!-- Voice Call speaker Volume,its value is from 0 to 5,default value is 4 -->
    <integer name="def_voice_call_speaker_volume" translatable="false">4</integer>

    <!-- Alarm speaker Volume,its value is from 0 to 7,default value is 6 -->
    <integer name="def_alarm_speaker_volume" translatable="false">6</integer>

    <!-- Notification speaker Volume,its value is from 0 to 7,default value is 5 -->
    <integer name="def_notification_speaker_volume" translatable="false">5</integer>

    <!-- Voice Call earpiece Volume,its value is from 0 to 5,default value is 4 -->
    <integer name="def_voice_call_earpiece_volume" translatable="false">4</integer>

    <!-- Date format,yyyy-MM-dd: 2013/07/30; MM-dd-yyyy:07/30/2013; dd-MM-yyyy:30/07/2013 -->
    <string name="def_date_format" translatable="false"></string>

    <!-- Time format,default value is 24 : 24 format,other value is 12 format -->
    <string name="def_time_format" translatable="false"></string>

    <!-- enable accessibility or not,1:enable;0:disable -->
    <integer name="def_enable_accessibility">0</integer>

    <!-- for enable accessibility services,split by ":" ,
         example "com.google.android.marvin.talkback/
         com.google.android.marvin.talkback.TalkBackService" -->
    <string name="def_enable_accessibility_services" translatable="false"></string>
    <!-- Default Input Method, its value is from inputmethod's package name and main class name
        such as "com.android.inputmethod.pinyin/.PinyinIME"
    -->
    <string name="def_input_method" translatable="false"></string>
    <!--
        Default Enable InputMethods, its value is from inputmethod's package name and main class
        name such as "com.android.inputmethod.pinyin/.PinyinIME" ;This is a string
        containing the IDs of all enabled input methods, each ID separated by ':'.
    -->
    <string name="def_enable_input_methods" translatable="false"></string>
    <!-- Default for Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED -->
    <integer name="def_captive_portal_detection_enabled" translatable="false">1</integer>

    <!-- Default for Settings.Global.ETHERNET_ON {ETHERNET_STATE_UNKNOWN,ETHERNET_STATE_DISABLED,ETHERNET_STATE_ENABLED}-->
    <integer name="def_ethernet_on">2</integer>
    <!-- Default for Settings.Global.ETHERNET_STATIC_IP-->
    <string name="def_ethernet_static_ip"></string>
    <!-- Default for Settings.Global.ETHERNET_STATIC_MASK-->
    <string name="def_ethernet_static_mask">255.255.255.0</string>
    <!-- Default for Settings.Global.ETHERNET_STATIC_GATEWAY-->
    <string name="def_ethernet_static_gateway"></string>
    <!-- Default for Settings.Global.ETHERNET_STATIC_DNS1-->
    <string name="def_ethernet_static_dns1"></string>
    <!-- Default for Settings.Global.ETHERNET_STATIC_DNS2-->
    <string name="def_ethernet_static_dns2"></string>
</resources>

2 系统属性值

    系统属性值一般存储在下面文件中:
在源码文件~/LineageOS/bionic/libc/include/sys/_system_properties.hz中定义了几个宏:

#define PROP_PATH_RAMDISK_DEFAULT  "/default.prop"
#define PROP_PATH_SYSTEM_BUILD     "/system/build.prop"
#define PROP_PATH_VENDOR_BUILD     "/vendor/build.prop"
#define PROP_PATH_LOCAL_OVERRIDE   "/data/local.prop"
#define PROP_PATH_FACTORY          "/factory/factory.prop"

    在运行中,init进程会启动属性服务,属性服务初始化时会去这几个文件中加载属性值。

    可以在源码位置~/LineageOS/device/lge/hammerheadcaf/system.prop中查看配置好的属性值:

# API
ro.product.first_api_level=19

# Audio
media.aac_51_output_enabled=true
ro.qc.sdk.audio.fluencetype=fluence
persist.audio.fluence.voicecall=true
persist.audio.fluence.audiorec=true
audio.offload.buffer.size.kb=32
audio.offload.gapless.enabled=true
audio.offload.video=true
audio.offload.pcm.16bit.enable=true
audio.offload.pcm.24bit.enable=true
qcom.hw.aac.encoder=true
af.fast_track_multiplier=1
audio_hal.period_size=192

# Camera
camera.disable_zsl_mode=1
media.stagefright.legacyencoder=true
media.stagefright.less-secure=true

# Dalvik/VM
dalvik.vm.dex2oat-swap=false
dalvik.vm.heapminfree=2m

# Display
persist.hwc.mdpcomp.enable=true
persist.mdpcomp_perfhint=50

# Graphics
ro.opengles.version=196608
ro.sf.lcd_density=480

# Input
ro.input.noresample=1

# Net
net.tethering.noprovisioning=true

# Perf
ro.vendor.extension_library=libqti-perfd-client.so

# QCOM
drm.service.enabled=true

# Radio/RIL/Telephony
persist.radio.apm_sim_not_pwdn=1
persist.radio.mode_pref_nv10=1
persist.radio.snapshot_enabled=1
persist.radio.snapshot_timer=2
persist.radio.use_cc_names=true
persist.radio.data_no_toggle=1
persist.radio.custom_ecc=1
persist.radio.always_send_plmn=true
rild.libpath=/system/lib/libril-qc-qmi-1.so
ro.telephony.call_ring.multiple=0
ro.telephony.default_network=10
telephony.lteOnCdmaDevice=1

# Sensors
ro.qti.sensors.max_geomag_rotv=60
ro.qti.sensors.max_gyro_rate=200
ro.qti.sensors.max_accel_rate=200
ro.qti.sensors.max_grav=200
ro.qti.sensors.max_rotvec=200
ro.qti.sensors.max_orient=200
ro.qti.sensors.max_linacc=200
ro.qti.sensors.max_gamerv_rate=200
ro.qti.sensors.smd=true
ro.qti.sensors.game_rv=true
ro.qti.sensors.georv=true
ro.qti.sensors.smgr_mag_cal_en=true
ro.qti.sensors.step_detector=true
ro.qti.sensors.step_counter=true
ro.qti.sensors.pick_up=false
ro.qti.sensors.tap=false
ro.qti.sensors.facing=false
ro.qti.sensors.tilt=false
ro.qti.sensors.tilt_detector=true
ro.qti.sensors.amd=false
ro.qti.sensors.rmd=false
ro.qti.sensors.vmd=false
ro.qti.sensors.pedometer=false
ro.qti.sensors.pam=false
ro.qti.sdk.sensors.gestures=false
persist.debug.sensors.hal=w
debug.qualcomm.sns.daemon=w
debug.qualcomm.sns.libsensor1=w

# Storage
ro.sys.sdcardfs=true

# Wifi
wifi.interface=wlan0

3 Enjoy

    通过修改这个属性值和defaults.xml中的值,载编译系统代码,刷机后就可以实现某些开机设定的配置了。

发布了48 篇原创文章 · 获赞 5 · 访问量 7807

猜你喜欢

转载自blog.csdn.net/Xiaoma_Pedro/article/details/103892947