1 /*
2  * Copyright 2012 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 com.android.opengl.cts;
18 
19 import android.app.Activity;
20 import android.app.Instrumentation;
21 import android.content.Intent;
22 import android.os.Bundle;
23 import android.test.wrappedgtest.WrappedGTestActivity;
24 import android.view.SurfaceHolder;
25 import android.view.SurfaceView;
26 import android.view.Surface;
27 
28 public class GLTestActivity extends WrappedGTestActivity {
29 
30     private SurfaceView mSurfaceView;
31     private SurfaceHolder.Callback mHolderCallback = new SurfaceHolder.Callback() {
32 
33         @Override
34         public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
35              setSurface(holder.getSurface());
36         }
37 
38         @Override
39         public void surfaceCreated(SurfaceHolder holder) {
40              setSurface(holder.getSurface());
41         }
42 
43         @Override
44         public void surfaceDestroyed(SurfaceHolder holder) {
45         }
46     };
47 
onCreate(Bundle data)48     public void onCreate(Bundle data) {
49         super.onCreate(data);
50         mSurfaceView = new SurfaceView(this);
51         mSurfaceView.getHolder().addCallback(mHolderCallback);
52         setContentView(mSurfaceView);
53         System.loadLibrary("nativeopengltests");
54     }
55 
setSurface(Surface surface)56     private static native void setSurface(Surface surface);
57 }
58