While-idle alarm timeout & EBS

Use the long whileidle timeout for apps in the background.

Test: Manual test with a test app (I9d0c0ed4b6a0)
Test: atest $ANDROID_BUILD_TOP/frameworks/base/services/tests/servicestests/src/com/android/server/ForceAppStandbyTrackerTest.java
Test: atest $ANDROID_BUILD_TOP/cts/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverAlarmTest.java
Bug: 72124522
Change-Id: Ibd0a46e573604f7f2d1ec51a60ea87c163233003
diff --git a/core/proto/android/server/alarmmanagerservice.proto b/core/proto/android/server/alarmmanagerservice.proto
index aa2663f..0342c9c 100644
--- a/core/proto/android/server/alarmmanagerservice.proto
+++ b/core/proto/android/server/alarmmanagerservice.proto
@@ -27,6 +27,7 @@
 
 option java_multiple_files = true;
 
+// next ID: 43
 message AlarmManagerServiceProto {
   option (.android.msg_privacy).dest = DEST_AUTOMATIC;
 
@@ -114,7 +115,14 @@
     optional int32 uid = 1;
     // In the 'elapsed' timebase.
     optional int64 time_ms = 2;
+
+    // Time when the next while-idle is allowed, in the 'elapsed' timebase.
+    optional int64 next_allowed_ms = 3;
   }
+
+  // Whether the short or long while-idle timeout should be used for each UID.
+  repeated int32 use_allow_while_idle_short_time = 42;
+
   // For each uid, this is the last time we dispatched an "allow while idle"
   // alarm, used to determine the earliest we can dispatch the next such alarm.
   repeated LastAllowWhileIdleDispatch last_allow_while_idle_dispatch_times = 36;