Do not throttle EXEMPT apps on battery saver

- Also keep track of # of callback calls and their duration and print them in
dumpsys. Example:

  Stats:
    UID_STATE_CHANGED: count=141, total=31.9ms, avg=0.226ms
    RUN_ANY_CHANGED: count=0, total=0.0ms, avg=0.000ms
    ALL_UNWHITELISTED: count=0, total=0.0ms, avg=0.000ms
    ALL_WHITELIST_CHANGED: count=0, total=0.0ms, avg=0.000ms
    TEMP_WHITELIST_CHANGED: count=28, total=14.9ms, avg=0.532ms
    EXEMPT_CHANGED: count=2, total=4.7ms, avg=2.370ms
    FORCE_ALL_CHANGED: count=6, total=1.1ms, avg=0.178ms
    FORCE_APP_STANDBY_FEATURE_FLAG_CHANGED: count=0, total=0.0ms, avg=0.000ms

Bug: 70565111
Test: atest $ANDROID_BUILD_TOP/frameworks/base/services/tests/servicestests/src/com/android/server/ForceAppStandbyTrackerTest.java
Test: atest CtsBatterySavingTestCases
Test: atest CtsJobSchedulerTestCases
Test: atest CtsAlarmManagerTestCases

Change-Id: Ie4983456dd60f7115a15ee25a8d1bf5c078dac74
diff --git a/core/proto/android/server/statlogger.proto b/core/proto/android/server/statlogger.proto
new file mode 100644
index 0000000..fa430d8
--- /dev/null
+++ b/core/proto/android/server/statlogger.proto
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+syntax = "proto2";
+
+package com.android.server;
+
+option java_multiple_files = true;
+
+// Dump from StatLogger.
+message StatLoggerProto {
+  message Event {
+    optional int32 eventId = 1;
+    optional string label = 2;
+    optional int32 count = 3;
+    optional int64 total_duration_micros = 4;
+  }
+
+  repeated Event events = 1;
+}