Android 系统-SettingsProvider

 转载: Android 系统-SettingsProvider_得闲先生的博客-CSDN博客

一、介绍

SettingsProvider是一个提供数据共享的provider,存放的都是一些Android的默认初始值。

Settings在后面的版本上增加为三类:

    System:包含各种各样的用户偏好系统设置;
    Global:所有的偏好设置对系统的所有用户公开,第三方APP有读没有写的权限;
    Secure:安全性的用户偏好系统设置,第三方APP有读没有写的权限。

二、使用方式:
 

Settings.System.putString(getActivity().getContentResolver(), "xxx", "default");

三、如何快速查看settings里的值

1.翻看数据库费时费力,不推荐也不介绍。

2.使用uri,(query、update、delete、insert)

adb shell content query --uri content://settings/system/vibrate_when_incoming_call,但是需要整完整的URI,也不推荐;

3.直接get,set

adb shell settings get secure 5g_switch

adb shell settings put secure 5g_switch xxx

四、查看系统的默认值

# settings list system
 

5G_switch=3
EngineeringMode=0
accelerometer_rotation=0
alarm_alert=content://media/internal/audio/media/11?title=Morning%20Dew1&canonical=1
alarm_alert_default=content://media/internal/audio/media/11?title=Morning%20Dew1&canonical=1
alarm_alert_set=1
allowed_partial_calls_mode=0
aod_switch_in_app=0
calendar_alert=content://media/internal/audio/media/13?title=Beep-Beep-Beep%20Alarm&canonical=1
calendar_alert_default=content://media/internal/audio/media/13?title=Beep-Beep-Beep%20Alarm&canonica
l=1
calendar_alert_set=1
call_connected_tone_enabled=0
cf611119a2491fb9519f0ba78b552850=LDpsgSUYI/PZ9XYVUKNA/jD/iVSX+5Qw3VVzzga9FHg=
default_screen_off_timeout=2147483647
dim_screen=1
disable_expand_keyguard=0
dtmf_tone=1
dtmf_tone_type=0
dxCRMxhQkdGePGnp=0F0CE19C7B59841D0F3E70079092CF73CE3417CFD3DE006B3CD66B34BA6A70BA
end_button_behavior=2
face_unlock_type=0
fingerprint_icon_type=0x108a072
font_scale=1.0
game_mode_working=0
gesture_double_tap=0
gesture_to_answer=0
gesture_to_silent=0
gree_ime_showing=0
haptic_feedback_enabled=0
hearing_aid=0
hide_rotation_lock_toggle_for_accessibility=0
light_screen_notification_state=0
lockscreen_sounds_enabled=1
magazine_lock_screen=0
mid_night_mode=1
mistouch_switch=1
mms_notification_sound_set=1
mms_sound=content://media/internal/audio/media/52?title=Notice&canonical=1
mms_sound_default=content://media/internal/audio/media/52?title=Notice&canonical=1
mode_ringer_streams_affected=422
mqBRboGZkQPcAkyk=AF4cLzTK4WMDAIt0hdre5Qqk
mute_streams_affected=111
notification_light_pulse=1
notification_rejection=0
notification_sound=content://media/internal/audio/media/52?title=Notice&canonical=1
notification_sound_default=content://media/internal/audio/media/52?title=Notice&canonical=1
notification_sound_set=1
peak_refresh_rate=90
phone_rejection=0
pointer_speed=0
power_on_time_set=0
radio.data.stall.recovery.action=0
ring_up_mode=0
ringtone=content://media/internal/audio/media/26?title=Major%20Tones1&canonical=1
ringtone_2=content://media/internal/audio/media/26?title=Major%20Tones1&canonical=1
ringtone_2_default=content://media/internal/audio/media/26?title=Major%20Tones1&canonical=1
ringtone_2_set=1
ringtone_default=content://media/internal/audio/media/26?title=Major%20Tones1&canonical=1
ringtone_set=1
screen_brightness=1567
screen_brightness_float=0.44560263
screen_brightness_for_vr=86
screen_brightness_mode=1
screen_off_show_fp_icon=1
screen_off_timeout=2147483647
selected_MIB_or_GIB=0
show_carrier_name=1
show_light_effect=1
sound_effects_enabled=0
status_bar_show_battery_percent=0
system_locales=zh-CN
time_12_24=24
title_type_alarm=/internal/audio/media/11====Morning Dew1
title_type_alert=/internal/audio/media/13====Beep-Beep-Beep Alarm
title_type_mms=/internal/audio/media/52====Notice
title_type_notification=/internal/audio/media/52====Notice
title_type_ringtone2=/internal/audio/media/26====Major Tones1
title_type_ringtone=/internal/audio/media/26====Major Tones1
tty_mode=0
user_rotation=0
vibrate_when_ringing=0
volume_alarm=9
volume_bluetooth_sco=9
volume_music=9
volume_music_usb_headset=8
volume_notification=9
volume_ring=9
volume_system=7
volume_voice=4
wallpaper_show_type=0

你可能感兴趣的:(android基础知识,android)