Home | History | Annotate | Download | only in performanceLaunch
      1 /*
      2  * Copyright (C) 2015 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.performanceLaunch;
     18 
     19 import com.android.performanceLaunch.helper.SimpleGLSurfaceView;
     20 
     21 import android.app.Activity;
     22 import android.opengl.GLSurfaceView;
     23 import android.os.Bundle;
     24 import android.os.Trace;
     25 
     26 /**
     27  * To draw the GLSurface view Source : development/samples/OpenGL/HelloOpenGLES20
     28  */
     29 public class SimpleSurfaceGLActivity extends Activity {
     30 
     31     private GLSurfaceView mGLView;
     32 
     33     @Override
     34     public void onCreate(Bundle savedInstanceState) {
     35         Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "onCreate");
     36         super.onCreate(savedInstanceState);
     37 
     38         // Create a GLSurfaceView instance and set it
     39         // as the ContentView for this Activity
     40         mGLView = new SimpleGLSurfaceView(this);
     41         setContentView(mGLView);
     42         Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
     43     }
     44 
     45     @Override
     46     protected void onPause() {
     47         super.onPause();
     48         // The following call pauses the rendering thread.
     49         // If your OpenGL application is memory intensive,
     50         // you should consider de-allocating objects that
     51         // consume significant memory here.
     52         mGLView.onPause();
     53     }
     54 
     55     @Override
     56     protected void onResume() {
     57         super.onResume();
     58         // The following call resumes a paused rendering thread.
     59         // If you de-allocated graphic objects for onPause()
     60         // this is a good place to re-allocate them.
     61         mGLView.onResume();
     62     }
     63 }
     64