From 2cbba477bea136698944ece498115dbddd7bb659 Mon Sep 17 00:00:00 2001 From: Chong Zhang Date: Wed, 23 Jul 2014 14:47:00 -0700 Subject: [PATCH] add noteResetVideo/Audio to IBatteryStats Bug: 12979595 Change-Id: Ida474e539a3af0a85ec157a66bbf986430c8020e --- include/binder/IBatteryStats.h | 4 ++++ libs/binder/IBatteryStats.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/binder/IBatteryStats.h b/include/binder/IBatteryStats.h index ff3de243f..7ddac574b 100644 --- a/include/binder/IBatteryStats.h +++ b/include/binder/IBatteryStats.h @@ -34,6 +34,8 @@ public: virtual void noteStopVideo(int uid) = 0; virtual void noteStartAudio(int uid) = 0; virtual void noteStopAudio(int uid) = 0; + virtual void noteResetVideo() = 0; + virtual void noteResetAudio() = 0; enum { NOTE_START_SENSOR_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, @@ -42,6 +44,8 @@ public: NOTE_STOP_VIDEO_TRANSACTION, NOTE_START_AUDIO_TRANSACTION, NOTE_STOP_AUDIO_TRANSACTION, + NOTE_RESET_VIDEO_TRANSACTION, + NOTE_RESET_AUDIO_TRANSACTION, }; }; diff --git a/libs/binder/IBatteryStats.cpp b/libs/binder/IBatteryStats.cpp index 82bde622e..8f3b7b49a 100644 --- a/libs/binder/IBatteryStats.cpp +++ b/libs/binder/IBatteryStats.cpp @@ -77,6 +77,18 @@ public: data.writeInt32(uid); remote()->transact(NOTE_STOP_AUDIO_TRANSACTION, data, &reply); } + + virtual void noteResetVideo() { + Parcel data, reply; + data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); + remote()->transact(NOTE_RESET_VIDEO_TRANSACTION, data, &reply); + } + + virtual void noteResetAudio() { + Parcel data, reply; + data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); + remote()->transact(NOTE_RESET_AUDIO_TRANSACTION, data, &reply); + } }; IMPLEMENT_META_INTERFACE(BatteryStats, "com.android.internal.app.IBatteryStats"); @@ -131,6 +143,18 @@ status_t BnBatteryStats::onTransact( reply->writeNoException(); return NO_ERROR; } break; + case NOTE_RESET_VIDEO_TRANSACTION: { + CHECK_INTERFACE(IBatteryStats, data, reply); + noteResetVideo(); + reply->writeNoException(); + return NO_ERROR; + } break; + case NOTE_RESET_AUDIO_TRANSACTION: { + CHECK_INTERFACE(IBatteryStats, data, reply); + noteResetAudio(); + reply->writeNoException(); + return NO_ERROR; + } break; default: return BBinder::onTransact(code, data, reply, flags); }