• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 android.os;
18 
19 import android.annotation.IntDef;
20 import android.annotation.NonNull;
21 import android.annotation.Nullable;
22 import android.annotation.RequiresPermission;
23 import android.annotation.SystemApi;
24 import android.annotation.SystemService;
25 import android.content.Context;
26 
27 import java.lang.annotation.Retention;
28 import java.lang.annotation.RetentionPolicy;
29 import java.util.List;
30 
31 /**
32  * Interface to access and modify the permanent and temporary power save allowlist. The two lists
33  * are kept separately. Apps placed on the permanent allowlist are only removed via an explicit
34  * removeFromAllowlist call. Apps whitelisted by default by the system cannot be removed. Apps
35  * placed on the temporary allowlist are removed from that allowlist after a predetermined amount of
36  * time.
37  *
38  * @deprecated Use {@link PowerExemptionManager} instead
39  * @hide
40  */
41 @SystemApi
42 @Deprecated
43 @SystemService(Context.POWER_WHITELIST_MANAGER)
44 public class PowerWhitelistManager {
45     private final Context mContext;
46     // Proxy to DeviceIdleController for now
47     // TODO: migrate to PowerWhitelistController
48     private final IDeviceIdleController mService;
49 
50     private final PowerExemptionManager mPowerExemptionManager;
51 
52     /**
53      * Indicates that an unforeseen event has occurred and the app should be allowlisted to handle
54      * it.
55      */
56     public static final int EVENT_UNSPECIFIED = PowerExemptionManager.EVENT_UNSPECIFIED;
57 
58     /**
59      * Indicates that an SMS event has occurred and the app should be allowlisted to handle it.
60      */
61     public static final int EVENT_SMS = PowerExemptionManager.EVENT_SMS;
62 
63     /**
64      * Indicates that an MMS event has occurred and the app should be allowlisted to handle it.
65      */
66     public static final int EVENT_MMS = PowerExemptionManager.EVENT_MMS;
67 
68     /**
69      * @hide
70      */
71     @Retention(RetentionPolicy.SOURCE)
72     @IntDef(prefix = {"EVENT_"}, value = {
73             EVENT_UNSPECIFIED,
74             EVENT_SMS,
75             EVENT_MMS,
76     })
77     public @interface WhitelistEvent {
78     }
79 
80     /**
81      * Allow the temp allowlist behavior, plus allow foreground service start from background.
82      */
83     public static final int TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED =
84             PowerExemptionManager.TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED;
85     /**
86      * Only allow the temp allowlist behavior, not allow foreground service start from
87      * background.
88      */
89     public static final int TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_NOT_ALLOWED =
90             PowerExemptionManager.TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_NOT_ALLOWED;
91 
92     /**
93      * The list of temp allowlist types.
94      * @hide
95      */
96     @IntDef(flag = true, prefix = { "TEMPORARY_ALLOWLIST_TYPE_" }, value = {
97             TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED,
98             TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_NOT_ALLOWED,
99     })
100     @Retention(RetentionPolicy.SOURCE)
101     public @interface TempAllowListType {}
102 
103     /* Reason code for BG-FGS-launch. */
104     /**
105      * BG-FGS-launch is denied.
106      * @hide
107      */
108     public static final int REASON_DENIED = PowerExemptionManager.REASON_DENIED;
109 
110     /* Reason code range 0-9 are reserved for default reasons */
111     /**
112      * The default reason code if reason is unknown.
113      */
114     public static final int REASON_UNKNOWN = PowerExemptionManager.REASON_UNKNOWN;
115     /**
116      * Use REASON_OTHER if there is no better choice.
117      */
118     public static final int REASON_OTHER = PowerExemptionManager.REASON_OTHER;
119 
120     /* Reason code range 10-49 are reserved for BG-FGS-launch allowed proc states */
121     /** @hide */
122     public static final int REASON_PROC_STATE_PERSISTENT =
123             PowerExemptionManager.REASON_PROC_STATE_PERSISTENT;
124     /** @hide */
125     public static final int REASON_PROC_STATE_PERSISTENT_UI =
126             PowerExemptionManager.REASON_PROC_STATE_PERSISTENT_UI;
127     /** @hide */
128     public static final int REASON_PROC_STATE_TOP = PowerExemptionManager.REASON_PROC_STATE_TOP;
129     /** @hide */
130     public static final int REASON_PROC_STATE_BTOP = PowerExemptionManager.REASON_PROC_STATE_BTOP;
131     /** @hide */
132     public static final int REASON_PROC_STATE_FGS = PowerExemptionManager.REASON_PROC_STATE_FGS;
133     /** @hide */
134     public static final int REASON_PROC_STATE_BFGS = PowerExemptionManager.REASON_PROC_STATE_BFGS;
135 
136     /* Reason code range 50-99 are reserved for BG-FGS-launch allowed reasons */
137     /** @hide */
138     public static final int REASON_UID_VISIBLE = PowerExemptionManager.REASON_UID_VISIBLE;
139     /** @hide */
140     public static final int REASON_SYSTEM_UID = PowerExemptionManager.REASON_SYSTEM_UID;
141     /** @hide */
142     public static final int REASON_ACTIVITY_STARTER = PowerExemptionManager.REASON_ACTIVITY_STARTER;
143     /** @hide */
144     public static final int REASON_START_ACTIVITY_FLAG =
145             PowerExemptionManager.REASON_START_ACTIVITY_FLAG;
146     /** @hide */
147     public static final int REASON_FGS_BINDING = PowerExemptionManager.REASON_FGS_BINDING;
148     /** @hide */
149     public static final int REASON_DEVICE_OWNER = PowerExemptionManager.REASON_DEVICE_OWNER;
150     /** @hide */
151     public static final int REASON_PROFILE_OWNER = PowerExemptionManager.REASON_PROFILE_OWNER;
152     /** @hide */
153     public static final int REASON_COMPANION_DEVICE_MANAGER =
154             PowerExemptionManager.REASON_COMPANION_DEVICE_MANAGER;
155     /**
156      * START_ACTIVITIES_FROM_BACKGROUND permission.
157      * @hide
158      */
159     public static final int REASON_BACKGROUND_ACTIVITY_PERMISSION =
160             PowerExemptionManager.REASON_BACKGROUND_ACTIVITY_PERMISSION;
161     /**
162      * START_FOREGROUND_SERVICES_FROM_BACKGROUND permission.
163      * @hide
164      */
165     public static final int REASON_BACKGROUND_FGS_PERMISSION =
166             PowerExemptionManager.REASON_BACKGROUND_FGS_PERMISSION;
167     /** @hide */
168     public static final int REASON_INSTR_BACKGROUND_ACTIVITY_PERMISSION =
169             PowerExemptionManager.REASON_INSTR_BACKGROUND_ACTIVITY_PERMISSION;
170     /** @hide */
171     public static final int REASON_INSTR_BACKGROUND_FGS_PERMISSION =
172             PowerExemptionManager.REASON_INSTR_BACKGROUND_FGS_PERMISSION;
173     /** @hide */
174     public static final int REASON_SYSTEM_ALERT_WINDOW_PERMISSION =
175             PowerExemptionManager.REASON_SYSTEM_ALERT_WINDOW_PERMISSION;
176     /** @hide */
177     public static final int REASON_DEVICE_DEMO_MODE = PowerExemptionManager.REASON_DEVICE_DEMO_MODE;
178     /** @hide */
179     public static final int REASON_ALLOWLISTED_PACKAGE =
180             PowerExemptionManager.REASON_ALLOWLISTED_PACKAGE;
181     /** @hide */
182     public static final int REASON_APPOP = PowerExemptionManager.REASON_APPOP;
183 
184     /* BG-FGS-launch is allowed by temp-allowlist or system-allowlist.
185        Reason code for temp and system allowlist starts here.
186        Reason code range 100-199 are reserved for public reasons. */
187     /**
188      * Set temp-allowlist for location geofence purpose.
189      */
190     public static final int REASON_GEOFENCING = PowerExemptionManager.REASON_GEOFENCING;
191     /**
192      * Set temp-allowlist for server push messaging.
193      */
194     public static final int REASON_PUSH_MESSAGING = PowerExemptionManager.REASON_PUSH_MESSAGING;
195     /**
196      * Set temp-allowlist for server push messaging over the quota.
197      */
198     public static final int REASON_PUSH_MESSAGING_OVER_QUOTA =
199             PowerExemptionManager.REASON_PUSH_MESSAGING_OVER_QUOTA;
200     /**
201      * Set temp-allowlist for activity recognition.
202      */
203     public static final int REASON_ACTIVITY_RECOGNITION =
204             PowerExemptionManager.REASON_ACTIVITY_RECOGNITION;
205 
206     /* Reason code range 200-299 are reserved for broadcast actions */
207     /**
208      * Broadcast ACTION_BOOT_COMPLETED.
209      * @hide
210      */
211     public static final int REASON_BOOT_COMPLETED = PowerExemptionManager.REASON_BOOT_COMPLETED;
212     /**
213      * Broadcast ACTION_PRE_BOOT_COMPLETED.
214      * @hide
215      */
216     public static final int REASON_PRE_BOOT_COMPLETED =
217             PowerExemptionManager.REASON_PRE_BOOT_COMPLETED;
218     /**
219      * Broadcast ACTION_LOCKED_BOOT_COMPLETED.
220      * @hide
221      */
222     public static final int REASON_LOCKED_BOOT_COMPLETED =
223             PowerExemptionManager.REASON_LOCKED_BOOT_COMPLETED;
224 
225     /* Reason code range 300-399 are reserved for other internal reasons */
226     /**
227      * Device idle system allowlist, including EXCEPT-IDLE
228      * @hide
229      */
230     public static final int REASON_SYSTEM_ALLOW_LISTED =
231             PowerExemptionManager.REASON_SYSTEM_ALLOW_LISTED;
232     /** @hide */
233     public static final int REASON_ALARM_MANAGER_ALARM_CLOCK =
234             PowerExemptionManager.REASON_ALARM_MANAGER_ALARM_CLOCK;
235     /**
236      * AlarmManagerService.
237      * @hide
238      */
239     public static final int REASON_ALARM_MANAGER_WHILE_IDLE =
240             PowerExemptionManager.REASON_ALARM_MANAGER_WHILE_IDLE;
241     /**
242      * ActiveServices.
243      * @hide
244      */
245     public static final int REASON_SERVICE_LAUNCH = PowerExemptionManager.REASON_SERVICE_LAUNCH;
246     /**
247      * KeyChainSystemService.
248      * @hide
249      */
250     public static final int REASON_KEY_CHAIN = PowerExemptionManager.REASON_KEY_CHAIN;
251     /**
252      * PackageManagerService.
253      * @hide
254      */
255     public static final int REASON_PACKAGE_VERIFIER = PowerExemptionManager.REASON_PACKAGE_VERIFIER;
256     /**
257      * SyncManager.
258      * @hide
259      */
260     public static final int REASON_SYNC_MANAGER = PowerExemptionManager.REASON_SYNC_MANAGER;
261     /**
262      * DomainVerificationProxyV1.
263      * @hide
264      */
265     public static final int REASON_DOMAIN_VERIFICATION_V1 =
266             PowerExemptionManager.REASON_DOMAIN_VERIFICATION_V1;
267     /**
268      * DomainVerificationProxyV2.
269      * @hide
270      */
271     public static final int REASON_DOMAIN_VERIFICATION_V2 =
272             PowerExemptionManager.REASON_DOMAIN_VERIFICATION_V2;
273     /** @hide */
274     public static final int REASON_VPN = 309;
275     /**
276      * NotificationManagerService.
277      * @hide
278      */
279     public static final int REASON_NOTIFICATION_SERVICE =
280             PowerExemptionManager.REASON_NOTIFICATION_SERVICE;
281     /**
282      * Broadcast ACTION_MY_PACKAGE_REPLACED.
283      * @hide
284      */
285     public static final int REASON_PACKAGE_REPLACED = PowerExemptionManager.REASON_PACKAGE_REPLACED;
286     /**
287      * LocationProvider.
288      * @hide
289      */
290     @SystemApi
291     public static final int REASON_LOCATION_PROVIDER =
292             PowerExemptionManager.REASON_LOCATION_PROVIDER;
293     /**
294      * MediaButtonReceiver.
295      * @hide
296      */
297     public static final int REASON_MEDIA_BUTTON = PowerExemptionManager.REASON_MEDIA_BUTTON;
298     /**
299      * InboundSmsHandler.
300      * @hide
301      */
302     public static final int REASON_EVENT_SMS = PowerExemptionManager.REASON_EVENT_SMS;
303     /**
304      * InboundSmsHandler.
305      * @hide
306      */
307     public static final int REASON_EVENT_MMS = PowerExemptionManager.REASON_EVENT_MMS;
308     /**
309      * Shell app.
310      * @hide
311      */
312     public static final int REASON_SHELL = PowerExemptionManager.REASON_SHELL;
313     /**
314      * Tile onClick event
315      * @hide
316      */
317     public static final int REASON_TILE_ONCLICK = PowerExemptionManager.REASON_TILE_ONCLICK;
318 
319     /**
320      * The list of BG-FGS-Launch and temp-allowlist reason code.
321      * @hide
322      */
323     @IntDef(flag = true, prefix = { "REASON_" }, value = {
324             // BG-FGS-Launch reasons.
325             REASON_DENIED,
326             REASON_UNKNOWN,
327             REASON_OTHER,
328             REASON_PROC_STATE_PERSISTENT,
329             REASON_PROC_STATE_PERSISTENT_UI,
330             REASON_PROC_STATE_TOP,
331             REASON_PROC_STATE_BTOP,
332             REASON_PROC_STATE_FGS,
333             REASON_PROC_STATE_BFGS,
334             REASON_UID_VISIBLE,
335             REASON_SYSTEM_UID,
336             REASON_ACTIVITY_STARTER,
337             REASON_START_ACTIVITY_FLAG,
338             REASON_FGS_BINDING,
339             REASON_DEVICE_OWNER,
340             REASON_PROFILE_OWNER,
341             REASON_COMPANION_DEVICE_MANAGER,
342             REASON_BACKGROUND_ACTIVITY_PERMISSION,
343             REASON_BACKGROUND_FGS_PERMISSION,
344             REASON_INSTR_BACKGROUND_ACTIVITY_PERMISSION,
345             REASON_INSTR_BACKGROUND_FGS_PERMISSION,
346             REASON_SYSTEM_ALERT_WINDOW_PERMISSION,
347             REASON_DEVICE_DEMO_MODE,
348             REASON_ALLOWLISTED_PACKAGE,
349             REASON_APPOP,
350             // temp and system allowlist reasons.
351             REASON_GEOFENCING,
352             REASON_PUSH_MESSAGING,
353             REASON_PUSH_MESSAGING_OVER_QUOTA,
354             REASON_ACTIVITY_RECOGNITION,
355             REASON_BOOT_COMPLETED,
356             REASON_PRE_BOOT_COMPLETED,
357             REASON_LOCKED_BOOT_COMPLETED,
358             REASON_SYSTEM_ALLOW_LISTED,
359             REASON_ALARM_MANAGER_ALARM_CLOCK,
360             REASON_ALARM_MANAGER_WHILE_IDLE,
361             REASON_SERVICE_LAUNCH,
362             REASON_KEY_CHAIN,
363             REASON_PACKAGE_VERIFIER,
364             REASON_SYNC_MANAGER,
365             REASON_DOMAIN_VERIFICATION_V1,
366             REASON_DOMAIN_VERIFICATION_V2,
367             REASON_VPN,
368             REASON_NOTIFICATION_SERVICE,
369             REASON_PACKAGE_REPLACED,
370             REASON_LOCATION_PROVIDER,
371             REASON_MEDIA_BUTTON,
372             REASON_EVENT_SMS,
373             REASON_EVENT_MMS,
374             REASON_SHELL,
375     })
376     @Retention(RetentionPolicy.SOURCE)
377     public @interface ReasonCode {}
378 
379     /**
380      * @hide
381      */
PowerWhitelistManager(@onNull Context context)382     public PowerWhitelistManager(@NonNull Context context) {
383         mContext = context;
384         mService = context.getSystemService(DeviceIdleManager.class).getService();
385         mPowerExemptionManager = context.getSystemService(PowerExemptionManager.class);
386     }
387 
388     /**
389      * Add the specified package to the permanent power save allowlist.
390      *
391      * @deprecated Use {@link PowerExemptionManager#addToPermanentAllowList(String)} instead
392      */
393     @Deprecated
394     @RequiresPermission(android.Manifest.permission.DEVICE_POWER)
addToWhitelist(@onNull String packageName)395     public void addToWhitelist(@NonNull String packageName) {
396         mPowerExemptionManager.addToPermanentAllowList(packageName);
397     }
398 
399     /**
400      * Add the specified packages to the permanent power save allowlist.
401      *
402      * @deprecated Use {@link PowerExemptionManager#addToPermanentAllowList(List)} instead
403      */
404     @Deprecated
405     @RequiresPermission(android.Manifest.permission.DEVICE_POWER)
addToWhitelist(@onNull List<String> packageNames)406     public void addToWhitelist(@NonNull List<String> packageNames) {
407         mPowerExemptionManager.addToPermanentAllowList(packageNames);
408     }
409 
410     /**
411      * Get a list of app IDs of app that are allowlisted. This does not include temporarily
412      * allowlisted apps.
413      *
414      * @param includingIdle Set to true if the app should be allowlisted from device idle as well
415      *                      as other power save restrictions
416      * @deprecated Use {@link PowerExemptionManager#getAllowListedAppIds(boolean)} instead
417      * @hide
418      */
419     @Deprecated
420     @NonNull
getWhitelistedAppIds(boolean includingIdle)421     public int[] getWhitelistedAppIds(boolean includingIdle) {
422         return mPowerExemptionManager.getAllowListedAppIds(includingIdle);
423     }
424 
425     /**
426      * Returns true if the app is allowlisted from power save restrictions. This does not include
427      * temporarily allowlisted apps.
428      *
429      * @param includingIdle Set to true if the app should be allowlisted from device
430      *                      idle as well as other power save restrictions
431      * @deprecated Use {@link PowerExemptionManager#isAllowListed(String, boolean)} instead
432      * @hide
433      */
434     @Deprecated
isWhitelisted(@onNull String packageName, boolean includingIdle)435     public boolean isWhitelisted(@NonNull String packageName, boolean includingIdle) {
436         return mPowerExemptionManager.isAllowListed(packageName, includingIdle);
437     }
438 
439     /**
440      * Remove an app from the permanent power save allowlist. Only apps that were added via
441      * {@link #addToWhitelist(String)} or {@link #addToWhitelist(List)} will be removed. Apps
442      * allowlisted by default by the system cannot be removed.
443      *
444      * @param packageName The app to remove from the allowlist
445      * @deprecated Use {@link PowerExemptionManager#removeFromPermanentAllowList(String)} instead
446      */
447     @Deprecated
448     @RequiresPermission(android.Manifest.permission.DEVICE_POWER)
removeFromWhitelist(@onNull String packageName)449     public void removeFromWhitelist(@NonNull String packageName) {
450         mPowerExemptionManager.removeFromPermanentAllowList(packageName);
451     }
452 
453     /**
454      * Add an app to the temporary allowlist for a short amount of time.
455      *
456      * @param packageName The package to add to the temp allowlist
457      * @param durationMs  How long to keep the app on the temp allowlist for (in milliseconds)
458      * @param reasonCode one of {@link ReasonCode}, use {@link #REASON_UNKNOWN} if not sure.
459      * @param reason a optional human readable reason string, could be null or empty string.
460      * @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowList(
461      *             String, int, String, long)} instead
462      */
463     @Deprecated
464     @RequiresPermission(android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST)
whitelistAppTemporarily(@onNull String packageName, long durationMs, @ReasonCode int reasonCode, @Nullable String reason)465     public void whitelistAppTemporarily(@NonNull String packageName, long durationMs,
466             @ReasonCode int reasonCode, @Nullable String reason) {
467         mPowerExemptionManager.addToTemporaryAllowList(packageName, reasonCode, reason, durationMs);
468     }
469 
470     /**
471      * Add an app to the temporary allowlist for a short amount of time.
472      *
473      * @param packageName The package to add to the temp allowlist
474      * @param durationMs  How long to keep the app on the temp allowlist for (in milliseconds)
475      * @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowList(
476      *             String, int, String, long)} instead
477      */
478     @Deprecated
479     @RequiresPermission(android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST)
whitelistAppTemporarily(@onNull String packageName, long durationMs)480     public void whitelistAppTemporarily(@NonNull String packageName, long durationMs) {
481         mPowerExemptionManager.addToTemporaryAllowList(
482                 packageName, REASON_UNKNOWN, packageName, durationMs);
483     }
484 
485     /**
486      * Add an app to the temporary allowlist for a short amount of time for a specific reason. The
487      * temporary allowlist is kept separately from the permanent allowlist and apps are
488      * automatically removed from the temporary allowlist after a predetermined amount of time.
489      *
490      * @param packageName The package to add to the temp allowlist
491      * @param event       The reason to add the app to the temp allowlist
492      * @param reason      A human-readable reason explaining why the app is temp allowlisted. Only
493      *                    used for logging purposes. Could be null or empty string.
494      * @return The duration (in milliseconds) that the app is allowlisted for
495      * @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowListForEvent(
496      *             String, int, String, int)} instead
497      */
498     @Deprecated
499     @RequiresPermission(android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST)
whitelistAppTemporarilyForEvent(@onNull String packageName, @WhitelistEvent int event, @Nullable String reason)500     public long whitelistAppTemporarilyForEvent(@NonNull String packageName,
501             @WhitelistEvent int event, @Nullable String reason) {
502         return mPowerExemptionManager.addToTemporaryAllowListForEvent(
503                 packageName, REASON_UNKNOWN, reason, event);
504     }
505 
506     /**
507      * Add an app to the temporary allowlist for a short amount of time for a specific reason. The
508      * temporary allowlist is kept separately from the permanent allowlist and apps are
509      * automatically removed from the temporary allowlist after a predetermined amount of time.
510      *
511      * @param packageName The package to add to the temp allowlist
512      * @param event       The reason to add the app to the temp allowlist
513      * @param reasonCode  one of {@link ReasonCode}, use {@link #REASON_UNKNOWN} if not sure.
514      * @param reason      A human-readable reason explaining why the app is temp allowlisted. Only
515      *                    used for logging purposes. Could be null or empty string.
516      * @return The duration (in milliseconds) that the app is allowlisted for
517      * @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowListForEvent(
518      *             String, int, String, int)} instead
519      */
520     @Deprecated
521     @RequiresPermission(android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST)
whitelistAppTemporarilyForEvent(@onNull String packageName, @WhitelistEvent int event, @ReasonCode int reasonCode, @Nullable String reason)522     public long whitelistAppTemporarilyForEvent(@NonNull String packageName,
523             @WhitelistEvent int event, @ReasonCode int reasonCode, @Nullable String reason) {
524         return mPowerExemptionManager.addToTemporaryAllowListForEvent(
525                 packageName, reasonCode, reason, event);
526     }
527 
528     /**
529      * @hide
530      *
531      * @deprecated Use {@link PowerExemptionManager#getReasonCodeFromProcState(int)} instead
532      */
533     @Deprecated
getReasonCodeFromProcState(int procState)534     public static @ReasonCode int getReasonCodeFromProcState(int procState) {
535         return PowerExemptionManager.getReasonCodeFromProcState(procState);
536     }
537 
538     /**
539      * Return string name of the integer reason code.
540      * @hide
541      * @param reasonCode
542      * @return string name of the reason code.
543      * @deprecated Use {@link PowerExemptionManager#reasonCodeToString(int)} instead
544      */
545     @Deprecated
reasonCodeToString(@easonCode int reasonCode)546     public static String reasonCodeToString(@ReasonCode int reasonCode) {
547         return PowerExemptionManager.reasonCodeToString(reasonCode);
548     }
549 }
550