Add cpp native headers for IPowerManager.aidl parcelables.

Expose IPowerManager.aidl to native libpowermanager to generate
native cpp source files, and add native headers to parcelables used
by IPowerManager.aidl.

Bug: 149479744
Test: atest PowerManagerServiceTest

Change-Id: I0d74a457806f4937c8e17f52de453b3205dd3600
This commit is contained in:
Chris Ye
2020-02-28 21:42:19 -08:00
parent 0652f0d8af
commit 590ff6e8bd
6 changed files with 49 additions and 8 deletions

View File

@@ -478,6 +478,7 @@ filegroup {
"core/java/android/os/IThermalEventListener.aidl",
"core/java/android/os/IThermalStatusListener.aidl",
"core/java/android/os/IThermalService.aidl",
"core/java/android/os/IPowerManager.aidl",
],
path: "core/java",
}

View File

@@ -16,4 +16,4 @@
package android.os;
parcelable BatterySaverPolicyConfig;
parcelable BatterySaverPolicyConfig cpp_header "android/BatterySaverPolicyConfig.h";

View File

@@ -25,11 +25,6 @@ import android.os.WorkSource;
interface IPowerManager
{
// WARNING: When methods are inserted or deleted, the transaction IDs in
// frameworks/native/include/powermanager/IPowerManager.h must be updated to match the order in this file.
//
// When a method's argument list is changed, BnPowerManager's corresponding serialization code (if any) in
// frameworks/native/services/powermanager/IPowerManager.cpp must be updated.
void acquireWakeLock(IBinder lock, int flags, String tag, String packageName, in WorkSource ws,
String historyTag);
void acquireWakeLockWithUid(IBinder lock, int flags, String tag, String packageName,
@@ -78,6 +73,12 @@ interface IPowerManager
void setStayOnSetting(int val);
void boostScreenBrightness(long time);
// Do not use, will be deprecated soon. b/151831987
oneway void acquireWakeLockAsync(IBinder lock, int flags, String tag, String packageName,
in WorkSource ws, String historyTag);
oneway void releaseWakeLockAsync(IBinder lock, int flags);
oneway void updateWakeLockUidsAsync(IBinder lock, in int[] uids);
// --- deprecated ---
boolean isScreenBrightnessBoosted();
@@ -97,4 +98,27 @@ interface IPowerManager
// Forces the system to suspend even if there are held wakelocks.
boolean forceSuspend();
const int LOCATION_MODE_NO_CHANGE = 0;
const int LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF = 1;
const int LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF = 2;
const int LOCATION_MODE_FOREGROUND_ONLY = 3;
const int LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF = 4;
const int MIN_LOCATION_MODE = 0;
const int MAX_LOCATION_MODE = 4;
const int GO_TO_SLEEP_REASON_MIN = 0;
const int GO_TO_SLEEP_REASON_APPLICATION = 0;
const int GO_TO_SLEEP_REASON_TIMEOUT = 2;
const int GO_TO_SLEEP_REASON_LID_SWITCH = 3;
const int GO_TO_SLEEP_REASON_POWER_BUTTON = 4;
const int GO_TO_SLEEP_REASON_HDMI = 5;
const int GO_TO_SLEEP_REASON_SLEEP_BUTTON = 6;
const int GO_TO_SLEEP_REASON_ACCESSIBILITY = 7;
const int GO_TO_SLEEP_REASON_FORCE_SUSPEND = 8;
const int GO_TO_SLEEP_REASON_INATTENTIVE = 9;
const int GO_TO_SLEEP_REASON_QUIESCENT = 10;
const int GO_TO_SLEEP_REASON_MAX = 10;
const int GO_TO_SLEEP_FLAG_NO_DOZE = 1 << 0;
}

View File

@@ -16,4 +16,4 @@
package android.os;
parcelable PowerSaveState;
parcelable PowerSaveState cpp_header "android/PowerSaveState.h";

View File

@@ -15,4 +15,4 @@
package android.os;
parcelable WorkSource;
parcelable WorkSource cpp_header "android/WorkSource.h";

View File

@@ -4785,6 +4785,12 @@ public final class PowerManagerService extends SystemService
}
}
@Override // Binder call
public void acquireWakeLockAsync(IBinder lock, int flags, String tag, String packageName,
WorkSource ws, String historyTag) {
acquireWakeLock(lock, flags, tag, packageName, ws, historyTag);
}
@Override // Binder call
public void releaseWakeLock(IBinder lock, int flags) {
if (lock == null) {
@@ -4801,6 +4807,11 @@ public final class PowerManagerService extends SystemService
}
}
@Override // Binder call
public void releaseWakeLockAsync(IBinder lock, int flags) {
releaseWakeLock(lock, flags);
}
@Override // Binder call
public void updateWakeLockUids(IBinder lock, int[] uids) {
WorkSource ws = null;
@@ -4816,6 +4827,11 @@ public final class PowerManagerService extends SystemService
updateWakeLockWorkSource(lock, ws, null);
}
@Override // Binder call
public void updateWakeLockUidsAsync(IBinder lock, int[] uids) {
updateWakeLockUids(lock, uids);
}
@Override // Binder call
public void updateWakeLockWorkSource(IBinder lock, WorkSource ws, String historyTag) {
if (lock == null) {