Add a setting for the User Absent, Touch Off feature in Wear

This is an extension of the User Absent power feature on Wear aka "for small batteries". Turning the
sensor off is one of the aspects of power saving we want to take advantage of when the user is
absent.

Bug: 77293569
Test: make -j80
Test: Device boots
Change-Id: I25a3577d8eb2d157c20ed344056138bc32e8d158
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 9e5efa1..9be2996 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -11039,6 +11039,15 @@
                 = "user_absent_radios_off_for_small_battery_enabled";
 
         /**
+         * Whether or not to enable the User Absent, Touch Off feature on small battery devices.
+         * Type: int (0 for false, 1 for true)
+         * Default: 0
+         * @hide
+         */
+        public static final String USER_ABSENT_TOUCH_OFF_FOR_SMALL_BATTERY_ENABLED
+                = "user_absent_touch_off_for_small_battery_enabled";
+
+        /**
          * Whether or not to turn on Wifi when proxy is disconnected.
          * Type: int (0 for false, 1 for true)
          * Default: 1
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index 99f3034..04e5658 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -600,14 +600,17 @@
     }
     optional Ntp ntp = 84;
 
-    // Details about the User Absent, Radios Off feature.
-    message UserAbsentRadiosOff {
+    // Details about the User Absent For Small Battery feature.
+    message UserAbsentSmallBattery {
         option (android.msg_privacy).dest = DEST_EXPLICIT;
 
-        // Whether or not to enable the User Absent, Radios Off feature on small battery devices.
-        optional SettingProto enabled_for_small_battery = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
+        // Whether or not to enable the User Absent, Radios Off feature
+        optional SettingProto radios_off_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
+        // Whether or not to enable the User Absent, Touch Off feature
+        optional SettingProto touch_off_enabled = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
     }
-    optional UserAbsentRadiosOff user_absent_radios_off = 85;
+    optional UserAbsentSmallBattery user_absent_small_battery = 85;
 
     // Whether to disable the automatic scheduling of system updates.
     optional SettingProto ota_disable_automatic_update = 86 [ (android.privacy).dest = DEST_AUTOMATIC ];
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 156a2c0..82c02aa 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -340,7 +340,6 @@
                     Settings.Global.NTP_SERVER,
                     Settings.Global.NTP_TIMEOUT,
                     Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE,
-                    Settings.Global.USER_ABSENT_RADIOS_OFF_FOR_SMALL_BATTERY_ENABLED,
                     Settings.Global.OVERLAY_DISPLAY_DEVICES,
                     Settings.Global.PAC_CHANGE_DELAY,
                     Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE,
@@ -434,6 +433,8 @@
                     Settings.Global.UNGAZE_SLEEP_ENABLED,
                     Settings.Global.UNLOCK_SOUND,
                     Settings.Global.USE_GOOGLE_MAIL,
+                    Settings.Global.USER_ABSENT_RADIOS_OFF_FOR_SMALL_BATTERY_ENABLED,
+                    Settings.Global.USER_ABSENT_TOUCH_OFF_FOR_SMALL_BATTERY_ENABLED,
                     Settings.Global.VT_IMS_ENABLED,
                     Settings.Global.WAIT_FOR_DEBUGGER,
                     Settings.Global.ENABLE_GPU_DEBUG_LAYERS,
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index d5efcb5..77eb6c4 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -963,11 +963,14 @@
                 GlobalSettingsProto.Ntp.TIMEOUT_MS);
         p.end(ntpToken);
 
-        final long uaroToken = p.start(GlobalSettingsProto.USER_ABSENT_RADIOS_OFF);
+        final long uasbToken = p.start(GlobalSettingsProto.USER_ABSENT_SMALL_BATTERY);
         dumpSetting(s, p,
                 Settings.Global.USER_ABSENT_RADIOS_OFF_FOR_SMALL_BATTERY_ENABLED,
-                GlobalSettingsProto.UserAbsentRadiosOff.ENABLED_FOR_SMALL_BATTERY);
-        p.end(uaroToken);
+                GlobalSettingsProto.UserAbsentSmallBattery.RADIOS_OFF_ENABLED);
+        dumpSetting(s, p,
+                Settings.Global.USER_ABSENT_TOUCH_OFF_FOR_SMALL_BATTERY_ENABLED,
+                GlobalSettingsProto.UserAbsentSmallBattery.TOUCH_OFF_ENABLED);
+        p.end(uasbToken);
 
         dumpSetting(s, p,
                 Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE,