diff options
author | Colin Cross | 2012-03-28 15:55:43 -0500 |
---|---|---|
committer | Colin Cross | 2012-03-28 15:58:23 -0500 |
commit | b731ae01b15682a3326dc4145f614f919b2789b5 (patch) | |
tree | b459e615f0ef7d8c95aa283b2a2d0bd3b4d914f7 /services/powermanager/IPowerManager.cpp | |
parent | 9e0b1f880bd790b6e4643387668c74729b891a10 (diff) | |
download | frameworks-native-b731ae01b15682a3326dc4145f614f919b2789b5.tar.gz frameworks-native-b731ae01b15682a3326dc4145f614f919b2789b5.tar.xz frameworks-native-b731ae01b15682a3326dc4145f614f919b2789b5.zip |
Move services/powermanager from frameworks/base to frameworks/native
Move services/powermanager into frameworks/native so audioflinger can
use it. Note that this is not the same as a PowerManagerService,
which is part of systemserver and handles turning the screen on and
off, etc. This is just a binder interface to allow taking wakelocks.
Change-Id: I6b6a8b41cdbad17e826fda45aab5f059f22fc64e
Diffstat (limited to 'services/powermanager/IPowerManager.cpp')
-rw-r--r-- | services/powermanager/IPowerManager.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/services/powermanager/IPowerManager.cpp b/services/powermanager/IPowerManager.cpp new file mode 100644 index 000000000..a0f19d4ac --- /dev/null +++ b/services/powermanager/IPowerManager.cpp | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 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 | #define LOG_TAG "IPowerManager" | ||
18 | //#define LOG_NDEBUG 0 | ||
19 | #include <utils/Log.h> | ||
20 | |||
21 | #include <stdint.h> | ||
22 | #include <sys/types.h> | ||
23 | |||
24 | #include <binder/Parcel.h> | ||
25 | |||
26 | #include <powermanager/IPowerManager.h> | ||
27 | |||
28 | namespace android { | ||
29 | |||
30 | // must be kept in sync with IPowerManager.aidl | ||
31 | enum { | ||
32 | ACQUIRE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION, | ||
33 | RELEASE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION + 4, | ||
34 | }; | ||
35 | |||
36 | class BpPowerManager : public BpInterface<IPowerManager> | ||
37 | { | ||
38 | public: | ||
39 | BpPowerManager(const sp<IBinder>& impl) | ||
40 | : BpInterface<IPowerManager>(impl) | ||
41 | { | ||
42 | } | ||
43 | |||
44 | virtual status_t acquireWakeLock(int flags, const sp<IBinder>& lock, const String16& tag) | ||
45 | { | ||
46 | Parcel data, reply; | ||
47 | data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); | ||
48 | |||
49 | data.writeInt32(flags); | ||
50 | data.writeStrongBinder(lock); | ||
51 | data.writeString16(tag); | ||
52 | // no WorkSource passed | ||
53 | data.writeInt32(0); | ||
54 | return remote()->transact(ACQUIRE_WAKE_LOCK, data, &reply); | ||
55 | } | ||
56 | |||
57 | virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags) | ||
58 | { | ||
59 | Parcel data, reply; | ||
60 | data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); | ||
61 | data.writeStrongBinder(lock); | ||
62 | data.writeInt32(flags); | ||
63 | return remote()->transact(RELEASE_WAKE_LOCK, data, &reply); | ||
64 | } | ||
65 | }; | ||
66 | |||
67 | IMPLEMENT_META_INTERFACE(PowerManager, "android.os.IPowerManager"); | ||
68 | |||
69 | // ---------------------------------------------------------------------------- | ||
70 | |||
71 | }; // namespace android | ||