diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2015-06-02 01:48:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-02 01:48:25 +0000 |
commit | 7e5bb3701a313e539447c96ee2b31df62edc79fe (patch) | |
tree | d4df44580ac92f76ed24b9d3353c3f02f0b45d0f /libs | |
parent | 5a31f1abf69eaf4c25a84d53e318c0a716911786 (diff) | |
parent | d47da608366cf1c2649b5dd2759d36e30377fa54 (diff) | |
download | frameworks_native-7e5bb3701a313e539447c96ee2b31df62edc79fe.zip frameworks_native-7e5bb3701a313e539447c96ee2b31df62edc79fe.tar.gz frameworks_native-7e5bb3701a313e539447c96ee2b31df62edc79fe.tar.bz2 |
Merge "Track camera and flashlight usage in battery stats." into mnc-dev
Diffstat (limited to 'libs')
-rw-r--r-- | libs/binder/IBatteryStats.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/libs/binder/IBatteryStats.cpp b/libs/binder/IBatteryStats.cpp index 8f3b7b4..e32c628 100644 --- a/libs/binder/IBatteryStats.cpp +++ b/libs/binder/IBatteryStats.cpp @@ -89,6 +89,47 @@ public: data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); remote()->transact(NOTE_RESET_AUDIO_TRANSACTION, data, &reply); } + + virtual void noteFlashlightOn(int uid) { + Parcel data, reply; + data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); + data.writeInt32(uid); + remote()->transact(NOTE_FLASHLIGHT_ON_TRANSACTION, data, &reply); + } + + virtual void noteFlashlightOff(int uid) { + Parcel data, reply; + data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); + data.writeInt32(uid); + remote()->transact(NOTE_FLASHLIGHT_OFF_TRANSACTION, data, &reply); + } + + virtual void noteStartCamera(int uid) { + Parcel data, reply; + data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); + data.writeInt32(uid); + remote()->transact(NOTE_START_CAMERA_TRANSACTION, data, &reply); + } + + virtual void noteStopCamera(int uid) { + Parcel data, reply; + data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); + data.writeInt32(uid); + remote()->transact(NOTE_STOP_CAMERA_TRANSACTION, data, &reply); + } + + virtual void noteResetCamera() { + Parcel data, reply; + data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); + remote()->transact(NOTE_RESET_CAMERA_TRANSACTION, data, &reply); + } + + virtual void noteResetFlashlight() { + Parcel data, reply; + data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); + remote()->transact(NOTE_RESET_FLASHLIGHT_TRANSACTION, data, &reply); + } + }; IMPLEMENT_META_INTERFACE(BatteryStats, "com.android.internal.app.IBatteryStats"); @@ -155,6 +196,46 @@ status_t BnBatteryStats::onTransact( reply->writeNoException(); return NO_ERROR; } break; + case NOTE_FLASHLIGHT_ON_TRANSACTION: { + CHECK_INTERFACE(IBatteryStats, data, reply); + int uid = data.readInt32(); + noteFlashlightOn(uid); + reply->writeNoException(); + return NO_ERROR; + } break; + case NOTE_FLASHLIGHT_OFF_TRANSACTION: { + CHECK_INTERFACE(IBatteryStats, data, reply); + int uid = data.readInt32(); + noteFlashlightOff(uid); + reply->writeNoException(); + return NO_ERROR; + } break; + case NOTE_START_CAMERA_TRANSACTION: { + CHECK_INTERFACE(IBatteryStats, data, reply); + int uid = data.readInt32(); + noteStartCamera(uid); + reply->writeNoException(); + return NO_ERROR; + } break; + case NOTE_STOP_CAMERA_TRANSACTION: { + CHECK_INTERFACE(IBatteryStats, data, reply); + int uid = data.readInt32(); + noteStopCamera(uid); + reply->writeNoException(); + return NO_ERROR; + } break; + case NOTE_RESET_CAMERA_TRANSACTION: { + CHECK_INTERFACE(IBatteryStats, data, reply); + noteResetCamera(); + reply->writeNoException(); + return NO_ERROR; + } break; + case NOTE_RESET_FLASHLIGHT_TRANSACTION: { + CHECK_INTERFACE(IBatteryStats, data, reply); + noteResetFlashlight(); + reply->writeNoException(); + return NO_ERROR; + } break; default: return BBinder::onTransact(code, data, reply, flags); } |