1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settingslib.fuelgauge;
18 
19 import android.annotation.IntDef;
20 
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 
24 /**
25  * Utilities related to battery saver logging.
26  */
27 public final class BatterySaverLogging {
28     /**
29      * Record the reason while enabling power save mode manually.
30      * See {@link SaverManualEnabledReason} for all available states.
31      */
32     public static final String EXTRA_POWER_SAVE_MODE_MANUAL_ENABLED_REASON =
33             "extra_power_save_mode_manual_enabled_reason";
34 
35     /** Record the event while enabling power save mode manually. */
36     public static final String EXTRA_POWER_SAVE_MODE_MANUAL_ENABLED =
37             "extra_power_save_mode_manual_enabled";
38 
39     /** Broadcast action to record battery saver manual enabled reason. */
40     public static final String ACTION_SAVER_STATE_MANUAL_UPDATE =
41             "com.android.settingslib.fuelgauge.ACTION_SAVER_STATE_MANUAL_UPDATE";
42 
43     /** An interface for the battery saver manual enable reason. */
44     @Retention(RetentionPolicy.SOURCE)
45     @IntDef({SAVER_ENABLED_UNKNOWN, SAVER_ENABLED_CONFIRMATION, SAVER_ENABLED_VOICE,
46             SAVER_ENABLED_SETTINGS, SAVER_ENABLED_QS, SAVER_ENABLED_LOW_WARNING,
47             SAVER_ENABLED_SEVERE_WARNING})
48     public @interface SaverManualEnabledReason {}
49 
50     public static final int SAVER_ENABLED_UNKNOWN = 0;
51     public static final int SAVER_ENABLED_CONFIRMATION = 1;
52     public static final int SAVER_ENABLED_VOICE = 2;
53     public static final int SAVER_ENABLED_SETTINGS = 3;
54     public static final int SAVER_ENABLED_QS = 4;
55     public static final int SAVER_ENABLED_LOW_WARNING = 5;
56     public static final int SAVER_ENABLED_SEVERE_WARNING = 6;
57 }
58