1 /* //device/java/android/android/os/IPowerManager.aidl 2 ** 3 ** Copyright 2007, The Android Open Source Project 4 ** 5 ** Licensed under the Apache License, Version 2.0 (the "License"); 6 ** you may not use this file except in compliance with the License. 7 ** You may obtain a copy of the License at 8 ** 9 ** http://www.apache.org/licenses/LICENSE-2.0 10 ** 11 ** Unless required by applicable law or agreed to in writing, software 12 ** distributed under the License is distributed on an "AS IS" BASIS, 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 ** See the License for the specific language governing permissions and 15 ** limitations under the License. 16 */ 17 18 package android.os; 19 20 import android.os.BatterySaverPolicyConfig; 21 import android.os.PowerSaveState; 22 import android.os.WorkSource; 23 24 /** @hide */ 25 26 interface IPowerManager 27 { 28 // WARNING: When methods are inserted or deleted, the transaction IDs in 29 // frameworks/native/include/powermanager/IPowerManager.h must be updated to match the order in this file. 30 // 31 // When a method's argument list is changed, BnPowerManager's corresponding serialization code (if any) in 32 // frameworks/native/services/powermanager/IPowerManager.cpp must be updated. acquireWakeLock(IBinder lock, int flags, String tag, String packageName, in WorkSource ws, String historyTag)33 void acquireWakeLock(IBinder lock, int flags, String tag, String packageName, in WorkSource ws, 34 String historyTag); acquireWakeLockWithUid(IBinder lock, int flags, String tag, String packageName, int uidtoblame)35 void acquireWakeLockWithUid(IBinder lock, int flags, String tag, String packageName, 36 int uidtoblame); 37 @UnsupportedAppUsage releaseWakeLock(IBinder lock, int flags)38 void releaseWakeLock(IBinder lock, int flags); updateWakeLockUids(IBinder lock, in int[] uids)39 void updateWakeLockUids(IBinder lock, in int[] uids); powerHint(int hintId, int data)40 oneway void powerHint(int hintId, int data); setPowerBoost(int boost, int durationMs)41 oneway void setPowerBoost(int boost, int durationMs); setPowerMode(int mode, boolean enabled)42 oneway void setPowerMode(int mode, boolean enabled); 43 44 // Functionally identical to setPowerMode, but returns whether the call was successful setPowerModeChecked(int mode, boolean enabled)45 boolean setPowerModeChecked(int mode, boolean enabled); 46 updateWakeLockWorkSource(IBinder lock, in WorkSource ws, String historyTag)47 void updateWakeLockWorkSource(IBinder lock, in WorkSource ws, String historyTag); isWakeLockLevelSupported(int level)48 boolean isWakeLockLevelSupported(int level); 49 50 @UnsupportedAppUsage userActivity(long time, int event, int flags)51 void userActivity(long time, int event, int flags); wakeUp(long time, int reason, String details, String opPackageName)52 void wakeUp(long time, int reason, String details, String opPackageName); 53 @UnsupportedAppUsage goToSleep(long time, int reason, int flags)54 void goToSleep(long time, int reason, int flags); 55 @UnsupportedAppUsage(maxTargetSdk = 28) nap(long time)56 void nap(long time); getBrightnessConstraint(int constraint)57 float getBrightnessConstraint(int constraint); 58 @UnsupportedAppUsage isInteractive()59 boolean isInteractive(); isPowerSaveMode()60 boolean isPowerSaveMode(); getPowerSaveState(int serviceType)61 PowerSaveState getPowerSaveState(int serviceType); setPowerSaveModeEnabled(boolean mode)62 boolean setPowerSaveModeEnabled(boolean mode); setDynamicPowerSaveHint(boolean powerSaveHint, int disableThreshold)63 boolean setDynamicPowerSaveHint(boolean powerSaveHint, int disableThreshold); setAdaptivePowerSavePolicy(in BatterySaverPolicyConfig config)64 boolean setAdaptivePowerSavePolicy(in BatterySaverPolicyConfig config); setAdaptivePowerSaveEnabled(boolean enabled)65 boolean setAdaptivePowerSaveEnabled(boolean enabled); getPowerSaveModeTrigger()66 int getPowerSaveModeTrigger(); isDeviceIdleMode()67 boolean isDeviceIdleMode(); isLightDeviceIdleMode()68 boolean isLightDeviceIdleMode(); 69 70 @UnsupportedAppUsage reboot(boolean confirm, String reason, boolean wait)71 void reboot(boolean confirm, String reason, boolean wait); rebootSafeMode(boolean confirm, boolean wait)72 void rebootSafeMode(boolean confirm, boolean wait); shutdown(boolean confirm, String reason, boolean wait)73 void shutdown(boolean confirm, String reason, boolean wait); crash(String message)74 void crash(String message); getLastShutdownReason()75 int getLastShutdownReason(); getLastSleepReason()76 int getLastSleepReason(); 77 setStayOnSetting(int val)78 void setStayOnSetting(int val); boostScreenBrightness(long time)79 void boostScreenBrightness(long time); 80 81 // --- deprecated --- isScreenBrightnessBoosted()82 boolean isScreenBrightnessBoosted(); 83 84 // sets the attention light (used by phone app only) setAttentionLight(boolean on, int color)85 void setAttentionLight(boolean on, int color); 86 87 // controls whether PowerManager should doze after the screen turns off or not setDozeAfterScreenOff(boolean on)88 void setDozeAfterScreenOff(boolean on); 89 // returns whether ambient display is available on the device. isAmbientDisplayAvailable()90 boolean isAmbientDisplayAvailable(); 91 // suppresses the current ambient display configuration and disables ambient display. suppressAmbientDisplay(String token, boolean suppress)92 void suppressAmbientDisplay(String token, boolean suppress); 93 // returns whether ambient display is suppressed by the calling app with the given token. isAmbientDisplaySuppressedForToken(String token)94 boolean isAmbientDisplaySuppressedForToken(String token); 95 // returns whether ambient display is suppressed by any app with any token. isAmbientDisplaySuppressed()96 boolean isAmbientDisplaySuppressed(); 97 98 // Forces the system to suspend even if there are held wakelocks. forceSuspend()99 boolean forceSuspend(); 100 } 101