1 /* 2 * Copyright 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.hardware.camera2.cts; 18 19 import android.app.Activity; 20 import android.os.Bundle; 21 import android.util.Log; 22 import android.view.SurfaceView; 23 import android.view.TextureView; 24 import android.view.WindowManager; 25 26 import com.android.cts.hardware.R; 27 28 public class Camera2MultiViewCtsActivity extends Activity { 29 private final static String TAG = "Camera2MultiViewCtsActivity"; 30 private TextureView[] mTextureView = new TextureView[2]; 31 private SurfaceView[] mSurfaceView = new SurfaceView[2]; 32 33 @Override 34 protected void onCreate(Bundle savedInstanceState) { 35 super.onCreate(savedInstanceState); 36 setContentView(R.layout.multi_view); 37 mTextureView[0] = (TextureView) findViewById(R.id.texture_view_1); 38 mTextureView[1] = (TextureView) findViewById(R.id.texture_view_2); 39 mSurfaceView[0] = (SurfaceView) findViewById(R.id.surface_view_1); 40 mSurfaceView[1] = (SurfaceView) findViewById(R.id.surface_view_2); 41 42 //Make sure screen is on when this activity window is visible to the user. 43 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 44 } 45 46 public TextureView getTextureView(int index) { 47 if (index < 0 || index > 1) { 48 throw new IllegalArgumentException("Texture view index must be 0 or 1"); 49 } 50 return mTextureView[index]; 51 } 52 53 public SurfaceView getSurfaceView(int index) { 54 if (index < 0 || index > 1) { 55 throw new IllegalArgumentException("Surface view index must be 0 or 1"); 56 } 57 return mSurfaceView[index]; 58 } 59 } 60