am 2cbba477: add noteResetVideo/Audio to IBatteryStats

* commit '2cbba477bea136698944ece498115dbddd7bb659':
  add noteResetVideo/Audio to IBatteryStats
This commit is contained in:
Chong Zhang 2014-07-23 22:04:39 +00:00 committed by Android Git Automerger
commit 27981c1aa6
2 changed files with 28 additions and 0 deletions

View File

@ -34,6 +34,8 @@ public:
virtual void noteStopVideo(int uid) = 0; virtual void noteStopVideo(int uid) = 0;
virtual void noteStartAudio(int uid) = 0; virtual void noteStartAudio(int uid) = 0;
virtual void noteStopAudio(int uid) = 0; virtual void noteStopAudio(int uid) = 0;
virtual void noteResetVideo() = 0;
virtual void noteResetAudio() = 0;
enum { enum {
NOTE_START_SENSOR_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, NOTE_START_SENSOR_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
@ -42,6 +44,8 @@ public:
NOTE_STOP_VIDEO_TRANSACTION, NOTE_STOP_VIDEO_TRANSACTION,
NOTE_START_AUDIO_TRANSACTION, NOTE_START_AUDIO_TRANSACTION,
NOTE_STOP_AUDIO_TRANSACTION, NOTE_STOP_AUDIO_TRANSACTION,
NOTE_RESET_VIDEO_TRANSACTION,
NOTE_RESET_AUDIO_TRANSACTION,
}; };
}; };

View File

@ -77,6 +77,18 @@ public:
data.writeInt32(uid); data.writeInt32(uid);
remote()->transact(NOTE_STOP_AUDIO_TRANSACTION, data, &reply); 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"); IMPLEMENT_META_INTERFACE(BatteryStats, "com.android.internal.app.IBatteryStats");
@ -131,6 +143,18 @@ status_t BnBatteryStats::onTransact(
reply->writeNoException(); reply->writeNoException();
return NO_ERROR; return NO_ERROR;
} break; } 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: default:
return BBinder::onTransact(code, data, reply, flags); return BBinder::onTransact(code, data, reply, flags);
} }