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 whitelist. The two lists 33 * are kept separately. Apps placed on the permanent whitelist are only removed via an explicit 34 * removeFromWhitelist call. Apps whitelisted by default by the system cannot be removed. Apps 35 * placed on the temporary whitelist are removed from that whitelist 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 whitelisted 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 whitelisted 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 whitelisted 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 /** 315 * The list of BG-FGS-Launch and temp-allowlist reason code. 316 * @hide 317 */ 318 @IntDef(flag = true, prefix = { "REASON_" }, value = { 319 // BG-FGS-Launch reasons. 320 REASON_DENIED, 321 REASON_UNKNOWN, 322 REASON_OTHER, 323 REASON_PROC_STATE_PERSISTENT, 324 REASON_PROC_STATE_PERSISTENT_UI, 325 REASON_PROC_STATE_TOP, 326 REASON_PROC_STATE_BTOP, 327 REASON_PROC_STATE_FGS, 328 REASON_PROC_STATE_BFGS, 329 REASON_UID_VISIBLE, 330 REASON_SYSTEM_UID, 331 REASON_ACTIVITY_STARTER, 332 REASON_START_ACTIVITY_FLAG, 333 REASON_FGS_BINDING, 334 REASON_DEVICE_OWNER, 335 REASON_PROFILE_OWNER, 336 REASON_COMPANION_DEVICE_MANAGER, 337 REASON_BACKGROUND_ACTIVITY_PERMISSION, 338 REASON_BACKGROUND_FGS_PERMISSION, 339 REASON_INSTR_BACKGROUND_ACTIVITY_PERMISSION, 340 REASON_INSTR_BACKGROUND_FGS_PERMISSION, 341 REASON_SYSTEM_ALERT_WINDOW_PERMISSION, 342 REASON_DEVICE_DEMO_MODE, 343 REASON_ALLOWLISTED_PACKAGE, 344 REASON_APPOP, 345 // temp and system allowlist reasons. 346 REASON_GEOFENCING, 347 REASON_PUSH_MESSAGING, 348 REASON_PUSH_MESSAGING_OVER_QUOTA, 349 REASON_ACTIVITY_RECOGNITION, 350 REASON_BOOT_COMPLETED, 351 REASON_PRE_BOOT_COMPLETED, 352 REASON_LOCKED_BOOT_COMPLETED, 353 REASON_SYSTEM_ALLOW_LISTED, 354 REASON_ALARM_MANAGER_ALARM_CLOCK, 355 REASON_ALARM_MANAGER_WHILE_IDLE, 356 REASON_SERVICE_LAUNCH, 357 REASON_KEY_CHAIN, 358 REASON_PACKAGE_VERIFIER, 359 REASON_SYNC_MANAGER, 360 REASON_DOMAIN_VERIFICATION_V1, 361 REASON_DOMAIN_VERIFICATION_V2, 362 REASON_VPN, 363 REASON_NOTIFICATION_SERVICE, 364 REASON_PACKAGE_REPLACED, 365 REASON_LOCATION_PROVIDER, 366 REASON_MEDIA_BUTTON, 367 REASON_EVENT_SMS, 368 REASON_EVENT_MMS, 369 REASON_SHELL, 370 }) 371 @Retention(RetentionPolicy.SOURCE) 372 public @interface ReasonCode {} 373 374 /** 375 * @hide 376 */ PowerWhitelistManager(@onNull Context context)377 public PowerWhitelistManager(@NonNull Context context) { 378 mContext = context; 379 mService = context.getSystemService(DeviceIdleManager.class).getService(); 380 mPowerExemptionManager = context.getSystemService(PowerExemptionManager.class); 381 } 382 383 /** 384 * Add the specified package to the permanent power save whitelist. 385 * 386 * @deprecated Use {@link PowerExemptionManager#addToPermanentAllowList(String)} instead 387 */ 388 @Deprecated 389 @RequiresPermission(android.Manifest.permission.DEVICE_POWER) addToWhitelist(@onNull String packageName)390 public void addToWhitelist(@NonNull String packageName) { 391 mPowerExemptionManager.addToPermanentAllowList(packageName); 392 } 393 394 /** 395 * Add the specified packages to the permanent power save whitelist. 396 * 397 * @deprecated Use {@link PowerExemptionManager#addToPermanentAllowList(List)} instead 398 */ 399 @Deprecated 400 @RequiresPermission(android.Manifest.permission.DEVICE_POWER) addToWhitelist(@onNull List<String> packageNames)401 public void addToWhitelist(@NonNull List<String> packageNames) { 402 mPowerExemptionManager.addToPermanentAllowList(packageNames); 403 } 404 405 /** 406 * Get a list of app IDs of app that are whitelisted. This does not include temporarily 407 * whitelisted apps. 408 * 409 * @param includingIdle Set to true if the app should be whitelisted from device idle as well 410 * as other power save restrictions 411 * @deprecated Use {@link PowerExemptionManager#getAllowListedAppIds(boolean)} instead 412 * @hide 413 */ 414 @Deprecated 415 @NonNull getWhitelistedAppIds(boolean includingIdle)416 public int[] getWhitelistedAppIds(boolean includingIdle) { 417 return mPowerExemptionManager.getAllowListedAppIds(includingIdle); 418 } 419 420 /** 421 * Returns true if the app is whitelisted from power save restrictions. This does not include 422 * temporarily whitelisted apps. 423 * 424 * @param includingIdle Set to true if the app should be whitelisted from device 425 * idle as well as other power save restrictions 426 * @deprecated Use {@link PowerExemptionManager#isAllowListed(String, boolean)} instead 427 * @hide 428 */ 429 @Deprecated isWhitelisted(@onNull String packageName, boolean includingIdle)430 public boolean isWhitelisted(@NonNull String packageName, boolean includingIdle) { 431 return mPowerExemptionManager.isAllowListed(packageName, includingIdle); 432 } 433 434 /** 435 * Remove an app from the permanent power save whitelist. Only apps that were added via 436 * {@link #addToWhitelist(String)} or {@link #addToWhitelist(List)} will be removed. Apps 437 * whitelisted by default by the system cannot be removed. 438 * 439 * @param packageName The app to remove from the whitelist 440 * @deprecated Use {@link PowerExemptionManager#removeFromPermanentAllowList(String)} instead 441 */ 442 @Deprecated 443 @RequiresPermission(android.Manifest.permission.DEVICE_POWER) removeFromWhitelist(@onNull String packageName)444 public void removeFromWhitelist(@NonNull String packageName) { 445 mPowerExemptionManager.removeFromPermanentAllowList(packageName); 446 } 447 448 /** 449 * Add an app to the temporary whitelist for a short amount of time. 450 * 451 * @param packageName The package to add to the temp whitelist 452 * @param durationMs How long to keep the app on the temp whitelist for (in milliseconds) 453 * @param reasonCode one of {@link ReasonCode}, use {@link #REASON_UNKNOWN} if not sure. 454 * @param reason a optional human readable reason string, could be null or empty string. 455 * @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowList( 456 * String, int, String, long)} instead 457 */ 458 @Deprecated 459 @RequiresPermission(android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST) whitelistAppTemporarily(@onNull String packageName, long durationMs, @ReasonCode int reasonCode, @Nullable String reason)460 public void whitelistAppTemporarily(@NonNull String packageName, long durationMs, 461 @ReasonCode int reasonCode, @Nullable String reason) { 462 mPowerExemptionManager.addToTemporaryAllowList(packageName, reasonCode, reason, durationMs); 463 } 464 465 /** 466 * Add an app to the temporary whitelist for a short amount of time. 467 * 468 * @param packageName The package to add to the temp whitelist 469 * @param durationMs How long to keep the app on the temp whitelist for (in milliseconds) 470 * @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowList( 471 * String, int, String, long)} instead 472 */ 473 @Deprecated 474 @RequiresPermission(android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST) whitelistAppTemporarily(@onNull String packageName, long durationMs)475 public void whitelistAppTemporarily(@NonNull String packageName, long durationMs) { 476 mPowerExemptionManager.addToTemporaryAllowList( 477 packageName, REASON_UNKNOWN, packageName, durationMs); 478 } 479 480 /** 481 * Add an app to the temporary whitelist for a short amount of time for a specific reason. The 482 * temporary whitelist is kept separately from the permanent whitelist and apps are 483 * automatically removed from the temporary whitelist after a predetermined amount of time. 484 * 485 * @param packageName The package to add to the temp whitelist 486 * @param event The reason to add the app to the temp whitelist 487 * @param reason A human-readable reason explaining why the app is temp whitelisted. Only 488 * used for logging purposes. Could be null or empty string. 489 * @return The duration (in milliseconds) that the app is whitelisted for 490 * @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowListForEvent( 491 * String, int, String, int)} instead 492 */ 493 @Deprecated 494 @RequiresPermission(android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST) whitelistAppTemporarilyForEvent(@onNull String packageName, @WhitelistEvent int event, @Nullable String reason)495 public long whitelistAppTemporarilyForEvent(@NonNull String packageName, 496 @WhitelistEvent int event, @Nullable String reason) { 497 return mPowerExemptionManager.addToTemporaryAllowListForEvent( 498 packageName, REASON_UNKNOWN, reason, event); 499 } 500 501 /** 502 * Add an app to the temporary whitelist for a short amount of time for a specific reason. The 503 * temporary whitelist is kept separately from the permanent whitelist and apps are 504 * automatically removed from the temporary whitelist after a predetermined amount of time. 505 * 506 * @param packageName The package to add to the temp whitelist 507 * @param event The reason to add the app to the temp whitelist 508 * @param reasonCode one of {@link ReasonCode}, use {@link #REASON_UNKNOWN} if not sure. 509 * @param reason A human-readable reason explaining why the app is temp whitelisted. Only 510 * used for logging purposes. Could be null or empty string. 511 * @return The duration (in milliseconds) that the app is whitelisted for 512 * @deprecated Use {@link PowerExemptionManager#addToTemporaryAllowListForEvent( 513 * String, int, String, int)} instead 514 */ 515 @Deprecated 516 @RequiresPermission(android.Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST) whitelistAppTemporarilyForEvent(@onNull String packageName, @WhitelistEvent int event, @ReasonCode int reasonCode, @Nullable String reason)517 public long whitelistAppTemporarilyForEvent(@NonNull String packageName, 518 @WhitelistEvent int event, @ReasonCode int reasonCode, @Nullable String reason) { 519 return mPowerExemptionManager.addToTemporaryAllowListForEvent( 520 packageName, reasonCode, reason, event); 521 } 522 523 /** 524 * @hide 525 * 526 * @deprecated Use {@link PowerExemptionManager#getReasonCodeFromProcState(int)} instead 527 */ 528 @Deprecated getReasonCodeFromProcState(int procState)529 public static @ReasonCode int getReasonCodeFromProcState(int procState) { 530 return PowerExemptionManager.getReasonCodeFromProcState(procState); 531 } 532 533 /** 534 * Return string name of the integer reason code. 535 * @hide 536 * @param reasonCode 537 * @return string name of the reason code. 538 * @deprecated Use {@link PowerExemptionManager#reasonCodeToString(int)} instead 539 */ 540 @Deprecated reasonCodeToString(@easonCode int reasonCode)541 public static String reasonCodeToString(@ReasonCode int reasonCode) { 542 return PowerExemptionManager.reasonCodeToString(reasonCode); 543 } 544 } 545