incidentd: Updating Settings Provider proto dump.

Handling potential null cases, adding comments, logging new settings,
and dumping historical operations.

Bug: 65750829
Test: flash device and check incident.proto output
Change-Id: I66fe324a91fba136e73761cfb74f3527de75d3ad
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 1bef2b3..58e65d5 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2113,6 +2113,9 @@
      * functions for accessing individual settings entries.
      */
     public static final class System extends NameValueTable {
+        // NOTE: If you add new settings here, be sure to add them to
+        // com.android.providers.settings.SettingsProtoDumpUtil#dumpProtoSystemSettingsLocked.
+
         private static final float DEFAULT_FONT_SCALE = 1.0f;
 
         /** @hide */
@@ -4562,6 +4565,9 @@
      * APIs for those values, not modified directly by applications.
      */
     public static final class Secure extends NameValueTable {
+        // NOTE: If you add new settings here, be sure to add them to
+        // com.android.providers.settings.SettingsProtoDumpUtil#dumpProtoSecureSettingsLocked.
+
         /**
          * The content:// style URL for this table
          */
@@ -7564,6 +7570,9 @@
      * explicitly modify through the system UI or specialized APIs for those values.
      */
     public static final class Global extends NameValueTable {
+        // NOTE: If you add new settings here, be sure to add them to
+        // com.android.providers.settings.SettingsProtoDumpUtil#dumpProtoGlobalSettingsLocked.
+
         /**
          * The content:// style URL for global secure settings items.  Not public.
          */
@@ -10875,7 +10884,7 @@
 
         /** User preferred subscriptions setting.
           * This holds the details of the user selected subscription from the card and
-          * the activation status. Each settings string have the coma separated values
+          * the activation status. Each settings string have the comma separated values
           * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index
           * @hide
          */
diff --git a/core/proto/android/os/incident.proto b/core/proto/android/os/incident.proto
index 55ea285..4c3e937 100644
--- a/core/proto/android/os/incident.proto
+++ b/core/proto/android/os/incident.proto
@@ -20,12 +20,12 @@
 
 import "frameworks/base/libs/incident/proto/android/privacy.proto";
 import "frameworks/base/libs/incident/proto/android/section.proto";
-import "frameworks/base/core/proto/android/providers/settings.proto";
 import "frameworks/base/core/proto/android/os/cpuinfo.proto";
 import "frameworks/base/core/proto/android/os/incidentheader.proto";
 import "frameworks/base/core/proto/android/os/kernelwake.proto";
 import "frameworks/base/core/proto/android/os/pagetypeinfo.proto";
 import "frameworks/base/core/proto/android/os/procrank.proto";
+import "frameworks/base/core/proto/android/providers/settings.proto";
 import "frameworks/base/core/proto/android/server/activitymanagerservice.proto";
 import "frameworks/base/core/proto/android/server/alarmmanagerservice.proto";
 import "frameworks/base/core/proto/android/server/windowmanagerservice.proto";
@@ -86,7 +86,11 @@
         (section).args = "netstats --proto"
     ];
 
-    optional android.providers.settings.SettingsServiceDumpProto settings = 3002;
+    optional android.providers.settings.SettingsServiceDumpProto settings = 3002 [
+        (section).type = SECTION_DUMPSYS,
+        (section).args = "settings --proto"
+    ];
+
     optional android.service.appwidget.AppWidgetServiceDumpProto appwidget = 3003;
     optional android.service.notification.NotificationServiceDumpProto notification = 3004 [
         (section).type = SECTION_DUMPSYS,
diff --git a/core/proto/android/providers/settings.proto b/core/proto/android/providers/settings.proto
index 3411c6a..764288c 100644
--- a/core/proto/android/providers/settings.proto
+++ b/core/proto/android/providers/settings.proto
@@ -39,9 +39,10 @@
     optional SystemSettingsProto system_settings = 3;
 }
 
+// Note: it's a conscious decision to add each setting as a separate field. This
+// allows annotating each setting with its own privacy tag.
 message GlobalSettingsProto {
-    // Historical operations
-    repeated SettingsOperationProto historical_op = 1;
+    repeated SettingsOperationProto historical_operations = 1;
 
     optional SettingProto add_users_when_locked = 2;
     optional SettingProto enable_accessibility_global_gesture_enabled = 3;
@@ -54,6 +55,7 @@
     optional SettingProto radio_nfc = 10;
     optional SettingProto airplane_mode_radios = 11;
     optional SettingProto airplane_mode_toggleable_radios = 12;
+    optional SettingProto bluetooth_class_of_device = 293;
     optional SettingProto bluetooth_disabled_profiles = 13;
     optional SettingProto bluetooth_interoperability_list = 14;
     optional SettingProto wifi_sleep_policy = 15;
@@ -86,6 +88,7 @@
     optional SettingProto data_roaming = 42;
     optional SettingProto mdc_initial_max_retry = 43;
     optional SettingProto force_allow_on_external = 44;
+    optional SettingProto euicc_provisioned = 294;
     optional SettingProto development_force_resizable_activities = 45;
     optional SettingProto development_enable_freeform_windows_support = 46;
     optional SettingProto development_settings_enabled = 47;
@@ -99,6 +102,11 @@
     optional SettingProto hdmi_system_audio_control_enabled = 55;
     optional SettingProto hdmi_control_auto_wakeup_enabled = 56;
     optional SettingProto hdmi_control_auto_device_off_enabled = 57;
+    optional SettingProto location_background_throttle_interval_ms = 295;
+    optional SettingProto location_background_throttle_proximity_alert_interval_ms = 296;
+    optional SettingProto location_background_throttle_package_whitelist = 297;
+    optional SettingProto wifi_scan_background_throttle_interval_ms = 298;
+    optional SettingProto wifi_scan_background_throttle_package_whitelist = 299;
     optional SettingProto mhl_input_switching_enabled = 58;
     optional SettingProto mhl_power_charge_enabled = 59;
     optional SettingProto mobile_data = 60;
@@ -109,6 +117,7 @@
     optional SettingProto netstats_time_cache_max_age = 65;
     optional SettingProto netstats_global_alert_bytes = 66;
     optional SettingProto netstats_sample_enabled = 67;
+    optional SettingProto netstats_augment_enabled = 300;
     optional SettingProto netstats_dev_bucket_duration = 68;
     optional SettingProto netstats_dev_persist_bytes = 69;
     optional SettingProto netstats_dev_rotate_age = 70;
@@ -156,6 +165,7 @@
     optional SettingProto tether_supported = 113;
     optional SettingProto tether_dun_required = 114;
     optional SettingProto tether_dun_apn = 115;
+    optional SettingProto tether_offload_disabled = 301;
     optional SettingProto carrier_app_whitelist = 116;
     optional SettingProto usb_mass_storage_enabled = 117;
     optional SettingProto use_google_mail = 118;
@@ -166,6 +176,9 @@
     optional SettingProto network_switch_notification_daily_limit = 123;
     optional SettingProto network_switch_notification_rate_limit_millis = 124;
     optional SettingProto network_avoid_bad_wifi = 125;
+    optional SettingProto network_metered_multipath_preference = 302;
+    optional SettingProto network_watchlist_last_report_time = 303;
+    optional SettingProto wifi_badging_thresholds = 304;
     optional SettingProto wifi_display_on = 126;
     optional SettingProto wifi_display_certification_on = 127;
     optional SettingProto wifi_display_wps_config = 128;
@@ -179,7 +192,14 @@
     optional SettingProto wifi_on = 136;
     optional SettingProto wifi_scan_always_available = 137;
     optional SettingProto wifi_wakeup_enabled = 138;
+    optional SettingProto wifi_wakeup_available = 305;
+    optional SettingProto network_scoring_ui_enabled = 306;
+    optional SettingProto speed_label_cache_eviction_age_millis = 307;
+    optional SettingProto recommended_network_evaluator_cache_expiry_ms = 308;
     optional SettingProto network_recommendations_enabled = 139;
+    optional SettingProto network_recommendations_package = 286;
+    optional SettingProto use_open_wifi_package = 309;
+    optional SettingProto network_recommendation_request_timeout_ms = 310;
     optional SettingProto ble_scan_always_available = 140;
     optional SettingProto wifi_saved_state = 141;
     optional SettingProto wifi_supplicant_scan_interval_ms = 142;
@@ -219,15 +239,19 @@
     optional SettingProto sys_storage_threshold_percentage = 176;
     optional SettingProto sys_storage_threshold_max_bytes = 177;
     optional SettingProto sys_storage_full_threshold_bytes = 178;
+    optional SettingProto sys_storage_cache_percentage = 311;
+    optional SettingProto sys_storage_cache_max_bytes = 312;
     optional SettingProto sync_max_retry_delay_in_seconds = 179;
     optional SettingProto connectivity_change_delay = 180;
     optional SettingProto connectivity_sampling_interval_in_seconds = 181;
     optional SettingProto pac_change_delay = 182;
     optional SettingProto captive_portal_mode = 183;
+    optional SettingProto captive_portal_detection_enabled = 313;
     optional SettingProto captive_portal_server = 184;
     optional SettingProto captive_portal_https_url = 185;
     optional SettingProto captive_portal_http_url = 186;
     optional SettingProto captive_portal_fallback_url = 187;
+    optional SettingProto captive_portal_other_fallback_urls = 314;
     optional SettingProto captive_portal_use_https = 188;
     optional SettingProto captive_portal_user_agent = 189;
     optional SettingProto nsd_on = 190;
@@ -243,21 +267,33 @@
     optional SettingProto global_http_proxy_pac = 200;
     optional SettingProto set_global_http_proxy = 201;
     optional SettingProto default_dns_server = 202;
+    // The requested Private DNS mode and an accompanying specifier.
+    optional SettingProto private_dns_mode = 315;
+    optional SettingProto private_dns_specifier = 316;
     optional SettingProto bluetooth_headset_priority_prefix = 203;
     optional SettingProto bluetooth_a2dp_sink_priority_prefix = 204;
     optional SettingProto bluetooth_a2dp_src_priority_prefix = 205;
+    optional SettingProto bluetooth_a2dp_supports_optional_codecs_prefix = 287;
+    optional SettingProto bluetooth_a2dp_optional_codecs_enabled_prefix = 288;
     optional SettingProto bluetooth_input_device_priority_prefix = 206;
     optional SettingProto bluetooth_map_priority_prefix = 207;
     optional SettingProto bluetooth_map_client_priority_prefix = 208;
     optional SettingProto bluetooth_pbap_client_priority_prefix = 209;
     optional SettingProto bluetooth_sap_priority_prefix = 210;
     optional SettingProto bluetooth_pan_priority_prefix = 211;
+    optional SettingProto activity_manager_constants = 317;
     optional SettingProto device_idle_constants = 212;
     optional SettingProto device_idle_constants_watch = 213;
+    optional SettingProto battery_saver_constants = 318;
+    optional SettingProto anomaly_detection_constants = 319;
+    optional SettingProto always_on_display_constants = 320;
     optional SettingProto app_idle_constants = 214;
+    optional SettingProto power_manager_constants = 321;
     optional SettingProto alarm_manager_constants = 215;
     optional SettingProto job_scheduler_constants = 216;
     optional SettingProto shortcut_manager_constants = 217;
+    optional SettingProto device_policy_constants = 322;
+    optional SettingProto text_classifier_constants = 323;
     optional SettingProto window_animation_scale = 218;
     optional SettingProto transition_animation_scale = 219;
     optional SettingProto animator_duration_scale = 220;
@@ -287,6 +323,10 @@
     optional SettingProto cert_pin_update_metadata_url = 244;
     optional SettingProto intent_firewall_update_content_url = 245;
     optional SettingProto intent_firewall_update_metadata_url = 246;
+    optional SettingProto lang_id_update_content_url = 324;
+    optional SettingProto lang_id_update_metadata_url = 325;
+    optional SettingProto smart_selection_update_content_url = 326;
+    optional SettingProto smart_selection_update_metadata_url = 327;
     optional SettingProto selinux_status = 247;
     optional SettingProto development_force_rtl = 248;
     optional SettingProto low_battery_sound_timeout = 249;
@@ -308,13 +348,24 @@
     optional SettingProto lte_service_forced = 265;
     optional SettingProto ephemeral_cookie_max_size_bytes = 266;
     optional SettingProto enable_ephemeral_feature = 267;
+    optional SettingProto instant_app_dexopt_enabled = 328;
     optional SettingProto installed_instant_app_min_cache_period = 268;
+    optional SettingProto installed_instant_app_max_cache_period = 289;
+    optional SettingProto uninstalled_instant_app_min_cache_period = 290;
+    optional SettingProto uninstalled_instant_app_max_cache_period = 291;
+    optional SettingProto unused_static_shared_lib_min_cache_period = 292;
     optional SettingProto allow_user_switching_when_system_user_locked = 269;
     optional SettingProto boot_count = 270;
     optional SettingProto safe_boot_disallowed = 271;
     optional SettingProto device_demo_mode = 272;
+    optional SettingProto network_access_timeout_ms = 329;
     optional SettingProto database_downgrade_reason = 274;
+    optional SettingProto database_creation_buildid = 330;
     optional SettingProto contacts_database_wal_enabled = 275;
+    optional SettingProto location_settings_link_to_permissions_enabled = 331;
+    optional SettingProto backup_refactored_service_disabled = 332;
+    optional SettingProto euicc_factory_reset_timeout_millis = 333;
+    optional SettingProto storage_settings_clobber_threshold = 334;
     optional SettingProto multi_sim_voice_call_subscription = 276;
     optional SettingProto multi_sim_voice_prompt = 277;
     optional SettingProto multi_sim_data_call_subscription = 278;
@@ -324,19 +375,20 @@
     optional SettingProto contact_metadata_sync_enabled = 282;
     optional SettingProto enable_cellular_on_boot = 283;
     optional SettingProto max_notification_enqueue_rate = 284;
+    optional SettingProto show_notification_channel_warnings = 335;
     optional SettingProto cell_on = 285;
-    optional SettingProto network_recommendations_package = 286;
-    optional SettingProto bluetooth_a2dp_supports_optional_codecs_prefix = 287;
-    optional SettingProto bluetooth_a2dp_optional_codecs_enabled_prefix = 288;
-    optional SettingProto installed_instant_app_max_cache_period = 289;
-    optional SettingProto uninstalled_instant_app_min_cache_period = 290;
-    optional SettingProto uninstalled_instant_app_max_cache_period = 291;
-    optional SettingProto unused_static_shared_lib_min_cache_period = 292;
+    optional SettingProto show_temperature_warning = 336;
+    optional SettingProto warning_temperature = 337;
+    optional SettingProto enable_diskstats_logging = 338;
+    optional SettingProto enable_cache_quota_calculation = 339;
+    optional SettingProto enable_deletion_helper_no_threshold_toggle = 340;
+    optional SettingProto notification_snooze_options = 341;
+
+    // Next tag = 342;
 }
 
 message SecureSettingsProto {
-    // Historical operations
-    repeated SettingsOperationProto historical_op = 1;
+    repeated SettingsOperationProto historical_operations = 1;
 
     optional SettingProto android_id = 2;
     optional SettingProto default_input_method = 3;
@@ -347,6 +399,10 @@
     optional SettingProto autofill_service = 8;
     optional SettingProto bluetooth_hci_log = 9;
     optional SettingProto user_setup_complete = 10;
+    // Whether the current user has been set up via setup wizard (0 = false,
+    // 1 = true). This value differs from USER_SETUP_COMPLETE in that it can be
+    // reset back to 0 in case SetupWizard has been re-enabled on TV devices.
+    optional SettingProto tv_user_setup_complete = 170;
     optional SettingProto completed_category_prefix = 11;
     optional SettingProto enabled_input_methods = 12;
     optional SettingProto disabled_system_input_methods = 13;
@@ -354,10 +410,12 @@
     optional SettingProto always_on_vpn_app = 15;
     optional SettingProto always_on_vpn_lockdown = 16;
     optional SettingProto install_non_market_apps = 17;
+    optional SettingProto unknown_sources_default_reversed = 171;
     optional SettingProto location_mode = 18;
     optional SettingProto location_previous_mode = 19;
     optional SettingProto lock_to_app_exit_locked = 20;
     optional SettingProto lock_screen_lock_after_timeout = 21;
+    optional SettingProto lock_screen_allow_private_notifications = 172;
     optional SettingProto lock_screen_allow_remote_input = 22;
     optional SettingProto show_note_about_notification_hiding = 23;
     optional SettingProto trust_agents_initialized = 24;
@@ -366,6 +424,11 @@
     optional SettingProto parental_control_redirect_url = 27;
     optional SettingProto settings_classname = 28;
     optional SettingProto accessibility_enabled = 29;
+    optional SettingProto accessibility_shortcut_enabled = 173;
+    optional SettingProto accessibility_shortcut_on_lock_screen = 174;
+    optional SettingProto accessibility_shortcut_dialog_shown = 175;
+    optional SettingProto accessibility_shortcut_target_service = 176;
+    optional SettingProto accessibility_button_target_component = 177;
     optional SettingProto touch_exploration_enabled = 30;
     optional SettingProto enabled_accessibility_services = 31;
     optional SettingProto touch_exploration_granted_accessibility_services = 32;
@@ -375,7 +438,9 @@
     optional SettingProto accessibility_screen_reader_url = 36;
     optional SettingProto accessibility_web_content_key_bindings = 37;
     optional SettingProto accessibility_display_magnification_enabled = 38;
+    optional SettingProto accessibility_display_magnification_navbar_enabled = 178;
     optional SettingProto accessibility_display_magnification_scale = 39;
+    optional SettingProto accessibility_display_magnification_auto_update = 179;
     optional SettingProto accessibility_soft_keyboard_mode = 40;
     optional SettingProto accessibility_captioning_enabled = 41;
     optional SettingProto accessibility_captioning_locale = 42;
@@ -448,6 +513,7 @@
     optional SettingProto doze_enabled = 109;
     optional SettingProto doze_always_on = 110;
     optional SettingProto doze_pulse_on_pick_up = 111;
+    optional SettingProto doze_pulse_on_long_press = 180;
     optional SettingProto doze_pulse_on_double_tap = 112;
     optional SettingProto ui_night_mode = 113;
     optional SettingProto screensaver_enabled = 114;
@@ -470,6 +536,7 @@
     optional SettingProto immersive_mode_confirmations = 131;
     optional SettingProto print_service_search_uri = 132;
     optional SettingProto payment_service_search_uri = 133;
+    optional SettingProto autofill_service_search_uri = 181;
     optional SettingProto skip_first_use_hints = 134;
     optional SettingProto unsafe_volume_music_active_ms = 135;
     optional SettingProto lock_screen_show_notifications = 136;
@@ -482,10 +549,18 @@
     optional SettingProto camera_gesture_disabled = 143;
     optional SettingProto camera_double_tap_power_gesture_disabled = 144;
     optional SettingProto camera_double_twist_to_flip_enabled = 145;
+    optional SettingProto camera_lift_trigger_enabled = 182;
+    optional SettingProto assist_gesture_enabled = 183;
+    optional SettingProto assist_gesture_sensitivity = 184;
+    optional SettingProto assist_gesture_silence_alerts_enabled = 185;
+    optional SettingProto assist_gesture_wake_enabled = 186;
+    optional SettingProto assist_gesture_setup_complete = 187;
     optional SettingProto night_display_activated = 146;
     optional SettingProto night_display_auto_mode = 147;
+    optional SettingProto night_display_color_temperature = 188;
     optional SettingProto night_display_custom_start_time = 148;
     optional SettingProto night_display_custom_end_time = 149;
+    optional SettingProto night_display_last_activated_time = 189;
     optional SettingProto brightness_use_twilight = 150;
     optional SettingProto enabled_vr_listeners = 151;
     optional SettingProto vr_display_mode = 152;
@@ -495,6 +570,7 @@
     optional SettingProto automatic_storage_manager_days_to_retain = 156;
     optional SettingProto automatic_storage_manager_bytes_cleared = 157;
     optional SettingProto automatic_storage_manager_last_run = 158;
+    optional SettingProto automatic_storage_manager_turned_off_by_policy = 190;
     optional SettingProto system_navigation_keys_enabled = 159;
     optional SettingProto downloads_backup_enabled = 160;
     optional SettingProto downloads_backup_allow_metered = 161;
@@ -504,13 +580,18 @@
     optional SettingProto demo_user_setup_complete = 165;
     optional SettingProto instant_apps_enabled = 166;
     optional SettingProto device_paired = 167;
+    optional SettingProto package_verifier_state = 191;
+    optional SettingProto cmas_additional_broadcast_pkg = 192;
     optional SettingProto notification_badging = 168;
+    optional SettingProto qs_auto_added_tiles = 193;
+    optional SettingProto lockdown_in_power_menu = 194;
     optional SettingProto backup_manager_constants = 169;
+
+    // Next tag = 195
 }
 
 message SystemSettingsProto {
-    // Historical operations
-    repeated SettingsOperationProto historical_op = 1;
+    repeated SettingsOperationProto historical_operations = 1;
 
     optional SettingProto end_button_behavior = 2;
     optional SettingProto advanced_settings = 3;
@@ -518,6 +599,7 @@
     optional SettingProto bluetooth_discoverability_timeout = 5;
     optional SettingProto font_scale = 6;
     optional SettingProto system_locales = 7;
+    optional SettingProto display_color_mode = 67;
     optional SettingProto screen_off_timeout = 8;
     optional SettingProto screen_brightness = 9;
     optional SettingProto screen_brightness_for_vr = 10;
@@ -534,8 +616,17 @@
     optional SettingProto volume_alarm = 21;
     optional SettingProto volume_notification = 22;
     optional SettingProto volume_bluetooth_sco = 23;
+    optional SettingProto volume_accessibility = 68;
     optional SettingProto volume_master = 24;
     optional SettingProto master_mono = 25;
+    // Whether silent mode should allow vibration feedback. This is used
+    // internally in AudioService and the Sound settings activity to coordinate
+    // decoupling of vibrate and silent modes. This setting will likely be
+    // removed in a future release with support for audio/vibe feedback
+    // profiles.
+    // Not used anymore. On devices with vibrator, the user explicitly selects
+    // silent or vibrate mode. Kept for use by legacy database upgrade code in
+    // DatabaseHelper.
     optional SettingProto vibrate_in_silent = 26;
     optional SettingProto append_for_last_audible = 27;
     optional SettingProto ringtone = 28;
@@ -566,6 +657,10 @@
     optional SettingProto notification_light_pulse = 53;
     optional SettingProto pointer_location = 54;
     optional SettingProto show_touches = 55;
+    // Log raw orientation data from {@link
+    // com.android.server.policy.WindowOrientationListener} for use with the
+    // orientationplot.py tool.
+    // 0 = no, 1 = yes
     optional SettingProto window_orientation_listener_log = 56;
     optional SettingProto lockscreen_sounds_enabled = 57;
     optional SettingProto lockscreen_disabled = 58;
@@ -576,7 +671,10 @@
     optional SettingProto pointer_speed = 63;
     optional SettingProto lock_to_app_enabled = 64;
     optional SettingProto egg_mode = 65;
+    optional SettingProto show_battery_percent = 69;
     optional SettingProto when_to_make_wifi_calls = 66;
+
+    // Next tag = 70;
 }
 
 message SettingProto {
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index 67fb4d9..41b205b 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -37,9 +37,11 @@
         // Global settings
         SettingsState globalSettings = settingsRegistry.getSettingsLocked(
                 SettingsProvider.SETTINGS_TYPE_GLOBAL, UserHandle.USER_SYSTEM);
-        long globalSettingsToken = proto.start(SettingsServiceDumpProto.GLOBAL_SETTINGS);
-        dumpProtoGlobalSettingsLocked(globalSettings, proto);
-        proto.end(globalSettingsToken);
+        if (globalSettings != null) {
+            long globalSettingsToken = proto.start(SettingsServiceDumpProto.GLOBAL_SETTINGS);
+            dumpProtoGlobalSettingsLocked(globalSettings, proto);
+            proto.end(globalSettingsToken);
+        }
 
         // Per-user settings
         SparseBooleanArray users = settingsRegistry.getKnownUsersLocked();
@@ -67,19 +69,26 @@
 
         SettingsState secureSettings = settingsRegistry.getSettingsLocked(
                 SettingsProvider.SETTINGS_TYPE_SECURE, user.getIdentifier());
-        long secureSettingsToken = proto.start(UserSettingsProto.SECURE_SETTINGS);
-        dumpProtoSecureSettingsLocked(secureSettings, proto);
-        proto.end(secureSettingsToken);
+        if (secureSettings != null) {
+            long secureSettingsToken = proto.start(UserSettingsProto.SECURE_SETTINGS);
+            dumpProtoSecureSettingsLocked(secureSettings, proto);
+            proto.end(secureSettingsToken);
+        }
 
         SettingsState systemSettings = settingsRegistry.getSettingsLocked(
                 SettingsProvider.SETTINGS_TYPE_SYSTEM, user.getIdentifier());
-        long systemSettingsToken = proto.start(UserSettingsProto.SYSTEM_SETTINGS);
-        dumpProtoSystemSettingsLocked(systemSettings, proto);
-        proto.end(systemSettingsToken);
+        if (systemSettings != null) {
+            long systemSettingsToken = proto.start(UserSettingsProto.SYSTEM_SETTINGS);
+            dumpProtoSystemSettingsLocked(systemSettings, proto);
+            proto.end(systemSettingsToken);
+        }
     }
 
     private static void dumpProtoGlobalSettingsLocked(
             @NonNull SettingsState s, @NonNull ProtoOutputStream p) {
+        s.dumpHistoricalOperations(p, GlobalSettingsProto.HISTORICAL_OPERATIONS);
+
+        // This uses the same order as in Settings.Global.
         dumpSetting(s, p,
                 Settings.Global.ADD_USERS_WHEN_LOCKED,
                 GlobalSettingsProto.ADD_USERS_WHEN_LOCKED);
@@ -114,6 +123,9 @@
                 Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS,
                 GlobalSettingsProto.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
         dumpSetting(s, p,
+                Settings.Global.BLUETOOTH_CLASS_OF_DEVICE,
+                GlobalSettingsProto.BLUETOOTH_CLASS_OF_DEVICE);
+        dumpSetting(s, p,
                 Settings.Global.BLUETOOTH_DISABLED_PROFILES,
                 GlobalSettingsProto.BLUETOOTH_DISABLED_PROFILES);
         dumpSetting(s, p,
@@ -194,6 +206,7 @@
         dumpSetting(s, p,
                 Settings.Global.CDMA_SUBSCRIPTION_MODE,
                 GlobalSettingsProto.CDMA_SUBSCRIPTION_MODE);
+        // Settings.Global.DEFAULT_RESTRICT_BACKGROUND_DATA intentionally excluded.
         dumpSetting(s, p,
                 Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE,
                 GlobalSettingsProto.DATA_ACTIVITY_TIMEOUT_MOBILE);
@@ -209,6 +222,10 @@
         dumpSetting(s, p,
                 Settings.Global.FORCE_ALLOW_ON_EXTERNAL,
                 GlobalSettingsProto.FORCE_ALLOW_ON_EXTERNAL);
+        // Settings.Global.DEFAULT_SM_DP_PLUS intentionally excluded.
+        dumpSetting(s, p,
+                Settings.Global.EUICC_PROVISIONED,
+                GlobalSettingsProto.EUICC_PROVISIONED);
         dumpSetting(s, p,
                 Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES,
                 GlobalSettingsProto.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES);
@@ -236,6 +253,7 @@
         dumpSetting(s, p,
                 Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE,
                 GlobalSettingsProto.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
+        // Settings.Global.INSTALL_NON_MARKET_APPS intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Global.HDMI_CONTROL_ENABLED,
                 GlobalSettingsProto.HDMI_CONTROL_ENABLED);
@@ -249,6 +267,21 @@
                 Settings.Global.HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED,
                 GlobalSettingsProto.HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED);
         dumpSetting(s, p,
+                Settings.Global.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS,
+                GlobalSettingsProto.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS);
+        dumpSetting(s, p,
+                Settings.Global.LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS,
+                GlobalSettingsProto.LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS);
+        dumpSetting(s, p,
+                Settings.Global.LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST,
+                GlobalSettingsProto.LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST);
+        dumpSetting(s, p,
+                Settings.Global.WIFI_SCAN_BACKGROUND_THROTTLE_INTERVAL_MS,
+                GlobalSettingsProto.WIFI_SCAN_BACKGROUND_THROTTLE_INTERVAL_MS);
+        dumpSetting(s, p,
+                Settings.Global.WIFI_SCAN_BACKGROUND_THROTTLE_PACKAGE_WHITELIST,
+                GlobalSettingsProto.WIFI_SCAN_BACKGROUND_THROTTLE_PACKAGE_WHITELIST);
+        dumpSetting(s, p,
                 Settings.Global.MHL_INPUT_SWITCHING_ENABLED,
                 GlobalSettingsProto.MHL_INPUT_SWITCHING_ENABLED);
         dumpSetting(s, p,
@@ -279,6 +312,9 @@
                 Settings.Global.NETSTATS_SAMPLE_ENABLED,
                 GlobalSettingsProto.NETSTATS_SAMPLE_ENABLED);
         dumpSetting(s, p,
+                Settings.Global.NETSTATS_AUGMENT_ENABLED,
+                GlobalSettingsProto.NETSTATS_AUGMENT_ENABLED);
+        dumpSetting(s, p,
                 Settings.Global.NETSTATS_DEV_BUCKET_DURATION,
                 GlobalSettingsProto.NETSTATS_DEV_BUCKET_DURATION);
         dumpSetting(s, p,
@@ -420,6 +456,9 @@
                 Settings.Global.TETHER_DUN_APN,
                 GlobalSettingsProto.TETHER_DUN_APN);
         dumpSetting(s, p,
+                Settings.Global.TETHER_OFFLOAD_DISABLED,
+                GlobalSettingsProto.TETHER_OFFLOAD_DISABLED);
+        dumpSetting(s, p,
                 Settings.Global.CARRIER_APP_WHITELIST,
                 GlobalSettingsProto.CARRIER_APP_WHITELIST);
         dumpSetting(s, p,
@@ -450,6 +489,15 @@
                 Settings.Global.NETWORK_AVOID_BAD_WIFI,
                 GlobalSettingsProto.NETWORK_AVOID_BAD_WIFI);
         dumpSetting(s, p,
+                Settings.Global.NETWORK_METERED_MULTIPATH_PREFERENCE,
+                GlobalSettingsProto.NETWORK_METERED_MULTIPATH_PREFERENCE);
+        dumpSetting(s, p,
+                Settings.Global.NETWORK_WATCHLIST_LAST_REPORT_TIME,
+                GlobalSettingsProto.NETWORK_WATCHLIST_LAST_REPORT_TIME);
+        dumpSetting(s, p,
+                Settings.Global.WIFI_BADGING_THRESHOLDS,
+                GlobalSettingsProto.WIFI_BADGING_THRESHOLDS);
+        dumpSetting(s, p,
                 Settings.Global.WIFI_DISPLAY_ON,
                 GlobalSettingsProto.WIFI_DISPLAY_ON);
         dumpSetting(s, p,
@@ -489,12 +537,30 @@
                 Settings.Global.WIFI_WAKEUP_ENABLED,
                 GlobalSettingsProto.WIFI_WAKEUP_ENABLED);
         dumpSetting(s, p,
+                Settings.Global.WIFI_WAKEUP_AVAILABLE,
+                GlobalSettingsProto.WIFI_WAKEUP_AVAILABLE);
+        dumpSetting(s, p,
+                Settings.Global.NETWORK_SCORING_UI_ENABLED,
+                GlobalSettingsProto.NETWORK_SCORING_UI_ENABLED);
+        dumpSetting(s, p,
+                Settings.Global.SPEED_LABEL_CACHE_EVICTION_AGE_MILLIS,
+                GlobalSettingsProto.SPEED_LABEL_CACHE_EVICTION_AGE_MILLIS);
+        dumpSetting(s, p,
                 Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED,
                 GlobalSettingsProto.NETWORK_RECOMMENDATIONS_ENABLED);
         dumpSetting(s, p,
                 Settings.Global.NETWORK_RECOMMENDATIONS_PACKAGE,
                 GlobalSettingsProto.NETWORK_RECOMMENDATIONS_PACKAGE);
         dumpSetting(s, p,
+                Settings.Global.USE_OPEN_WIFI_PACKAGE,
+                GlobalSettingsProto.USE_OPEN_WIFI_PACKAGE);
+        dumpSetting(s, p,
+                Settings.Global.NETWORK_RECOMMENDATION_REQUEST_TIMEOUT_MS,
+                GlobalSettingsProto.NETWORK_RECOMMENDATION_REQUEST_TIMEOUT_MS);
+        dumpSetting(s, p,
+                Settings.Global.RECOMMENDED_NETWORK_EVALUATOR_CACHE_EXPIRY_MS,
+                GlobalSettingsProto.RECOMMENDED_NETWORK_EVALUATOR_CACHE_EXPIRY_MS);
+        dumpSetting(s, p,
                 Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE,
                 GlobalSettingsProto.BLE_SCAN_ALWAYS_AVAILABLE);
         dumpSetting(s, p,
@@ -612,6 +678,12 @@
                 Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES,
                 GlobalSettingsProto.SYS_STORAGE_FULL_THRESHOLD_BYTES);
         dumpSetting(s, p,
+                Settings.Global.SYS_STORAGE_CACHE_PERCENTAGE,
+                GlobalSettingsProto.SYS_STORAGE_CACHE_PERCENTAGE);
+        dumpSetting(s, p,
+                Settings.Global.SYS_STORAGE_CACHE_MAX_BYTES,
+                GlobalSettingsProto.SYS_STORAGE_CACHE_MAX_BYTES);
+        dumpSetting(s, p,
                 Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS,
                 GlobalSettingsProto.SYNC_MAX_RETRY_DELAY_IN_SECONDS);
         dumpSetting(s, p,
@@ -627,6 +699,9 @@
                 Settings.Global.CAPTIVE_PORTAL_MODE,
                 GlobalSettingsProto.CAPTIVE_PORTAL_MODE);
         dumpSetting(s, p,
+                Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED,
+                GlobalSettingsProto.CAPTIVE_PORTAL_DETECTION_ENABLED);
+        dumpSetting(s, p,
                 Settings.Global.CAPTIVE_PORTAL_SERVER,
                 GlobalSettingsProto.CAPTIVE_PORTAL_SERVER);
         dumpSetting(s, p,
@@ -639,6 +714,9 @@
                 Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
                 GlobalSettingsProto.CAPTIVE_PORTAL_FALLBACK_URL);
         dumpSetting(s, p,
+                Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+                GlobalSettingsProto.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS);
+        dumpSetting(s, p,
                 Settings.Global.CAPTIVE_PORTAL_USE_HTTPS,
                 GlobalSettingsProto.CAPTIVE_PORTAL_USE_HTTPS);
         dumpSetting(s, p,
@@ -684,6 +762,12 @@
                 Settings.Global.DEFAULT_DNS_SERVER,
                 GlobalSettingsProto.DEFAULT_DNS_SERVER);
         dumpSetting(s, p,
+                Settings.Global.PRIVATE_DNS_MODE,
+                GlobalSettingsProto.PRIVATE_DNS_MODE);
+        dumpSetting(s, p,
+                Settings.Global.PRIVATE_DNS_SPECIFIER,
+                GlobalSettingsProto.PRIVATE_DNS_SPECIFIER);
+        dumpSetting(s, p,
                 Settings.Global.BLUETOOTH_HEADSET_PRIORITY_PREFIX,
                 GlobalSettingsProto.BLUETOOTH_HEADSET_PRIORITY_PREFIX);
         dumpSetting(s, p,
@@ -717,12 +801,27 @@
                 Settings.Global.BLUETOOTH_PAN_PRIORITY_PREFIX,
                 GlobalSettingsProto.BLUETOOTH_PAN_PRIORITY_PREFIX);
         dumpSetting(s, p,
+                Settings.Global.ACTIVITY_MANAGER_CONSTANTS,
+                GlobalSettingsProto.ACTIVITY_MANAGER_CONSTANTS);
+        dumpSetting(s, p,
                 Settings.Global.DEVICE_IDLE_CONSTANTS,
                 GlobalSettingsProto.DEVICE_IDLE_CONSTANTS);
         dumpSetting(s, p,
+                Settings.Global.BATTERY_SAVER_CONSTANTS,
+                GlobalSettingsProto.BATTERY_SAVER_CONSTANTS);
+        dumpSetting(s, p,
+                Settings.Global.ANOMALY_DETECTION_CONSTANTS,
+                GlobalSettingsProto.ANOMALY_DETECTION_CONSTANTS);
+        dumpSetting(s, p,
+                Settings.Global.ALWAYS_ON_DISPLAY_CONSTANTS,
+                GlobalSettingsProto.ALWAYS_ON_DISPLAY_CONSTANTS);
+        dumpSetting(s, p,
                 Settings.Global.APP_IDLE_CONSTANTS,
                 GlobalSettingsProto.APP_IDLE_CONSTANTS);
         dumpSetting(s, p,
+                Settings.Global.POWER_MANAGER_CONSTANTS,
+                GlobalSettingsProto.POWER_MANAGER_CONSTANTS);
+        dumpSetting(s, p,
                 Settings.Global.ALARM_MANAGER_CONSTANTS,
                 GlobalSettingsProto.ALARM_MANAGER_CONSTANTS);
         dumpSetting(s, p,
@@ -732,6 +831,12 @@
                 Settings.Global.SHORTCUT_MANAGER_CONSTANTS,
                 GlobalSettingsProto.SHORTCUT_MANAGER_CONSTANTS);
         dumpSetting(s, p,
+                Settings.Global.DEVICE_POLICY_CONSTANTS,
+                GlobalSettingsProto.DEVICE_POLICY_CONSTANTS);
+        dumpSetting(s, p,
+                Settings.Global.TEXT_CLASSIFIER_CONSTANTS,
+                GlobalSettingsProto.TEXT_CLASSIFIER_CONSTANTS);
+        dumpSetting(s, p,
                 Settings.Global.WINDOW_ANIMATION_SCALE,
                 GlobalSettingsProto.WINDOW_ANIMATION_SCALE);
         dumpSetting(s, p,
@@ -764,6 +869,7 @@
         dumpSetting(s, p,
                 Settings.Global.WAIT_FOR_DEBUGGER,
                 GlobalSettingsProto.WAIT_FOR_DEBUGGER);
+        // Settings.Global.SHOW_PROCESSES intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Global.LOW_POWER_MODE,
                 GlobalSettingsProto.LOW_POWER_MODE);
@@ -819,6 +925,18 @@
                 Settings.Global.INTENT_FIREWALL_UPDATE_METADATA_URL,
                 GlobalSettingsProto.INTENT_FIREWALL_UPDATE_METADATA_URL);
         dumpSetting(s, p,
+                Settings.Global.LANG_ID_UPDATE_CONTENT_URL,
+                GlobalSettingsProto.LANG_ID_UPDATE_CONTENT_URL);
+        dumpSetting(s, p,
+                Settings.Global.LANG_ID_UPDATE_METADATA_URL,
+                GlobalSettingsProto.LANG_ID_UPDATE_METADATA_URL);
+        dumpSetting(s, p,
+                Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL,
+                GlobalSettingsProto.SMART_SELECTION_UPDATE_CONTENT_URL);
+        dumpSetting(s, p,
+                Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL,
+                GlobalSettingsProto.SMART_SELECTION_UPDATE_METADATA_URL);
+        dumpSetting(s, p,
                 Settings.Global.SELINUX_STATUS,
                 GlobalSettingsProto.SELINUX_STATUS);
         dumpSetting(s, p,
@@ -882,11 +1000,8 @@
                 Settings.Global.ENABLE_EPHEMERAL_FEATURE,
                 GlobalSettingsProto.ENABLE_EPHEMERAL_FEATURE);
         dumpSetting(s, p,
-                Settings.Global.UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD,
-                GlobalSettingsProto.UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD);
-        dumpSetting(s, p,
-                Settings.Global.UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD,
-                GlobalSettingsProto.UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD);
+                Settings.Global.INSTANT_APP_DEXOPT_ENABLED,
+                GlobalSettingsProto.INSTANT_APP_DEXOPT_ENABLED);
         dumpSetting(s, p,
                 Settings.Global.INSTALLED_INSTANT_APP_MIN_CACHE_PERIOD,
                 GlobalSettingsProto.INSTALLED_INSTANT_APP_MIN_CACHE_PERIOD);
@@ -894,6 +1009,12 @@
                 Settings.Global.INSTALLED_INSTANT_APP_MAX_CACHE_PERIOD,
                 GlobalSettingsProto.INSTALLED_INSTANT_APP_MAX_CACHE_PERIOD);
         dumpSetting(s, p,
+                Settings.Global.UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD,
+                GlobalSettingsProto.UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD);
+        dumpSetting(s, p,
+                Settings.Global.UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD,
+                GlobalSettingsProto.UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD);
+        dumpSetting(s, p,
                 Settings.Global.UNUSED_STATIC_SHARED_LIB_MIN_CACHE_PERIOD,
                 GlobalSettingsProto.UNUSED_STATIC_SHARED_LIB_MIN_CACHE_PERIOD);
         dumpSetting(s, p,
@@ -909,12 +1030,30 @@
                 Settings.Global.DEVICE_DEMO_MODE,
                 GlobalSettingsProto.DEVICE_DEMO_MODE);
         dumpSetting(s, p,
+                Settings.Global.NETWORK_ACCESS_TIMEOUT_MS,
+                GlobalSettingsProto.NETWORK_ACCESS_TIMEOUT_MS);
+        dumpSetting(s, p,
                 Settings.Global.DATABASE_DOWNGRADE_REASON,
                 GlobalSettingsProto.DATABASE_DOWNGRADE_REASON);
         dumpSetting(s, p,
+                Settings.Global.DATABASE_CREATION_BUILDID,
+                GlobalSettingsProto.DATABASE_CREATION_BUILDID);
+        dumpSetting(s, p,
                 Settings.Global.CONTACTS_DATABASE_WAL_ENABLED,
                 GlobalSettingsProto.CONTACTS_DATABASE_WAL_ENABLED);
         dumpSetting(s, p,
+                Settings.Global.LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED,
+                GlobalSettingsProto.LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED);
+        dumpSetting(s, p,
+                Settings.Global.BACKUP_REFACTORED_SERVICE_DISABLED,
+                GlobalSettingsProto.BACKUP_REFACTORED_SERVICE_DISABLED);
+        dumpSetting(s, p,
+                Settings.Global.EUICC_FACTORY_RESET_TIMEOUT_MILLIS,
+                GlobalSettingsProto.EUICC_FACTORY_RESET_TIMEOUT_MILLIS);
+        dumpSetting(s, p,
+                Settings.Global.STORAGE_SETTINGS_CLOBBER_THRESHOLD,
+                GlobalSettingsProto.STORAGE_SETTINGS_CLOBBER_THRESHOLD);
+        dumpSetting(s, p,
                 Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION,
                 GlobalSettingsProto.MULTI_SIM_VOICE_CALL_SUBSCRIPTION);
         dumpSetting(s, p,
@@ -932,6 +1071,7 @@
         dumpSetting(s, p,
                 Settings.Global.NEW_CONTACT_AGGREGATOR,
                 GlobalSettingsProto.NEW_CONTACT_AGGREGATOR);
+        // Settings.Global.CONTACT_METADATA_SYNC intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Global.CONTACT_METADATA_SYNC_ENABLED,
                 GlobalSettingsProto.CONTACT_METADATA_SYNC_ENABLED);
@@ -942,8 +1082,31 @@
                 Settings.Global.MAX_NOTIFICATION_ENQUEUE_RATE,
                 GlobalSettingsProto.MAX_NOTIFICATION_ENQUEUE_RATE);
         dumpSetting(s, p,
+                Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS,
+                GlobalSettingsProto.SHOW_NOTIFICATION_CHANNEL_WARNINGS);
+        dumpSetting(s, p,
                 Settings.Global.CELL_ON,
                 GlobalSettingsProto.CELL_ON);
+        dumpSetting(s, p,
+                Settings.Global.SHOW_TEMPERATURE_WARNING,
+                GlobalSettingsProto.SHOW_TEMPERATURE_WARNING);
+        dumpSetting(s, p,
+                Settings.Global.WARNING_TEMPERATURE,
+                GlobalSettingsProto.WARNING_TEMPERATURE);
+        dumpSetting(s, p,
+                Settings.Global.ENABLE_DISKSTATS_LOGGING,
+                GlobalSettingsProto.ENABLE_DISKSTATS_LOGGING);
+        dumpSetting(s, p,
+                Settings.Global.ENABLE_CACHE_QUOTA_CALCULATION,
+                GlobalSettingsProto.ENABLE_CACHE_QUOTA_CALCULATION);
+        dumpSetting(s, p,
+                Settings.Global.ENABLE_DELETION_HELPER_NO_THRESHOLD_TOGGLE,
+                GlobalSettingsProto.ENABLE_DELETION_HELPER_NO_THRESHOLD_TOGGLE);
+        // The list of snooze options for notifications. This is encoded as a key=value list,
+        // separated by commas.
+        dumpSetting(s, p,
+                Settings.Global.NOTIFICATION_SNOOZE_OPTIONS,
+                GlobalSettingsProto.NOTIFICATION_SNOOZE_OPTIONS);
     }
 
     /** Dump a single {@link SettingsState.Setting} to a proto buf */
@@ -966,9 +1129,19 @@
 
     static void dumpProtoSecureSettingsLocked(
             @NonNull SettingsState s, @NonNull ProtoOutputStream p) {
+        s.dumpHistoricalOperations(p, SecureSettingsProto.HISTORICAL_OPERATIONS);
+
+        // This uses the same order as in Settings.Secure.
+
+        // Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED intentionally excluded since it's deprecated.
+        // Settings.Secure.BUGREPORT_IN_POWER_MENU intentionally excluded since it's deprecated.
+        // Settings.Secure.ADB_ENABLED intentionally excluded since it's deprecated.
+        // Settings.Secure.ALLOW_MOCK_LOCATION intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.ANDROID_ID,
                 SecureSettingsProto.ANDROID_ID);
+        // Settings.Secure.BLUETOOTH_ON intentionally excluded since it's deprecated.
+        // Settings.Secure.DATA_ROAMING intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.DEFAULT_INPUT_METHOD,
                 SecureSettingsProto.DEFAULT_INPUT_METHOD);
@@ -987,9 +1160,16 @@
         dumpSetting(s, p,
                 Settings.Secure.AUTOFILL_SERVICE,
                 SecureSettingsProto.AUTOFILL_SERVICE);
+        // Settings.Secure.DEVICE_PROVISIONED intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.USER_SETUP_COMPLETE,
                 SecureSettingsProto.USER_SETUP_COMPLETE);
+        // Whether the current user has been set up via setup wizard (0 = false, 1 = true). This
+        // value differs from USER_SETUP_COMPLETE in that it can be reset back to 0 in case
+        // SetupWizard has been re-enabled on TV devices.
+        dumpSetting(s, p,
+                Settings.Secure.TV_USER_SETUP_COMPLETE,
+                SecureSettingsProto.TV_USER_SETUP_COMPLETE);
         dumpSetting(s, p,
                 Settings.Secure.COMPLETED_CATEGORY_PREFIX,
                 SecureSettingsProto.COMPLETED_CATEGORY_PREFIX);
@@ -1002,6 +1182,7 @@
         dumpSetting(s, p,
                 Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD,
                 SecureSettingsProto.SHOW_IME_WITH_HARD_KEYBOARD);
+        // Settings.Secure.HTTP_PROXY intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.ALWAYS_ON_VPN_APP,
                 SecureSettingsProto.ALWAYS_ON_VPN_APP);
@@ -1012,17 +1193,33 @@
                 Settings.Secure.INSTALL_NON_MARKET_APPS,
                 SecureSettingsProto.INSTALL_NON_MARKET_APPS);
         dumpSetting(s, p,
+                Settings.Secure.UNKNOWN_SOURCES_DEFAULT_REVERSED,
+                SecureSettingsProto.UNKNOWN_SOURCES_DEFAULT_REVERSED);
+        // Settings.Secure.LOCATION_PROVIDERS_ALLOWED intentionally excluded since it's deprecated.
+        dumpSetting(s, p,
                 Settings.Secure.LOCATION_MODE,
                 SecureSettingsProto.LOCATION_MODE);
         dumpSetting(s, p,
                 Settings.Secure.LOCATION_PREVIOUS_MODE,
                 SecureSettingsProto.LOCATION_PREVIOUS_MODE);
+        // Settings.Secure.LOCK_BIOMETRIC_WEAK_FLAGS intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.LOCK_TO_APP_EXIT_LOCKED,
                 SecureSettingsProto.LOCK_TO_APP_EXIT_LOCKED);
+        // Settings.Secure.LOCK_PATTERN_ENABLED intentionally excluded since it's deprecated.
+        // Settings.Secure.LOCK_PATTERN_VISIBLE intentionally excluded since it's deprecated.
+        // Settings.Secure.LOCK_PATTERN_TACTICLE_FEEDBACK_ENABLED intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
                 SecureSettingsProto.LOCK_SCREEN_LOCK_AFTER_TIMEOUT);
+        // Settings.Secure.LOCK_SCREEN_OWNER_INFO intentionally excluded since it's deprecated.
+        // Settings.Secure.LOCK_SCREEN_APPWIDGET_IDS intentionally excluded since it's deprecated.
+        // Settings.Secure.LOCK_SCREEN_FALLBACK_APPWIDGET_ID intentionally excluded since it's deprecated.
+        // Settings.Secure.LOCK_SCREEN_STICKY_APPWIDGET intentionally excluded since it's deprecated.
+        // Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED intentionally excluded since it's deprecated.
+        dumpSetting(s, p,
+                Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
+                SecureSettingsProto.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS);
         dumpSetting(s, p,
                 Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT,
                 SecureSettingsProto.LOCK_SCREEN_ALLOW_REMOTE_INPUT);
@@ -1032,6 +1229,8 @@
         dumpSetting(s, p,
                 Settings.Secure.TRUST_AGENTS_INITIALIZED,
                 SecureSettingsProto.TRUST_AGENTS_INITIALIZED);
+        // Settings.Secure.LOGGING_ID intentionally excluded since it's deprecated.
+        // Settings.Secure.NETWORK_PREFERENCE intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.PARENTAL_CONTROL_ENABLED,
                 SecureSettingsProto.PARENTAL_CONTROL_ENABLED);
@@ -1044,10 +1243,27 @@
         dumpSetting(s, p,
                 Settings.Secure.SETTINGS_CLASSNAME,
                 SecureSettingsProto.SETTINGS_CLASSNAME);
+        // Settings.Secure.USB_MASS_STORAGE_ENABLED intentionally excluded since it's deprecated.
+        // Settings.Secure.USE_GOOGLE_MAIL intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.ACCESSIBILITY_ENABLED,
                 SecureSettingsProto.ACCESSIBILITY_ENABLED);
         dumpSetting(s, p,
+                Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED,
+                SecureSettingsProto.ACCESSIBILITY_SHORTCUT_ENABLED);
+        dumpSetting(s, p,
+                Settings.Secure.ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN,
+                SecureSettingsProto.ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN);
+        dumpSetting(s, p,
+                Settings.Secure.ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN,
+                SecureSettingsProto.ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN);
+        dumpSetting(s, p,
+                Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE,
+                SecureSettingsProto.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
+        dumpSetting(s, p,
+                Settings.Secure.ACCESSIBILITY_BUTTON_TARGET_COMPONENT,
+                SecureSettingsProto.ACCESSIBILITY_BUTTON_TARGET_COMPONENT);
+        dumpSetting(s, p,
                 Settings.Secure.TOUCH_EXPLORATION_ENABLED,
                 SecureSettingsProto.TOUCH_EXPLORATION_ENABLED);
         dumpSetting(s, p,
@@ -1066,9 +1282,15 @@
                 Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
                 SecureSettingsProto.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED);
         dumpSetting(s, p,
+                Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED,
+                SecureSettingsProto.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED);
+        dumpSetting(s, p,
                 Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
                 SecureSettingsProto.ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE);
         dumpSetting(s, p,
+                Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE,
+                SecureSettingsProto.ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE);
+        dumpSetting(s, p,
                 Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE,
                 SecureSettingsProto.ACCESSIBILITY_SOFT_KEYBOARD_MODE);
         dumpSetting(s, p,
@@ -1134,6 +1356,7 @@
         dumpSetting(s, p,
                 Settings.Secure.DISPLAY_DENSITY_FORCED,
                 SecureSettingsProto.DISPLAY_DENSITY_FORCED);
+        // Settings.Secure.TTS_USE_DEFAULTS intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.TTS_DEFAULT_RATE,
                 SecureSettingsProto.TTS_DEFAULT_RATE);
@@ -1143,15 +1366,37 @@
         dumpSetting(s, p,
                 Settings.Secure.TTS_DEFAULT_SYNTH,
                 SecureSettingsProto.TTS_DEFAULT_SYNTH);
+        // Settings.Secure.TTS_DEFAULT_LANG intentionally excluded since it's deprecated.
+        // Settings.Secure.TTS_DEFAULT_COUNTRY intentionally excluded since it's deprecated.
+        // Settings.Secure.TTS_DEFAULT_VARIANT intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.TTS_DEFAULT_LOCALE,
                 SecureSettingsProto.TTS_DEFAULT_LOCALE);
         dumpSetting(s, p,
                 Settings.Secure.TTS_ENABLED_PLUGINS,
                 SecureSettingsProto.TTS_ENABLED_PLUGINS);
+        // Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_NUM_OPEN_NETWORKS_KEPT intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_ON intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_AP_COUNT intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_MAX_AP_CHECKS intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_ON intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_WATCH_LIST intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_PING_COUNT intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_PING_DELAY_MS intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_MAX_DHCP_RETRY_COUNT intentionally excluded since it's deprecated.
+        // Settings.Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS,
                 SecureSettingsProto.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS);
+        // Settings.Secure.BACKGROUND_DATA intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.ALLOWED_GEOLOCATION_ORIGINS,
                 SecureSettingsProto.ALLOWED_GEOLOCATION_ORIGINS);
@@ -1179,6 +1424,7 @@
         dumpSetting(s, p,
                 Settings.Secure.LAST_SETUP_SHOWN,
                 SecureSettingsProto.LAST_SETUP_SHOWN);
+        // Settings.Secure.WIFI_IDLE_MS intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.Secure.SEARCH_GLOBAL_SEARCH_ACTIVITY,
                 SecureSettingsProto.SEARCH_GLOBAL_SEARCH_ACTIVITY);
@@ -1285,6 +1531,9 @@
                 Settings.Secure.DOZE_PULSE_ON_PICK_UP,
                 SecureSettingsProto.DOZE_PULSE_ON_PICK_UP);
         dumpSetting(s, p,
+                Settings.Secure.DOZE_PULSE_ON_LONG_PRESS,
+                SecureSettingsProto.DOZE_PULSE_ON_LONG_PRESS);
+        dumpSetting(s, p,
                 Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP,
                 SecureSettingsProto.DOZE_PULSE_ON_DOUBLE_TAP);
         dumpSetting(s, p,
@@ -1351,6 +1600,9 @@
                 Settings.Secure.PAYMENT_SERVICE_SEARCH_URI,
                 SecureSettingsProto.PAYMENT_SERVICE_SEARCH_URI);
         dumpSetting(s, p,
+                Settings.Secure.AUTOFILL_SERVICE_SEARCH_URI,
+                SecureSettingsProto.AUTOFILL_SERVICE_SEARCH_URI);
+        dumpSetting(s, p,
                 Settings.Secure.SKIP_FIRST_USE_HINTS,
                 SecureSettingsProto.SKIP_FIRST_USE_HINTS);
         dumpSetting(s, p,
@@ -1387,18 +1639,42 @@
                 Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED,
                 SecureSettingsProto.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED);
         dumpSetting(s, p,
+                Settings.Secure.CAMERA_LIFT_TRIGGER_ENABLED,
+                SecureSettingsProto.CAMERA_LIFT_TRIGGER_ENABLED);
+        dumpSetting(s, p,
+                Settings.Secure.ASSIST_GESTURE_ENABLED,
+                SecureSettingsProto.ASSIST_GESTURE_ENABLED);
+        dumpSetting(s, p,
+                Settings.Secure.ASSIST_GESTURE_SENSITIVITY,
+                SecureSettingsProto.ASSIST_GESTURE_SENSITIVITY);
+        dumpSetting(s, p,
+                Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED,
+                SecureSettingsProto.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED);
+        dumpSetting(s, p,
+                Settings.Secure.ASSIST_GESTURE_WAKE_ENABLED,
+                SecureSettingsProto.ASSIST_GESTURE_WAKE_ENABLED);
+        dumpSetting(s, p,
+                Settings.Secure.ASSIST_GESTURE_SETUP_COMPLETE,
+                SecureSettingsProto.ASSIST_GESTURE_SETUP_COMPLETE);
+        dumpSetting(s, p,
                 Settings.Secure.NIGHT_DISPLAY_ACTIVATED,
                 SecureSettingsProto.NIGHT_DISPLAY_ACTIVATED);
         dumpSetting(s, p,
                 Settings.Secure.NIGHT_DISPLAY_AUTO_MODE,
                 SecureSettingsProto.NIGHT_DISPLAY_AUTO_MODE);
         dumpSetting(s, p,
+                Settings.Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE,
+                SecureSettingsProto.NIGHT_DISPLAY_COLOR_TEMPERATURE);
+        dumpSetting(s, p,
                 Settings.Secure.NIGHT_DISPLAY_CUSTOM_START_TIME,
                 SecureSettingsProto.NIGHT_DISPLAY_CUSTOM_START_TIME);
         dumpSetting(s, p,
                 Settings.Secure.NIGHT_DISPLAY_CUSTOM_END_TIME,
                 SecureSettingsProto.NIGHT_DISPLAY_CUSTOM_END_TIME);
         dumpSetting(s, p,
+                Settings.Secure.NIGHT_DISPLAY_LAST_ACTIVATED_TIME,
+                SecureSettingsProto.NIGHT_DISPLAY_LAST_ACTIVATED_TIME);
+        dumpSetting(s, p,
                 Settings.Secure.ENABLED_VR_LISTENERS,
                 SecureSettingsProto.ENABLED_VR_LISTENERS);
         dumpSetting(s, p,
@@ -1423,6 +1699,9 @@
                 Settings.Secure.AUTOMATIC_STORAGE_MANAGER_LAST_RUN,
                 SecureSettingsProto.AUTOMATIC_STORAGE_MANAGER_LAST_RUN);
         dumpSetting(s, p,
+                Settings.Secure.AUTOMATIC_STORAGE_MANAGER_TURNED_OFF_BY_POLICY,
+                SecureSettingsProto.AUTOMATIC_STORAGE_MANAGER_TURNED_OFF_BY_POLICY);
+        dumpSetting(s, p,
                 Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED,
                 SecureSettingsProto.SYSTEM_NAVIGATION_KEYS_ENABLED);
         dumpSetting(s, p,
@@ -1438,33 +1717,76 @@
                 Settings.Secure.DEVICE_PAIRED,
                 SecureSettingsProto.DEVICE_PAIRED);
         dumpSetting(s, p,
+                Settings.Secure.PACKAGE_VERIFIER_STATE,
+                SecureSettingsProto.PACKAGE_VERIFIER_STATE);
+        dumpSetting(s, p,
+                Settings.Secure.CMAS_ADDITIONAL_BROADCAST_PKG,
+                SecureSettingsProto.CMAS_ADDITIONAL_BROADCAST_PKG);
+        dumpSetting(s, p,
                 Settings.Secure.NOTIFICATION_BADGING,
                 SecureSettingsProto.NOTIFICATION_BADGING);
         dumpSetting(s, p,
+                Settings.Secure.QS_AUTO_ADDED_TILES,
+                SecureSettingsProto.QS_AUTO_ADDED_TILES);
+        dumpSetting(s, p,
+                Settings.Secure.LOCKDOWN_IN_POWER_MENU,
+                SecureSettingsProto.LOCKDOWN_IN_POWER_MENU);
+        dumpSetting(s, p,
                 Settings.Secure.BACKUP_MANAGER_CONSTANTS,
                 SecureSettingsProto.BACKUP_MANAGER_CONSTANTS);
     }
 
     private static void dumpProtoSystemSettingsLocked(
             @NonNull SettingsState s, @NonNull ProtoOutputStream p) {
+        s.dumpHistoricalOperations(p, SystemSettingsProto.HISTORICAL_OPERATIONS);
+
+        // This uses the same order as in Settings.System.
+
+        // Settings.System.STAY_ON_WHILE_PLUGGED_IN intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.END_BUTTON_BEHAVIOR,
                 SystemSettingsProto.END_BUTTON_BEHAVIOR);
         dumpSetting(s, p,
                 Settings.System.ADVANCED_SETTINGS,
                 SystemSettingsProto.ADVANCED_SETTINGS);
+        // Settings.System.AIRPLANE_MODE_ON intentionally excluded since it's deprecated.
+        // Settings.System.RADIO_BLUETOOTH intentionally excluded since it's deprecated.
+        // Settings.System.RADIO_WIFI intentionally excluded since it's deprecated.
+        // Settings.System.RADIO_WIMAX intentionally excluded since it's deprecated.
+        // Settings.System.RADIO_CELL intentionally excluded since it's deprecated.
+        // Settings.System.RADIO_NFC intentionally excluded since it's deprecated.
+        // Settings.System.AIRPLANE_MODE_RADIOS intentionally excluded since it's deprecated.
+        // Settings.System.AIRPLANE_MODE_TOGGLABLE_RADIOS intentionally excluded since it's deprecated.
+        // Settings.System.WIFI_SLEEP_POLICY intentionally excluded since it's deprecated.
+        // Settings.System.MODE_RINGER intentionally excluded since it's deprecated.
+        // Settings.System.WIFI_USE_STATIC_IP intentionally excluded since it's deprecated.
+        // Settings.System.WIFI_STATIC_IP intentionally excluded since it's deprecated.
+        // Settings.System.WIFI_STATIC_GATEWAY intentionally excluded since it's deprecated.
+        // Settings.System.WIFI_STATIC_NETMASK intentionally excluded since it's deprecated.
+        // Settings.System.WIFI_STATIC_DNS1 intentionally excluded since it's deprecated.
+        // Settings.System.WIFI_STATIC_DNS2 intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.BLUETOOTH_DISCOVERABILITY,
                 SystemSettingsProto.BLUETOOTH_DISCOVERABILITY);
         dumpSetting(s, p,
                 Settings.System.BLUETOOTH_DISCOVERABILITY_TIMEOUT,
                 SystemSettingsProto.BLUETOOTH_DISCOVERABILITY_TIMEOUT);
+        // Settings.System.LOCK_PATTERN_ENABLED intentionally excluded since it's deprecated.
+        // Settings.System.LOCK_PATTERN_VISIBLE intentionally excluded since it's deprecated.
+        // Settings.System.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED intentionally excluded since it's deprecated.
+        // Settings.System.NEXT_ALARM_FORMATTED intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.FONT_SCALE,
                 SystemSettingsProto.FONT_SCALE);
         dumpSetting(s, p,
                 Settings.System.SYSTEM_LOCALES,
                 SystemSettingsProto.SYSTEM_LOCALES);
+        // Settings.System.DEBUG_APP intentionally excluded since it's deprecated.
+        // Settings.System.WAIT_FOR_DEBUGGER intentionally excluded since it's deprecated.
+        // Settings.System.DIM_SCREEN intentionally excluded since it's deprecated.
+        dumpSetting(s, p,
+                Settings.System.DISPLAY_COLOR_MODE,
+                SystemSettingsProto.DISPLAY_COLOR_MODE);
         dumpSetting(s, p,
                 Settings.System.SCREEN_OFF_TIMEOUT,
                 SystemSettingsProto.SCREEN_OFF_TIMEOUT);
@@ -1480,6 +1802,8 @@
         dumpSetting(s, p,
                 Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ,
                 SystemSettingsProto.SCREEN_AUTO_BRIGHTNESS_ADJ);
+        // Settings.System.SHOW_PROCESSES intentionally excluded since it's deprecated.
+        // Settings.System.ALWAYS_FINISH_ACTIVITIES intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.MODE_RINGER_STREAMS_AFFECTED,
                 SystemSettingsProto.MODE_RINGER_STREAMS_AFFECTED);
@@ -1514,11 +1838,15 @@
                 Settings.System.VOLUME_BLUETOOTH_SCO,
                 SystemSettingsProto.VOLUME_BLUETOOTH_SCO);
         dumpSetting(s, p,
+                Settings.System.VOLUME_ACCESSIBILITY,
+                SystemSettingsProto.VOLUME_ACCESSIBILITY);
+        dumpSetting(s, p,
                 Settings.System.VOLUME_MASTER,
                 SystemSettingsProto.VOLUME_MASTER);
         dumpSetting(s, p,
                 Settings.System.MASTER_MONO,
                 SystemSettingsProto.MASTER_MONO);
+        // Settings.System.NOTIFICATIONS_USE_RING_VOLUME intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.VIBRATE_IN_SILENT,
                 SystemSettingsProto.VIBRATE_IN_SILENT);
@@ -1561,6 +1889,9 @@
         dumpSetting(s, p,
                 Settings.System.SHOW_GTALK_SERVICE_STATUS,
                 SystemSettingsProto.SHOW_GTALK_SERVICE_STATUS);
+        // Settings.System.WALLPAPER_ACTIVITY intentionally excluded since it's deprecated.
+        // Settings.System.AUTO_TIME intentionally excluded since it's deprecated.
+        // Settings.System.AUTO_TIME_ZONE intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.TIME_12_24,
                 SystemSettingsProto.TIME_12_24);
@@ -1570,6 +1901,9 @@
         dumpSetting(s, p,
                 Settings.System.SETUP_WIZARD_HAS_RUN,
                 SystemSettingsProto.SETUP_WIZARD_HAS_RUN);
+        // Settings.System.WINDOW_ANIMATION_SCALE intentionally excluded since it's deprecated.
+        // Settings.System.TRANSITION_ANIMATION_SCALE intentionally excluded since it's deprecated.
+        // Settings.System.ANIMATOR_ANIMATION_SCALE intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.ACCELEROMETER_ROTATION,
                 SystemSettingsProto.ACCELEROMETER_ROTATION);
@@ -1600,6 +1934,7 @@
         dumpSetting(s, p,
                 Settings.System.HAPTIC_FEEDBACK_ENABLED,
                 SystemSettingsProto.HAPTIC_FEEDBACK_ENABLED);
+        // Settings.System.SHOW_WEB_SUGGESTIONS intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.NOTIFICATION_LIGHT_PULSE,
                 SystemSettingsProto.NOTIFICATION_LIGHT_PULSE);
@@ -1612,12 +1947,21 @@
         dumpSetting(s, p,
                 Settings.System.WINDOW_ORIENTATION_LISTENER_LOG,
                 SystemSettingsProto.WINDOW_ORIENTATION_LISTENER_LOG);
+        // Settings.System.POWER_SOUNDS_ENABLED intentionally excluded since it's deprecated.
+        // Settings.System.DOCK_SOUNDS_ENABLED intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.LOCKSCREEN_SOUNDS_ENABLED,
                 SystemSettingsProto.LOCKSCREEN_SOUNDS_ENABLED);
         dumpSetting(s, p,
                 Settings.System.LOCKSCREEN_DISABLED,
                 SystemSettingsProto.LOCKSCREEN_DISABLED);
+        // Settings.System.LOW_BATTERY_SOUND intentionally excluded since it's deprecated.
+        // Settings.System.DESK_DOCK_SOUND intentionally excluded since it's deprecated.
+        // Settings.System.DESK_UNDOCK_SOUND intentionally excluded since it's deprecated.
+        // Settings.System.CAR_DOCK_SOUND intentionally excluded since it's deprecated.
+        // Settings.System.CAR_UNDOCK_SOUND intentionally excluded since it's deprecated.
+        // Settings.System.LOCK_SOUND intentionally excluded since it's deprecated.
+        // Settings.System.UNLOCK_SOUND intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.SIP_RECEIVE_CALLS,
                 SystemSettingsProto.SIP_RECEIVE_CALLS);
@@ -1630,6 +1974,7 @@
         dumpSetting(s, p,
                 Settings.System.SIP_ADDRESS_ONLY,
                 SystemSettingsProto.SIP_ADDRESS_ONLY);
+        // Settings.System.SIP_ASK_ME_EACH_TIME intentionally excluded since it's deprecated.
         dumpSetting(s, p,
                 Settings.System.POINTER_SPEED,
                 SystemSettingsProto.POINTER_SPEED);
@@ -1640,7 +1985,12 @@
                 Settings.System.EGG_MODE,
                 SystemSettingsProto.EGG_MODE);
         dumpSetting(s, p,
+                Settings.System.SHOW_BATTERY_PERCENT,
+                SystemSettingsProto.SHOW_BATTERY_PERCENT);
+        dumpSetting(s, p,
                 Settings.System.WHEN_TO_MAKE_WIFI_CALLS,
                 SystemSettingsProto.WHEN_TO_MAKE_WIFI_CALLS);
+        // The rest of the settings were moved to Settings.Secure, and are thus excluded here since
+        // they're deprecated from Settings.System.
     }
 }
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 36f9b84..258c96c 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -18,6 +18,7 @@
 
 import android.Manifest;
 import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.app.ActivityManager;
 import android.app.AppGlobals;
 import android.app.backup.BackupManager;
@@ -657,7 +658,6 @@
 
         synchronized (mLock) {
             SettingsProtoDumpUtil.dumpProtoLocked(mSettingsRegistry, proto);
-
         }
 
         proto.flush();
@@ -2284,6 +2284,7 @@
             return users;
         }
 
+        @Nullable
         public SettingsState getSettingsLocked(int type, int userId) {
             final int key = makeKey(type, userId);
             return peekSettingsStateLocked(key);
@@ -2578,6 +2579,7 @@
             ssaidSettings.deleteSettingLocked(Integer.toString(uid));
         }
 
+        @Nullable
         private SettingsState peekSettingsStateLocked(int key) {
             SettingsState settingsState = mSettingsStates.get(key);
             if (settingsState != null) {
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
index 4151ada..f901bca 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
@@ -434,8 +434,9 @@
      * Dump historical operations as a proto buf.
      *
      * @param proto The proto buf stream to dump to
+     * @param fieldId The repeated field ID to use to save an operation to.
      */
-    void dumpProtoHistoricalOperations(@NonNull ProtoOutputStream proto) {
+    void dumpHistoricalOperations(@NonNull ProtoOutputStream proto, long fieldId) {
         synchronized (mLock) {
             if (mHistoricalOperations == null) {
                 return;
@@ -448,7 +449,8 @@
                     index = operationCount + index;
                 }
                 HistoricalOperation operation = mHistoricalOperations.get(index);
-                long settingsOperationToken = proto.start(GlobalSettingsProto.HISTORICAL_OP);
+
+                final long token = proto.start(fieldId);
                 proto.write(SettingsOperationProto.TIMESTAMP, operation.mTimestamp);
                 proto.write(SettingsOperationProto.OPERATION, operation.mOperation);
                 if (operation.mSetting != null) {
@@ -457,7 +459,7 @@
                     // add is what the current data is).
                     proto.write(SettingsOperationProto.SETTING, operation.mSetting.getName());
                 }
-                proto.end(settingsOperationToken);
+                proto.end(token);
             }
         }
     }