add noteResetVideo/Audio to IBatteryStats

Bug: 12979595
Change-Id: Ida474e539a3af0a85ec157a66bbf986430c8020e
This commit is contained in:
Chong Zhang 2014-07-23 14:47:00 -07:00
parent 45e695a248
commit 2cbba477be
2 changed files with 28 additions and 0 deletions

View File

@ -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,
};
};

View File

@ -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);
}