summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Kasten2014-09-05 18:46:46 -0500
committerGlenn Kasten2014-09-05 19:12:24 -0500
commita602086872ad725d257b3be659a774f032f06d71 (patch)
treefac8c233cc0078000ead15e3ad81027955e52952 /services/powermanager/IPowerManager.cpp
parent253c4720af3ac631ba04eb379aea91ecc3175cd3 (diff)
downloadframeworks-native-a602086872ad725d257b3be659a774f032f06d71.tar.gz
frameworks-native-a602086872ad725d257b3be659a774f032f06d71.tar.xz
frameworks-native-a602086872ad725d257b3be659a774f032f06d71.zip
Make IPowerManager native conform to .aidl for oneway
But provide a temporary escape hatch for AudioFlinger. This oneway option will be removed as soon as possible. Bug: 16408906 Change-Id: I20d6da1969ae05b96e72795463470eb4c1f8fbdc
Diffstat (limited to 'services/powermanager/IPowerManager.cpp')
-rw-r--r--services/powermanager/IPowerManager.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/services/powermanager/IPowerManager.cpp b/services/powermanager/IPowerManager.cpp
index 926c050ae..ec864ee50 100644
--- a/services/powermanager/IPowerManager.cpp
+++ b/services/powermanager/IPowerManager.cpp
@@ -45,7 +45,7 @@ public:
45 } 45 }
46 46
47 virtual status_t acquireWakeLock(int flags, const sp<IBinder>& lock, const String16& tag, 47 virtual status_t acquireWakeLock(int flags, const sp<IBinder>& lock, const String16& tag,
48 const String16& packageName) 48 const String16& packageName, bool isOneWay)
49 { 49 {
50 Parcel data, reply; 50 Parcel data, reply;
51 data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); 51 data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
@@ -56,11 +56,12 @@ public:
56 data.writeString16(packageName); 56 data.writeString16(packageName);
57 data.writeInt32(0); // no WorkSource 57 data.writeInt32(0); // no WorkSource
58 data.writeString16(NULL, 0); // no history tag 58 data.writeString16(NULL, 0); // no history tag
59 return remote()->transact(ACQUIRE_WAKE_LOCK, data, &reply, IBinder::FLAG_ONEWAY); 59 return remote()->transact(ACQUIRE_WAKE_LOCK, data, &reply,
60 isOneWay ? IBinder::FLAG_ONEWAY : 0);
60 } 61 }
61 62
62 virtual status_t acquireWakeLockWithUid(int flags, const sp<IBinder>& lock, const String16& tag, 63 virtual status_t acquireWakeLockWithUid(int flags, const sp<IBinder>& lock, const String16& tag,
63 const String16& packageName, int uid) 64 const String16& packageName, int uid, bool isOneWay)
64 { 65 {
65 Parcel data, reply; 66 Parcel data, reply;
66 data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); 67 data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
@@ -70,26 +71,28 @@ public:
70 data.writeString16(tag); 71 data.writeString16(tag);
71 data.writeString16(packageName); 72 data.writeString16(packageName);
72 data.writeInt32(uid); // uid to blame for the work 73 data.writeInt32(uid); // uid to blame for the work
73 return remote()->transact(ACQUIRE_WAKE_LOCK_UID, data, &reply, IBinder::FLAG_ONEWAY); 74 return remote()->transact(ACQUIRE_WAKE_LOCK_UID, data, &reply,
75 isOneWay ? IBinder::FLAG_ONEWAY : 0);
74 } 76 }
75 77
76 virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags) 78 virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags, bool isOneWay)
77 { 79 {
78 Parcel data, reply; 80 Parcel data, reply;
79 data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); 81 data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
80 data.writeStrongBinder(lock); 82 data.writeStrongBinder(lock);
81 data.writeInt32(flags); 83 data.writeInt32(flags);
82 return remote()->transact(RELEASE_WAKE_LOCK, data, &reply, IBinder::FLAG_ONEWAY); 84 return remote()->transact(RELEASE_WAKE_LOCK, data, &reply,
85 isOneWay ? IBinder::FLAG_ONEWAY : 0);
83 } 86 }
84 87
85 virtual status_t updateWakeLockUids(const sp<IBinder>& lock, int len, const int *uids) { 88 virtual status_t updateWakeLockUids(const sp<IBinder>& lock, int len, const int *uids,
89 bool isOneWay) {
86 Parcel data, reply; 90 Parcel data, reply;
87 data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); 91 data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
88 data.writeStrongBinder(lock); 92 data.writeStrongBinder(lock);
89 data.writeInt32Array(len, uids); 93 data.writeInt32Array(len, uids);
90 // We don't really care too much if this succeeds (there's nothing we can do if it doesn't) 94 return remote()->transact(UPDATE_WAKE_LOCK_UIDS, data, &reply,
91 // but it should return ASAP 95 isOneWay ? IBinder::FLAG_ONEWAY : 0);
92 return remote()->transact(UPDATE_WAKE_LOCK_UIDS, data, &reply, IBinder::FLAG_ONEWAY);
93 } 96 }
94 97
95 virtual status_t powerHint(int hintId, int param) 98 virtual status_t powerHint(int hintId, int param)
@@ -98,6 +101,7 @@ public:
98 data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); 101 data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
99 data.writeInt32(hintId); 102 data.writeInt32(hintId);
100 data.writeInt32(param); 103 data.writeInt32(param);
104 // This FLAG_ONEWAY is in the .aidl, so there is no way to disable it
101 return remote()->transact(POWER_HINT, data, &reply, IBinder::FLAG_ONEWAY); 105 return remote()->transact(POWER_HINT, data, &reply, IBinder::FLAG_ONEWAY);
102 } 106 }
103}; 107};