fix android.graphics2#android.graphics2.cts.TextureViewTest#testTextureViewActivity for TV

TV Camera is defined as an EXTERNAL CAMERA, cameraInfo.facing = CameraInfo.CAMERA_FACING_EXTERNAL.
The CTS code don't open camera and do mCamera.startPreview() for an external camera.
Then do mCamera.stopPreview() will call exception if there is not any camera is opened.

Add the CTS test code for the external camera for this CTS test case.

Change-Id: I5b6256a59303ca0afa714b909d25978cecdcc429
diff --git a/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java
index 01776e5..647fc30 100644
--- a/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java
+++ b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java
@@ -55,13 +55,7 @@
         Assert.assertTrue(mTextureView.isOpaque());
         mWidth = width;
         mHeight = height;
-        PackageManager packageManager = getPackageManager();
-        boolean hasRearCamera = packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA);
-        boolean hasFrontCamera =
-                packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
-        if (hasRearCamera) {
-            mCamera = Camera.open();
-        } else if (hasFrontCamera) {
+        if (Camera.getNumberOfCameras() > 0) {
             mCamera = Camera.open(0);
         } else {
             // no camera, and no frame update, so just complete here.
@@ -84,8 +78,10 @@
     }
 
     public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
-        mCamera.stopPreview();
-        mCamera.release();
+        if (mCamera != null) {
+            mCamera.stopPreview();
+            mCamera.release();
+        }
         return true;
     }