您的位置:首页 > 移动开发 > Android开发

Android framework系统默认设置修改

2014-08-01 16:00 519 查看
androidnotificationsintegerframeworks存储数据库

修改Settings源码可修改系统设置项,Settings数据被存放于com.android.providers.settings/databases/settings.db 中,如果想修改系统启动后加载的默认值

一种方法是直接修改settings.db的值

另一种就是修改SettingsProvider默认值

Settings应用能够配置Android系统的各种设置,这些设置的默认值都是由frameworks中的SettingsProvider从数据库中读取的,那么第一次开机的时候这些数据都是从哪儿来的呢?

frameworks/base/packages/SettingsProvider/res/values/defaults.xml这个文件就是用来存储Android系统的默认设置

例如:

600000设置关屏超时时间的默认值

102 设置亮度的默认值

false设置是否允许安装非Market应用程序的默认值

如果想定义defaults.xml中没有的,在这里添加后,需修改frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java,加入自己的存储代码。

来电铃声:SD卡ringtones文件下, 支持音频文件(MP3、wav、ogg等格式)。

通知铃声:SD卡notifications,支持音频文件(MP3、wav、ogg等格式)。

闹钟铃声:SD卡alarms,支持音频文件(MP3、wav、ogg等格式)。

附:系统自带铃声文件位置

来电铃声:/system/media/audio/ringtones

通知铃声:/system/media/audio/notifications

闹钟铃声:/system/media/audio/alarms

界面操作事件音:/system/media/audio/ui

以上转自:http://blog.sina.com.cn/s/blog_4ad8d46c0101610q.html

修改默认窗口过渡动画也是在里面。对应于开发者选项窗口缩放动画设置。

4.2.2 对应源码:

* 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>
    <bool name="def_airplane_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>
    <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>
    <!--  0 == mobile, 1 == wifi. -->
    <integer name="def_network_preference">1</integer>
    <bool name="def_netstats_enabled">true</bool>
    <bool name="def_usb_mass_storage_enabled">true</bool>
    <bool name="def_wifi_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>
    <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_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>

    <!-- 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">500</integer>

    <!-- 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>
</resources>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: