diff options
author | Marco Nelissen <marcone@google.com> | 2013-06-14 09:42:26 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2013-06-14 09:47:27 -0700 |
commit | 2d2cd32cc7293bbb48b0f0e70a0dc7eb05cac9d3 (patch) | |
tree | fde2aba9b1d88e88e8d5dc18f1a374e807c8a6d6 /media | |
parent | 85c28e81833844a87cf2ca09866eb4c2b33c6709 (diff) | |
download | frameworks_base-2d2cd32cc7293bbb48b0f0e70a0dc7eb05cac9d3.zip frameworks_base-2d2cd32cc7293bbb48b0f0e70a0dc7eb05cac9d3.tar.gz frameworks_base-2d2cd32cc7293bbb48b0f0e70a0dc7eb05cac9d3.tar.bz2 |
Make MediaPlayer.invoke() public-and-hidden again
It's used in a bunch of other places in other repos that I don't
want to touch.
Change-Id: I6f2ec6f8066286de9b52499fc71f3f08953c3cb4
Diffstat (limited to 'media')
3 files changed, 77 insertions, 2 deletions
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java index e5f0cd9..241c7fa 100644 --- a/media/java/android/media/MediaPlayer.java +++ b/media/java/android/media/MediaPlayer.java @@ -619,8 +619,9 @@ public class MediaPlayer * * @return A parcel suitable to hold a request for the native * player. + * {@hide} */ - private Parcel newRequest() { + public Parcel newRequest() { Parcel parcel = Parcel.obtain(); parcel.writeInterfaceToken(IMEDIA_PLAYER); return parcel; @@ -638,8 +639,9 @@ public class MediaPlayer * * @param reply Output parcel with the data returned by the * native player. + * {@hide} */ - private void invoke(Parcel request, Parcel reply) { + public void invoke(Parcel request, Parcel reply) { int retcode = native_invoke(request, reply); reply.setDataPosition(0); if (retcode != 0) { diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java index 8b9cb9c..cbb6642 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java @@ -19,6 +19,7 @@ package com.android.mediaframeworktest; import com.android.mediaframeworktest.functional.CameraTest; import com.android.mediaframeworktest.functional.MediaMetadataTest; import com.android.mediaframeworktest.functional.MediaMimeTest; +import com.android.mediaframeworktest.functional.MediaPlayerInvokeTest; import com.android.mediaframeworktest.functional.mediaplayback.MediaPlayerApiTest; import com.android.mediaframeworktest.functional.mediarecorder.MediaRecorderTest; import com.android.mediaframeworktest.functional.audio.SimTonesTest; @@ -66,6 +67,7 @@ public class MediaFrameworkTestRunner extends InstrumentationTestRunner { suite.addTestSuite(MediaRecorderTest.class); suite.addTestSuite(MediaAudioTrackTest.class); suite.addTestSuite(MediaMimeTest.class); + suite.addTestSuite(MediaPlayerInvokeTest.class); suite.addTestSuite(MediaAudioManagerTest.class); suite.addTestSuite(MediaAudioEffectTest.class); suite.addTestSuite(MediaBassBoostTest.class); diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerInvokeTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerInvokeTest.java new file mode 100644 index 0000000..55a1545 --- /dev/null +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerInvokeTest.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.mediaframeworktest.functional; + +import com.android.mediaframeworktest.MediaFrameworkTest; +import com.android.mediaframeworktest.MediaNames; + +import android.test.ActivityInstrumentationTestCase2; +import android.util.Log; +import android.test.suitebuilder.annotation.LargeTest; +import android.test.suitebuilder.annotation.MediumTest; +import android.test.suitebuilder.annotation.Suppress; + +import android.media.MediaPlayer; +import android.os.Parcel; + +import java.util.Calendar; +import java.util.Random; + +// Tests for the invoke method in the MediaPlayer. +public class MediaPlayerInvokeTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> { + private static final String TAG = "MediaPlayerInvokeTest"; + private MediaPlayer mPlayer; + private Random rnd; + + public MediaPlayerInvokeTest() { + super("com.android.mediaframeworktest", MediaFrameworkTest.class); + rnd = new Random(Calendar.getInstance().getTimeInMillis()); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + mPlayer = new MediaPlayer(); + } + + @Override + protected void tearDown() throws Exception { + mPlayer.release(); + super.tearDown(); + } + + // Generate a random number, sends it to the ping test player. + @Suppress + @MediumTest + public void testPing() throws Exception { + mPlayer.setDataSource("test:invoke_mock_media_player.so?url=ping"); + + Parcel request = mPlayer.newRequest(); + Parcel reply = Parcel.obtain(); + + int val = rnd.nextInt(); + request.writeInt(val); + mPlayer.invoke(request, reply); + assertEquals(val, reply.readInt()); + } +} |