| 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.ParcelDuration; |
| 22 |
import android.os.PowerSaveState; |
| 23 |
import android.os.WorkSource; |
| 24 |
import android.os.IWakeLockCallback; |
| 25 |
|
| 26 |
/** @hide */ |
| 27 |
|
| 28 |
interface IPowerManager |
| 29 |
{ |
| 30 |
void acquireWakeLock(IBinder lock, int flags, String tag, String packageName, in WorkSource ws, |
| 31 |
String historyTag, int displayId, IWakeLockCallback callback); |
| 32 |
void acquireWakeLockWithUid(IBinder lock, int flags, String tag, String packageName, |
| 33 |
int uidtoblame, int displayId, IWakeLockCallback callback); |
| 34 |
@UnsupportedAppUsage |
| 35 |
void releaseWakeLock(IBinder lock, int flags); |
| 36 |
void updateWakeLockUids(IBinder lock, in int[] uids); |
| 37 |
oneway void setPowerBoost(int boost, int durationMs); |
| 38 |
oneway void setPowerMode(int mode, boolean enabled); |
| 39 |
|
| 40 |
// Functionally identical to setPowerMode, but returns whether the call was successful |
| 41 |
boolean setPowerModeChecked(int mode, boolean enabled); |
| 42 |
|
| 43 |
void updateWakeLockWorkSource(IBinder lock, in WorkSource ws, String historyTag); |
| 44 |
void updateWakeLockCallback(IBinder lock, IWakeLockCallback callback); |
| 45 |
boolean isWakeLockLevelSupported(int level); |
| 46 |
|
| 47 |
void userActivity(int displayId, long time, int event, int flags); |
| 48 |
void wakeUp(long time, int reason, String details, String opPackageName); |
| 49 |
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) |
| 50 |
void goToSleep(long time, int reason, int flags); |
| 51 |
@UnsupportedAppUsage(maxTargetSdk = 28) |
| 52 |
void nap(long time); |
| 53 |
float getBrightnessConstraint(int constraint); |
| 54 |
@UnsupportedAppUsage |
| 55 |
boolean isInteractive(); |
| 56 |
boolean isPowerSaveMode(); |
| 57 |
PowerSaveState getPowerSaveState(int serviceType); |
| 58 |
boolean setPowerSaveModeEnabled(boolean mode); |
| 59 |
BatterySaverPolicyConfig getFullPowerSavePolicy(); |
| 60 |
boolean setFullPowerSavePolicy(in BatterySaverPolicyConfig config); |
| 61 |
boolean setDynamicPowerSaveHint(boolean powerSaveHint, int disableThreshold); |
| 62 |
boolean setAdaptivePowerSavePolicy(in BatterySaverPolicyConfig config); |
| 63 |
boolean setAdaptivePowerSaveEnabled(boolean enabled); |
| 64 |
int getPowerSaveModeTrigger(); |
| 65 |
void setBatteryDischargePrediction(in ParcelDuration timeRemaining, boolean isCustomized); |
| 66 |
ParcelDuration getBatteryDischargePrediction(); |
| 67 |
boolean isBatteryDischargePredictionPersonalized(); |
| 68 |
boolean isDeviceIdleMode(); |
| 69 |
boolean isLightDeviceIdleMode(); |
| 70 |
boolean isLowPowerStandbySupported(); |
| 71 |
boolean isLowPowerStandbyEnabled(); |
| 72 |
void setLowPowerStandbyEnabled(boolean enabled); |
| 73 |
void setLowPowerStandbyActiveDuringMaintenance(boolean activeDuringMaintenance); |
| 74 |
void forceLowPowerStandbyActive(boolean active); |
| 75 |
|
| 76 |
@UnsupportedAppUsage |
| 77 |
void reboot(boolean confirm, String reason, boolean wait); |
| 78 |
void rebootSafeMode(boolean confirm, boolean wait); |
| 79 |
void shutdown(boolean confirm, String reason, boolean wait); |
| 80 |
void crash(String message); |
| 81 |
int getLastShutdownReason(); |
| 82 |
int getLastSleepReason(); |
| 83 |
|
| 84 |
void setStayOnSetting(int val); |
| 85 |
void boostScreenBrightness(long time); |
| 86 |
|
| 87 |
// Do not use, will be deprecated soon. b/151831987 |
| 88 |
oneway void acquireWakeLockAsync(IBinder lock, int flags, String tag, String packageName, |
| 89 |
in WorkSource ws, String historyTag); |
| 90 |
oneway void releaseWakeLockAsync(IBinder lock, int flags); |
| 91 |
oneway void updateWakeLockUidsAsync(IBinder lock, in int[] uids); |
| 92 |
|
| 93 |
// --- deprecated --- |
| 94 |
boolean isScreenBrightnessBoosted(); |
| 95 |
|
| 96 |
// sets the attention light (used by phone app only) |
| 97 |
void setAttentionLight(boolean on, int color); |
| 98 |
|
| 99 |
// controls whether PowerManager should doze after the screen turns off or not |
| 100 |
void setDozeAfterScreenOff(boolean on); |
| 101 |
// returns whether ambient display is available on the device. |
| 102 |
boolean isAmbientDisplayAvailable(); |
| 103 |
// suppresses the current ambient display configuration and disables ambient display. |
| 104 |
void suppressAmbientDisplay(String token, boolean suppress); |
| 105 |
// returns whether ambient display is suppressed by the calling app with the given token. |
| 106 |
boolean isAmbientDisplaySuppressedForToken(String token); |
| 107 |
// returns whether ambient display is suppressed by any app with any token. |
| 108 |
boolean isAmbientDisplaySuppressed(); |
| 109 |
// returns whether ambient display is suppressed by the given app with the given token. |
| 110 |
boolean isAmbientDisplaySuppressedForTokenByApp(String token, int appUid); |
| 111 |
|
| 112 |
// Forces the system to suspend even if there are held wakelocks. |
| 113 |
boolean forceSuspend(); |
| 114 |
|
| 115 |
const int LOCATION_MODE_NO_CHANGE = 0; |
| 116 |
const int LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF = 1; |
| 117 |
const int LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF = 2; |
| 118 |
const int LOCATION_MODE_FOREGROUND_ONLY = 3; |
| 119 |
const int LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF = 4; |
| 120 |
const int MIN_LOCATION_MODE = 0; |
| 121 |
const int MAX_LOCATION_MODE = 4; |
| 122 |
|
| 123 |
const int GO_TO_SLEEP_REASON_MIN = 0; |
| 124 |
const int GO_TO_SLEEP_REASON_APPLICATION = 0; |
| 125 |
const int GO_TO_SLEEP_REASON_TIMEOUT = 2; |
| 126 |
const int GO_TO_SLEEP_REASON_LID_SWITCH = 3; |
| 127 |
const int GO_TO_SLEEP_REASON_POWER_BUTTON = 4; |
| 128 |
const int GO_TO_SLEEP_REASON_HDMI = 5; |
| 129 |
const int GO_TO_SLEEP_REASON_SLEEP_BUTTON = 6; |
| 130 |
const int GO_TO_SLEEP_REASON_ACCESSIBILITY = 7; |
| 131 |
const int GO_TO_SLEEP_REASON_FORCE_SUSPEND = 8; |
| 132 |
const int GO_TO_SLEEP_REASON_INATTENTIVE = 9; |
| 133 |
const int GO_TO_SLEEP_REASON_QUIESCENT = 10; |
| 134 |
const int GO_TO_SLEEP_REASON_MAX = 10; |
| 135 |
const int GO_TO_SLEEP_FLAG_NO_DOZE = 1 << 0; |
| 136 |
|
| 137 |
} |