Broadscale logging for Settings

Bug: 26687914
Change-Id: Ida75ccf95376538e2ba95d212d333c40fd2dd6e0
This commit is contained in:
Jason Monk
2016-01-20 14:41:52 -05:00
parent 7368750b4f
commit 31c7c32fcc
38 changed files with 271 additions and 160 deletions

View File

@@ -27,7 +27,6 @@
android:entries="@array/daltonizer_type_entries"
android:entryValues="@array/daltonizer_type_values"
android:key="type"
android:persistent="false"
android:summary="%s"
android:title="@string/daltonizer_type" />

View File

@@ -55,8 +55,7 @@
<SwitchPreference
android:key="toggle_high_text_contrast_preference"
android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
android:summary="@string/experimental_preference"
android:persistent="false"/>
android:summary="@string/experimental_preference"/>
<SwitchPreference
android:key="toggle_power_button_ends_call_preference"

View File

@@ -54,6 +54,7 @@
android:title="@string/app_notification_block_title"
android:summary="@string/app_notification_block_summary"
android:order="7" />
<PreferenceCategory
android:key="categories"
android:title="@string/notification_topic_categories"

View File

@@ -51,14 +51,12 @@
android:key="toggle_advanced_settings"
android:title="@string/advanced_settings"
android:summaryOff="@string/advanced_settings_summary"
android:summaryOn="@string/advanced_settings_summary"
android:persistent="false" />
android:summaryOn="@string/advanced_settings_summary" />
<ListPreference
android:key="app_install_location"
android:title="@string/app_install_location_title"
android:summary="@string/app_install_location_summary"
android:persistent="false"
android:entries="@array/app_install_location_entries"
android:entryValues="@array/app_install_location_values"/>

View File

@@ -22,8 +22,7 @@
<DropDownPreference
android:key="turn_on_automatically"
android:title="@string/battery_saver_turn_on_automatically_title"
android:summary="%s"
android:persistent="false" />
android:summary="%s" />
<!-- Feature description text -->
<com.android.settings.fuelgauge.WallOfTextPreference

View File

@@ -26,7 +26,6 @@
android:title="@string/captioning_standard_options_title" >
<com.android.settings.accessibility.LocalePreference
android:key="captioning_locale"
android:persistent="false"
android:summary="%s"
android:title="@string/captioning_locale" />
@@ -34,13 +33,11 @@
android:entries="@array/captioning_font_size_selector_titles"
android:entryValues="@array/captioning_font_size_selector_values"
android:key="captioning_font_size"
android:persistent="false"
android:summary="%s"
android:title="@string/captioning_text_size" />
<com.android.settings.accessibility.PresetPreference
android:key="captioning_preset"
android:persistent="false"
android:title="@string/captioning_preset" />
</PreferenceCategory>
<PreferenceCategory
@@ -50,47 +47,38 @@
android:entries="@array/captioning_typeface_selector_titles"
android:entryValues="@array/captioning_typeface_selector_values"
android:key="captioning_typeface"
android:persistent="false"
android:summary="%s"
android:title="@string/captioning_typeface" />
<com.android.settings.accessibility.ColorPreference
android:key="captioning_foreground_color"
android:persistent="false"
android:title="@string/captioning_foreground_color" />
<com.android.settings.accessibility.ColorPreference
android:dependency="captioning_foreground_color"
android:key="captioning_foreground_opacity"
android:persistent="false"
android:title="@string/captioning_foreground_opacity" />
<com.android.settings.accessibility.EdgeTypePreference
android:key="captioning_edge_type"
android:persistent="false"
android:title="@string/captioning_edge_type" />
<com.android.settings.accessibility.ColorPreference
android:dependency="captioning_edge_type"
android:key="captioning_edge_color"
android:persistent="false"
android:title="@string/captioning_edge_color" />
<com.android.settings.accessibility.ColorPreference
android:key="captioning_background_color"
android:persistent="false"
android:title="@string/captioning_background_color" />
<com.android.settings.accessibility.ColorPreference
android:dependency="captioning_background_color"
android:key="captioning_background_opacity"
android:persistent="false"
android:title="@string/captioning_background_opacity" />
<com.android.settings.accessibility.ColorPreference
android:key="captioning_window_color"
android:persistent="false"
android:title="@string/captioning_window_color" />
<com.android.settings.accessibility.ColorPreference
android:dependency="captioning_window_color"
android:key="captioning_window_opacity"
android:persistent="false"
android:title="@string/captioning_window_opacity" />
</PreferenceCategory>

View File

@@ -22,15 +22,13 @@
<!-- Pulse notification light -->
<SwitchPreference
android:key="notification_pulse"
android:title="@string/notification_pulse_title"
android:persistent="false" />
android:title="@string/notification_pulse_title" />
<!-- When device is locked -->
<com.android.settingslib.RestrictedDropDownPreference
android:key="lock_screen_notifications"
android:title="@string/lock_screen_notifications_title"
android:summary="%s"
android:persistent="false" />
android:summary="%s" />
<PreferenceCategory
android:key="advanced"

View File

@@ -64,7 +64,6 @@
android:key="night_mode"
android:title="@string/night_mode_title"
android:summary="%s"
android:persistent="false"
android:entries="@array/night_mode_entries"
android:entryValues="@array/night_mode_values" />
@@ -77,8 +76,7 @@
<com.android.settings.ColorModePreference
android:key="color_mode"
android:title="@string/picture_color_mode"
android:summary="@string/picture_color_mode_desc"
android:persistent="false" />
android:summary="@string/picture_color_mode_desc" />
<ListPreference
android:key="select_webview_provider"
@@ -89,8 +87,7 @@
<SwitchPreference
android:key="color_temperature"
android:title="@string/color_temperature"
android:summary="@string/color_temperature_desc"
android:persistent="false" />
android:summary="@string/color_temperature_desc" />
<PreferenceCategory android:key="debug_debugging_category"
android:title="@string/debug_debugging_category">
@@ -220,28 +217,24 @@
<ListPreference
android:key="window_animation_scale"
android:title="@string/window_animation_scale_title"
android:persistent="false"
android:entries="@array/window_animation_scale_entries"
android:entryValues="@array/window_animation_scale_values" />
<ListPreference
android:key="transition_animation_scale"
android:title="@string/transition_animation_scale_title"
android:persistent="false"
android:entries="@array/transition_animation_scale_entries"
android:entryValues="@array/transition_animation_scale_values" />
<ListPreference
android:key="animator_duration_scale"
android:title="@string/animator_duration_scale_title"
android:persistent="false"
android:entries="@array/animator_duration_scale_entries"
android:entryValues="@array/animator_duration_scale_values" />
<ListPreference
android:key="overlay_display_devices"
android:title="@string/overlay_display_devices_title"
android:persistent="false"
android:entries="@array/overlay_display_devices_entries"
android:entryValues="@array/overlay_display_devices_values" />
@@ -268,14 +261,12 @@
<ListPreference
android:key="debug_hw_overdraw"
android:title="@string/debug_hw_overdraw"
android:persistent="false"
android:entries="@array/debug_hw_overdraw_entries"
android:entryValues="@array/debug_hw_overdraw_values" />
<ListPreference
android:key="show_non_rect_clip"
android:title="@string/show_non_rect_clip"
android:persistent="false"
android:entries="@array/show_non_rect_clip_entries"
android:entryValues="@array/show_non_rect_clip_values" />
@@ -293,7 +284,6 @@
android:entries="@array/simulate_color_space_entries"
android:entryValues="@array/simulate_color_space_values"
android:key="simulate_color_space"
android:persistent="false"
android:summary="%s"
android:title="@string/simulate_color_space" />
@@ -325,14 +315,12 @@
<ListPreference
android:key="track_frame_time"
android:title="@string/track_frame_time"
android:persistent="false"
android:entries="@array/track_frame_time_entries"
android:entryValues="@array/track_frame_time_values" />
<ListPreference
android:key="enable_opengl_traces"
android:title="@string/enable_opengl_traces_title"
android:persistent="false"
android:entries="@array/enable_opengl_traces_entries"
android:entryValues="@array/enable_opengl_traces_values" />
@@ -349,7 +337,6 @@
<ListPreference
android:key="app_process_limit"
android:title="@string/app_process_limit_title"
android:persistent="false"
android:entries="@array/app_process_limit_entries"
android:entryValues="@array/app_process_limit_values" />

View File

@@ -30,8 +30,7 @@
android:key="auto_brightness"
android:title="@string/auto_brightness_title"
settings:keywords="@string/keywords_display_auto_brightness"
android:summary="@string/auto_brightness_summary"
android:persistent="false" />
android:summary="@string/auto_brightness_summary" />
<!-- Hide night mode for now
<ListPreference
@@ -39,7 +38,6 @@
android:title="@string/night_mode_title"
settings:keywords="@string/keywords_display_night_mode"
android:summary="@string/night_mode_summary"
android:persistent="false"
android:entries="@array/night_mode_entries"
android:entryValues="@array/night_mode_values" /> -->
@@ -53,21 +51,18 @@
android:key="screen_timeout"
android:title="@string/screen_timeout"
android:summary="@string/screen_timeout_summary"
android:persistent="false"
android:entries="@array/screen_timeout_entries"
android:entryValues="@array/screen_timeout_values" />
<SwitchPreference
android:key="camera_gesture"
android:title="@string/camera_gesture_title"
android:summary="@string/camera_gesture_desc"
android:persistent="false" />
android:summary="@string/camera_gesture_desc" />
<SwitchPreference
android:key="camera_double_tap_power_gesture"
android:title="@string/camera_double_tap_power_gesture_title"
android:summary="@string/camera_double_tap_power_gesture_desc"
android:persistent="false" />
android:summary="@string/camera_double_tap_power_gesture_desc" />
<PreferenceScreen
android:key="screensaver"
@@ -76,20 +71,17 @@
<SwitchPreference
android:key="lift_to_wake"
android:title="@string/lift_to_wake_title"
android:persistent="false" />
android:title="@string/lift_to_wake_title" />
<SwitchPreference
android:key="doze"
android:title="@string/doze_title"
android:summary="@string/doze_summary"
android:persistent="false" />
android:summary="@string/doze_summary" />
<SwitchPreference
android:key="tap_to_wake"
android:title="@string/tap_to_wake"
android:summary="@string/tap_to_wake_summary"
android:persistent="false" />
android:summary="@string/tap_to_wake_summary" />
<PreferenceScreen
android:key="font_size"
@@ -104,7 +96,6 @@
<DropDownPreference
android:key="auto_rotate"
android:persistent="false"
android:summary="%s"
android:title="@string/display_auto_rotate_title" />

View File

@@ -22,14 +22,12 @@
<DropDownPreference
android:key="app_link_state"
android:persistent="false"
android:summary="%s"
android:title="@string/app_launch_open_domain_urls_title" />
<com.android.settings.applications.AppDomainsPreference
android:key="app_launch_supported_domain_urls"
android:title="@string/app_launch_supported_domain_urls_title"
android:persistent="false"
android:dependency="app_link_state"
/>
@@ -40,7 +38,6 @@
<com.android.settings.applications.ClearDefaultsPreference
android:key="app_launch_clear_defaults"
android:persistent="false"
/>
</PreferenceCategory>

View File

@@ -103,7 +103,6 @@
android:title="@string/vibrate_input_devices"
android:summaryOn="@string/vibrate_input_devices_summary"
android:summaryOff="@string/vibrate_input_devices_summary"
android:persistent="false"
/>
</PreferenceCategory>

View File

@@ -20,17 +20,14 @@
<com.android.settings.location.RadioButtonPreference
android:key="high_accuracy"
android:title="@string/location_mode_high_accuracy_title"
android:summary="@string/location_mode_high_accuracy_description"
android:persistent="false" />
android:summary="@string/location_mode_high_accuracy_description" />
<com.android.settings.location.RadioButtonPreference
android:key="battery_saving"
android:title="@string/location_mode_battery_saving_title"
android:summary="@string/location_mode_battery_saving_description"
android:persistent="false" />
android:summary="@string/location_mode_battery_saving_description" />
<com.android.settings.location.RadioButtonPreference
android:key="sensors_only"
android:title="@string/location_mode_sensors_only_title"
android:summary="@string/location_mode_sensors_only_description"
android:persistent="false" />
android:summary="@string/location_mode_sensors_only_description" />
</PreferenceScreen>

View File

@@ -21,14 +21,12 @@
android:title="@string/location_scanning_wifi_always_scanning_title"
android:summary="@string/location_scanning_wifi_always_scanning_description"
android:defaultValue="true"
android:key="wifi_always_scanning"
android:persistent="false" />
android:key="wifi_always_scanning" />
<SwitchPreference
android:title="@string/location_scanning_bluetooth_always_scanning_title"
android:summary="@string/location_scanning_bluetooth_always_scanning_description"
android:defaultValue="true"
android:key="bluetooth_always_scanning"
android:persistent="false" />
android:key="bluetooth_always_scanning" />
</PreferenceScreen>

View File

@@ -31,7 +31,6 @@
android:key="managed_profile_location_switch"
android:title="@string/managed_profile_location_switch_title"
settings:useAdminDisabledSummary="true"
android:persistent="false"
android:enabled="false"
android:selectable="true" />

View File

@@ -28,14 +28,12 @@
<SwitchPreference
android:key="context"
android:title="@string/assist_access_context_title"
android:summary="@string/assist_access_context_summary"
android:persistent="false"/>
android:summary="@string/assist_access_context_summary"/>
<SwitchPreference
android:key="screenshot"
android:title="@string/assist_access_screenshot_title"
android:summary="@string/assist_access_screenshot_summary"
android:persistent="false"/>
android:summary="@string/assist_access_screenshot_summary"/>
<com.android.settings.voice.VoiceInputListPreference
android:key="voice_input_settings"

View File

@@ -22,51 +22,43 @@
<!-- Dial pad tones -->
<SwitchPreference
android:key="dial_pad_tones"
android:title="@string/dial_pad_tones_title"
android:persistent="false" />
android:title="@string/dial_pad_tones_title" />
<!-- Screen locking sounds -->
<SwitchPreference
android:key="screen_locking_sounds"
android:title="@string/screen_locking_sounds_title"
android:persistent="false" />
android:title="@string/screen_locking_sounds_title" />
<!-- Charging sounds -->
<SwitchPreference
android:key="charging_sounds"
android:title="@string/charging_sounds_title"
android:persistent="false" />
android:title="@string/charging_sounds_title" />
<!-- Docking sounds -->
<SwitchPreference
android:key="docking_sounds"
android:title="@string/docking_sounds_title"
android:persistent="false" />
android:title="@string/docking_sounds_title" />
<!-- Touch sounds -->
<SwitchPreference
android:key="touch_sounds"
android:title="@string/touch_sounds_title"
android:persistent="false" />
android:title="@string/touch_sounds_title" />
<!-- Vibrate on touch -->
<SwitchPreference
android:key="vibrate_on_touch"
android:title="@string/vibrate_on_touch_title"
android:persistent="false" />
android:title="@string/vibrate_on_touch_title" />
<!-- Dock speaker plays -->
<DropDownPreference
android:key="dock_audio_media"
android:title="@string/dock_audio_media_title"
android:summary="%s"
android:persistent="false" />
android:summary="%s" />
<!-- Emergency tone -->
<DropDownPreference
android:key="emergency_tone"
android:title="@string/emergency_tone_title"
android:summary="%s"
android:persistent="false" />
android:summary="%s" />
</PreferenceScreen>

View File

@@ -41,8 +41,7 @@
<SwitchPreference
android:key="auto_restore"
android:title="@string/auto_restore_title"
android:summary="@string/auto_restore_summary"
android:persistent="false" />
android:summary="@string/auto_restore_summary" />
<Preference
android:key="backup_inactive"

View File

@@ -19,7 +19,6 @@
<SwitchPreference
android:key="use_screen_lock"
android:title="@string/screen_pinning_unlock_none"
android:persistent="false" />
android:title="@string/screen_pinning_unlock_none" />
</PreferenceScreen>

View File

@@ -37,8 +37,7 @@
android:persistent="false">
<SwitchPreference android:key="show_password"
android:title="@string/show_password"
android:persistent="false"/>
android:title="@string/show_password"/>
</PreferenceCategory>
@@ -55,8 +54,7 @@
<com.android.settingslib.RestrictedSwitchPreference android:key="toggle_install_applications"
android:title="@string/install_applications"
android:summaryOff="@string/install_unknown_applications"
android:summaryOn="@string/install_unknown_applications"
android:persistent="false" />
android:summaryOn="@string/install_unknown_applications" />
</PreferenceCategory>

View File

@@ -26,8 +26,7 @@
android:key="unlock_set_or_change"
android:title="@string/unlock_set_unlock_launch_picker_title"
android:summary="@string/unlock_set_unlock_mode_password"
settings:keywords="@string/keywords_lockscreen"
android:persistent="false"/>
settings:keywords="@string/keywords_lockscreen" />
</PreferenceCategory>

View File

@@ -26,8 +26,7 @@
android:key="unlock_set_or_change"
android:title="@string/unlock_set_unlock_launch_picker_title"
android:summary="@string/unlock_set_unlock_mode_pattern"
settings:keywords="@string/keywords_lockscreen"
android:persistent="false"/>
settings:keywords="@string/keywords_lockscreen" />
</PreferenceCategory>

View File

@@ -26,8 +26,7 @@
android:key="unlock_set_or_change"
android:title="@string/unlock_set_unlock_launch_picker_title"
android:summary="@string/unlock_set_unlock_mode_pin"
settings:keywords="@string/keywords_lockscreen"
android:persistent="false"/>
settings:keywords="@string/keywords_lockscreen" />
</PreferenceCategory>

View File

@@ -21,7 +21,6 @@
<SwitchPreference
android:key="sim_toggle"
android:title="@string/sim_pin_toggle"
android:persistent="false"
android:summaryOn="@string/sim_lock_on"
android:summaryOff="@string/sim_lock_off"/>
@@ -31,7 +30,6 @@
android:title="@string/sim_pin_change"
android:dialogTitle="@string/sim_change_pin"
android:dialogMessage="@string/sim_enter_old"
android:persistent="false"
android:positiveButtonText="@string/sim_enter_ok"
android:negativeButtonText="@string/sim_enter_cancel"/>

View File

@@ -47,14 +47,12 @@
<!-- Also vibrate for calls -->
<SwitchPreference
android:key="vibrate_when_ringing"
android:title="@string/vibrate_when_ringing_title"
android:persistent="false" />
android:title="@string/vibrate_when_ringing_title" />
<!-- Master mono -->
<SwitchPreference
android:key="master_mono"
android:title="@string/master_mono_title"
android:persistent="false"
android:summaryOn="@string/master_mono_on"
android:summaryOff="@string/master_mono_off" />
@@ -71,7 +69,6 @@
android:key="ringtone"
android:title="@string/ringtone_title"
android:dialogTitle="@string/ringtone_title"
android:persistent="false"
android:ringtoneType="ringtone" />
<!-- Default notification ringtone -->
@@ -79,7 +76,6 @@
android:key="notification_ringtone"
android:title="@string/notification_ringtone_title"
android:dialogTitle="@string/notification_ringtone_title"
android:persistent="false"
android:ringtoneType="notification" />
<!-- Default alarm ringtone -->

View File

@@ -18,13 +18,11 @@
<SwitchPreference
android:key="usb_tether_settings"
android:title="@string/usb_tethering_button_text"
android:persistent="false" />
android:title="@string/usb_tethering_button_text" />
<SwitchPreference
android:key="enable_wifi_ap"
android:title="@string/wifi_tether_checkbox_text"
android:persistent="false" />
android:title="@string/wifi_tether_checkbox_text" />
<Preference
android:key="wifi_ap_ssid_and_security"
@@ -33,7 +31,6 @@
<SwitchPreference
android:key="enable_bluetooth_tethering"
android:title="@string/bluetooth_tether_checkbox_text"
android:persistent="false" />
android:title="@string/bluetooth_tether_checkbox_text" />
</PreferenceScreen>

View File

@@ -19,7 +19,6 @@
android:key="tts_default_lang"
android:title="@string/tts_default_lang_title"
android:summary="@string/tts_default_lang_summary"
android:persistent="false"
android:order="100" />
<Preference

View File

@@ -28,7 +28,6 @@
android:key="tts_default_rate"
android:title="@string/tts_default_rate_title"
android:summary="@string/tts_default_rate_summary"
android:persistent="false"
android:defaultValue="50"
android:max="400" />
<SwitchPreference

View File

@@ -19,8 +19,7 @@
<SwitchPreference
android:key="enable_calling"
android:title="@string/user_enable_calling_sms"
android:persistent="false" />
android:title="@string/user_enable_calling_sms" />
<com.android.settingslib.RestrictedPreference
android:key="remove_user"
android:title="@string/user_remove_user"

View File

@@ -26,13 +26,11 @@
<SwitchPreference
android:key="notify_open_networks"
android:title="@string/wifi_notify_open_networks"
android:summary="@string/wifi_notify_open_networks_summary"
android:persistent="false" />
android:summary="@string/wifi_notify_open_networks_summary" />
<ListPreference
android:key="sleep_policy"
android:title="@string/wifi_setting_sleep_policy_title"
android:persistent="false"
android:entries="@array/wifi_sleep_policy_entries"
android:entryValues="@array/wifi_sleep_policy_values" />
@@ -40,14 +38,12 @@
android:key="wifi_assistant"
android:title="@string/wifi_automatically_connect_title"
android:summary="@string/wifi_automatically_connect_summary"
android:dialogTitle="@string/wifi_select_assistant_dialog_title"
android:persistent="false" />
android:dialogTitle="@string/wifi_select_assistant_dialog_title" />
<ListPreference
android:key="frequency_band"
android:title="@string/wifi_setting_frequency_band_title"
android:summary="@string/wifi_setting_frequency_band_summary"
android:persistent="false"
android:entries="@array/wifi_frequency_band_entries"
android:entryValues="@array/wifi_frequency_band_values" />

View File

@@ -21,14 +21,12 @@
<SwitchPreference
android:key="toggle_airplane"
android:title="@string/airplane_mode"
android:persistent="false"
android:disableDependentsState="true" />
<SwitchPreference
android:key="toggle_nfc"
android:title="@string/nfc_quick_toggle_title"
android:summary="@string/nfc_quick_toggle_summary"
android:persistent="false" />
android:summary="@string/nfc_quick_toggle_summary" />
<PreferenceScreen
android:key="wifi_calling_settings"

View File

@@ -28,21 +28,18 @@
<DropDownPreference
android:key="calendar"
android:title="@string/zen_mode_event_rule_calendar"
android:summary="%s"
android:persistent="false" />
android:summary="%s" />
<!-- Where reply is -->
<DropDownPreference
android:key="reply"
android:title="@string/zen_mode_event_rule_reply"
android:summary="%s"
android:persistent="false" />
android:summary="%s" />
<!-- Zen mode -->
<DropDownPreference
android:key="zen_mode"
android:title="@string/zen_mode_settings_title"
android:summary="%s"
android:persistent="false" />
android:summary="%s" />
</PreferenceScreen>

View File

@@ -40,7 +40,6 @@
<DropDownPreference
android:key="zen_mode"
android:summary="%s"
android:title="@string/zen_mode_settings_title"
android:persistent="false" />
android:title="@string/zen_mode_settings_title" />
</PreferenceScreen>

View File

@@ -24,39 +24,33 @@
android:key="alarms"
android:title="@string/zen_mode_alarms"
android:enabled="false"
android:defaultValue="true"
android:persistent="false"/>
android:defaultValue="true"/>
<!-- Reminders -->
<SwitchPreference
android:key="reminders"
android:title="@string/zen_mode_reminders"
android:persistent="false"/>
android:title="@string/zen_mode_reminders"/>
<!-- Events -->
<SwitchPreference
android:key="events"
android:title="@string/zen_mode_events"
android:persistent="false"/>
android:title="@string/zen_mode_events"/>
<!-- Messages -->
<DropDownPreference
android:key="messages"
android:title="@string/zen_mode_messages"
android:summary="%s"
android:persistent="false" />
android:summary="%s" />
<!-- Calls -->
<DropDownPreference
android:key="calls"
android:title="@string/zen_mode_calls"
android:summary="%s"
android:persistent="false" />
android:summary="%s" />
<!-- Repeat callers -->
<SwitchPreference
android:key="repeat_callers"
android:title="@string/zen_mode_repeat_callers"
android:persistent="false"/>
android:title="@string/zen_mode_repeat_callers"/>
</PreferenceScreen>

View File

@@ -37,7 +37,6 @@
android:key="zen_mode"
android:title="@string/zen_mode_settings_title"
android:order="100"
android:summary="%s"
android:persistent="false" />
android:summary="%s" />
</PreferenceScreen>

View File

@@ -20,17 +20,14 @@
<SwitchPreference android:key="peek"
android:title="@string/zen_mode_peek"
android:summary="@string/zen_mode_peek_summary"
android:persistent="false" />
android:summary="@string/zen_mode_peek_summary" />
<SwitchPreference android:key="lights"
android:title="@string/zen_mode_lights"
android:summary="@string/zen_mode_lights_summary"
android:persistent="false" />
android:summary="@string/zen_mode_lights_summary" />
<SwitchPreference android:key="screen_on"
android:title="@string/zen_mode_screen_on"
android:summary="@string/zen_mode_screen_on_summary"
android:persistent="false" />
android:summary="@string/zen_mode_screen_on_summary" />
</PreferenceScreen>

View File

@@ -16,11 +16,11 @@
package com.android.settings;
import com.android.internal.logging.MetricsLogger;
import android.os.Bundle;
import android.support.v14.preference.PreferenceFragment;
import com.android.internal.logging.MetricsLogger;
/**
* Instrumented fragment that logs visibility state.
*/
@@ -44,6 +44,10 @@ public abstract class InstrumentedFragment extends PreferenceFragment {
public static final int DATA_SAVER_SUMMARY = UNDECLARED + 14;
public static final int DATA_USAGE_UNRESTRICTED_ACCESS = UNDECLARED + 15;
// Used for generic logging of Settings Preference Persistence, should not be used
// outside SharedPreferencesLogger.
public static final int ACTION_GENERIC_PACKAGE = UNDECLARED + 16;
/**
* Declare the view of this category.
*

View File

@@ -457,6 +457,21 @@ public class SettingsActivity extends SettingsDrawerActivity
return true;
}
@Override
public SharedPreferences getSharedPreferences(String name, int mode) {
if (name.equals(getPackageName() + "_preferences")) {
String tag = getClass().getName();
if (getIntent() != null && getIntent().hasExtra(EXTRA_SHOW_FRAGMENT)) {
tag = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
}
if (tag.startsWith("com.android.settings.")) {
tag = tag.replace("com.android.settings.", "");
}
return new SharedPreferencesLogger(this, tag);
}
return super.getSharedPreferences(name, mode);
}
private static boolean isShortCutIntent(final Intent intent) {
Set<String> categories = intent.getCategories();
return (categories != null) && categories.contains("com.android.settings.SHORTCUT");

View File

@@ -0,0 +1,191 @@
/*
* Copyright (C) 2016 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.
*/
package com.android.settings;
import com.android.internal.logging.MetricsLogger;
import android.annotation.Nullable;
import android.content.ComponentName;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.Log;
import java.util.Map;
import java.util.Set;
public class SharedPreferencesLogger implements SharedPreferences {
private final String mTag;
private final Context mContext;
public SharedPreferencesLogger(Context context, String tag) {
mContext = context;
mTag = tag;
}
@Override
public Map<String, ?> getAll() {
return null;
}
@Override
public String getString(String key, @Nullable String defValue) {
return defValue;
}
@Override
public Set<String> getStringSet(String key, @Nullable Set<String> defValues) {
return defValues;
}
@Override
public int getInt(String key, int defValue) {
return defValue;
}
@Override
public long getLong(String key, long defValue) {
return defValue;
}
@Override
public float getFloat(String key, float defValue) {
return defValue;
}
@Override
public boolean getBoolean(String key, boolean defValue) {
return defValue;
}
@Override
public boolean contains(String key) {
return false;
}
@Override
public Editor edit() {
return new EditorLogger();
}
@Override
public void registerOnSharedPreferenceChangeListener(
OnSharedPreferenceChangeListener listener) {
}
@Override
public void unregisterOnSharedPreferenceChangeListener(
OnSharedPreferenceChangeListener listener) {
}
private void logValue(String key, String value) {
MetricsLogger.histogram(mContext, mTag + "/" + key + "|" + value, 1);
}
private void logPackageName(String key, String value) {
MetricsLogger.histogram(mContext, mTag + "/" + key, 1);
MetricsLogger.action(mContext, InstrumentedFragment.ACTION_GENERIC_PACKAGE,
mTag + "/" + key + "|" + value);
}
private void safeLogValue(String key, String value) {
new AsyncPackageCheck().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, key, value);
}
private class AsyncPackageCheck extends AsyncTask<String, Void, Void> {
@Override
protected Void doInBackground(String... params) {
String key = params[0];
String value = params[1];
PackageManager pm = mContext.getPackageManager();
try {
// Check if this might be a component.
ComponentName name = ComponentName.unflattenFromString(value);
if (value != null) {
value = name.getPackageName();
}
} catch (Exception e) {
}
try {
pm.getPackageInfo(value, PackageManager.MATCH_UNINSTALLED_PACKAGES);
logPackageName(key, value);
} catch (PackageManager.NameNotFoundException e) {
// Clearly not a package, lets log it.
logValue(key, value);
}
return null;
}
}
public class EditorLogger implements Editor {
@Override
public Editor putString(String key, @Nullable String value) {
safeLogValue(key, value);
return this;
}
@Override
public Editor putStringSet(String key, @Nullable Set<String> values) {
safeLogValue(key, TextUtils.join(",", values));
return this;
}
@Override
public Editor putInt(String key, int value) {
logValue(key, String.valueOf(value));
return this;
}
@Override
public Editor putLong(String key, long value) {
logValue(key, String.valueOf(value));
return this;
}
@Override
public Editor putFloat(String key, float value) {
logValue(key, String.valueOf(value));
return this;
}
@Override
public Editor putBoolean(String key, boolean value) {
logValue(key, String.valueOf(value));
return this;
}
@Override
public Editor remove(String key) {
return this;
}
@Override
public Editor clear() {
return this;
}
@Override
public boolean commit() {
return true;
}
@Override
public void apply() {
}
}
}