diff options
author | Gloria Wang <gwang@google.com> | 2011-02-19 18:37:57 -0800 |
---|---|---|
committer | Gloria Wang <gwang@google.com> | 2011-02-22 22:42:05 -0800 |
commit | d211f41f764fe81fe00b10a99b4b44cb84479cbe (patch) | |
tree | 462cf2a7da5216c45c5f105dac33ef607f893972 /media/jni | |
parent | 25474a2230152700e5f7eb7e1495be40c6bd26a8 (diff) | |
download | frameworks_base-d211f41f764fe81fe00b10a99b4b44cb84479cbe.zip frameworks_base-d211f41f764fe81fe00b10a99b4b44cb84479cbe.tar.gz frameworks_base-d211f41f764fe81fe00b10a99b4b44cb84479cbe.tar.bz2 |
- Add method in MediaPlayerService to collect and pull
codec usage (duration) for the battery app
- Collect MediaPlayer decoding usage data
Change-Id: I0ef4e32b6a041ba1fe73c19f9c67185c61d03965
Diffstat (limited to 'media/jni')
-rw-r--r-- | media/jni/android_media_MediaPlayer.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp index 0884e35..ca54432 100644 --- a/media/jni/android_media_MediaPlayer.cpp +++ b/media/jni/android_media_MediaPlayer.cpp @@ -36,6 +36,8 @@ #include "android_util_Binder.h" #include <binder/Parcel.h> #include <surfaceflinger/Surface.h> +#include <binder/IPCThreadState.h> +#include <binder/IServiceManager.h> // ---------------------------------------------------------------------------- @@ -723,6 +725,21 @@ static void android_media_MediaPlayer_attachAuxEffect(JNIEnv *env, jobject thiz process_media_player_call( env, thiz, mp->attachAuxEffect(effectId), NULL, NULL ); } +static jint +android_media_MediaPlayer_pullBatteryData(JNIEnv *env, jobject thiz, jobject java_reply) +{ + sp<IBinder> binder = defaultServiceManager()->getService(String16("media.player")); + sp<IMediaPlayerService> service = interface_cast<IMediaPlayerService>(binder); + if (service.get() == NULL) { + jniThrowException(env, "java/lang/RuntimeException", "cannot get MediaPlayerService"); + return UNKNOWN_ERROR; + } + + Parcel *reply = parcelForJavaObject(env, java_reply); + + return service->pullBatteryData(reply); +} + // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { @@ -758,6 +775,7 @@ static JNINativeMethod gMethods[] = { {"setAudioSessionId", "(I)V", (void *)android_media_MediaPlayer_set_audio_session_id}, {"setAuxEffectSendLevel", "(F)V", (void *)android_media_MediaPlayer_setAuxEffectSendLevel}, {"attachAuxEffect", "(I)V", (void *)android_media_MediaPlayer_attachAuxEffect}, + {"native_pullBatteryData", "(Landroid/os/Parcel;)I", (void *)android_media_MediaPlayer_pullBatteryData}, }; static const char* const kClassPathName = "android/media/MediaPlayer"; |