Explicitly clean-up OpenGlEsVersionTest
Override onPause() for OpenGlEsVersionTest and explicitly clean-up its GLSurfaceView.
This is good practice and it prevents a potential race-condition in threadTestCleanup
test that comes later in the test group.
Bug: 37118199
Test: cts-tradefed run commandAndExit cts-dev --include-filter CtsOpenGLTestCases
Change-Id: I27d2d3fd937ccdd8cb4b1ad250b9848850bd2eec
diff --git a/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionCtsActivity.java b/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionCtsActivity.java
index 8a85555..dd89895 100644
--- a/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionCtsActivity.java
+++ b/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionCtsActivity.java
@@ -54,6 +54,8 @@
/** Latch that is unlocked when the activity is done finding the version. */
private CountDownLatch mSurfaceCreatedLatch = new CountDownLatch(1);
+ private GLSurfaceView mView;
+
public static Intent createIntent(int eglContextClientVersion) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.putExtra(EGL_CONTEXT_CLIENT_VERSION, eglContextClientVersion);
@@ -64,16 +66,22 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- GLSurfaceView view = new GLSurfaceView(this);
+ mView = new GLSurfaceView(this);
Intent intent = getIntent();
int eglContextClientVersion = intent.getIntExtra(EGL_CONTEXT_CLIENT_VERSION, -1);
if (eglContextClientVersion > 0) {
- view.setEGLContextClientVersion(eglContextClientVersion);
+ mView.setEGLContextClientVersion(eglContextClientVersion);
}
- view.setRenderer(new Renderer());
- setContentView(view);
+ mView.setRenderer(new Renderer());
+ setContentView(mView);
+ }
+
+ @Override
+ protected void onPause() {
+ mView.onPause();
+ super.onPause();
}
public String getVersionString() throws InterruptedException {