Fix MediaStubActivity Layout
Change the mediaplayer layout to evenly distribute the
three SurfaceViews so that all three are always visible
regardless of screen size. The videos do stretch a bit
weird, but the tests still work.
Remove the manual setting of width and height and the
deprecated push buffers setting in MediaStubActivity.
Change-Id: I40025b3a24dae7acdd9a3a3ed7d85484b09fe9e5
diff --git a/tests/res/layout-land/mediaplayer.xml b/tests/res/layout-land/mediaplayer.xml
new file mode 100644
index 0000000..28ec039
--- /dev/null
+++ b/tests/res/layout-land/mediaplayer.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * 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.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <SurfaceView android:id="@+id/surface"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+ </SurfaceView>
+
+ <SurfaceView android:id="@+id/surface2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+ </SurfaceView>
+
+ <SurfaceView android:id="@+id/surface3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+ </SurfaceView>
+
+
+</LinearLayout>
diff --git a/tests/res/layout/mediaplayer.xml b/tests/res/layout/mediaplayer.xml
index aa66e64..0db813b 100644
--- a/tests/res/layout/mediaplayer.xml
+++ b/tests/res/layout/mediaplayer.xml
@@ -22,19 +22,19 @@
<SurfaceView android:id="@+id/surface"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center">
+ android:layout_weight="1">
</SurfaceView>
<SurfaceView android:id="@+id/surface2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center">
+ android:layout_weight="1">
</SurfaceView>
<SurfaceView android:id="@+id/surface3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center">
+ android:layout_weight="1">
</SurfaceView>
</LinearLayout>
diff --git a/tests/src/android/media/cts/MediaStubActivity.java b/tests/src/android/media/cts/MediaStubActivity.java
index f0ca755..114772e 100644
--- a/tests/src/android/media/cts/MediaStubActivity.java
+++ b/tests/src/android/media/cts/MediaStubActivity.java
@@ -16,15 +16,14 @@
package android.media.cts;
import com.android.cts.stub.R;
+
import android.app.Activity;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
-import android.view.ViewGroup;
public class MediaStubActivity extends Activity {
- public static final int WIDTH = 320;
- public static final int HEIGHT = 240;
+
private SurfaceHolder mHolder;
private SurfaceHolder mHolder2;
@@ -34,23 +33,10 @@
setContentView(R.layout.mediaplayer);
SurfaceView surfaceV = (SurfaceView)findViewById(R.id.surface);
- ViewGroup.LayoutParams lp = surfaceV.getLayoutParams();
- lp.width = WIDTH;
- lp.height = HEIGHT;
- surfaceV.setLayoutParams(lp);
mHolder = surfaceV.getHolder();
- mHolder.setFixedSize(WIDTH, HEIGHT);
- mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
SurfaceView surfaceV2 = (SurfaceView)findViewById(R.id.surface2);
- ViewGroup.LayoutParams lp2 = surfaceV2.getLayoutParams();
- lp2.width = WIDTH;
- lp2.height = HEIGHT;
- surfaceV2.setLayoutParams(lp2);
mHolder2 = surfaceV2.getHolder();
- mHolder2.setFixedSize(WIDTH, HEIGHT);
- mHolder2.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
-
}
public SurfaceHolder getSurfaceHolder() {
@@ -60,9 +46,4 @@
public SurfaceHolder getSurfaceHolder2() {
return mHolder2;
}
-
- public SurfaceHolder generateSurfaceHolder() {
- SurfaceView surface = (SurfaceView)findViewById(R.id.surface3);
- return surface.getHolder();
- }
}