Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / media / base / android / java / src / org / chromium / media / VideoCaptureFactory.java
index 25c7cba..54186bf 100644 (file)
@@ -6,7 +6,6 @@ package org.chromium.media;
 
 import android.content.Context;
 import android.content.pm.PackageManager;
-import android.hardware.Camera;
 import android.util.Log;
 
 import org.chromium.base.CalledByNative;
@@ -26,6 +25,7 @@ import org.chromium.media.VideoCapture;
  * takes into account the mentioned special devices.
  **/
 @JNINamespace("media")
+@SuppressWarnings("deprecation")
 class VideoCaptureFactory {
 
     static class CamParams {
@@ -44,11 +44,11 @@ class VideoCaptureFactory {
 
     static class ChromiumCameraInfo {
         private final int mId;
-        private final Camera.CameraInfo mCameraInfo;
+        private final android.hardware.Camera.CameraInfo mCameraInfo;
         // Special devices have more cameras than usual. Those devices are
         // identified by model & device. Currently only the Tango is supported.
         // Note that these devices have no Camera.CameraInfo.
-        private static final String[][] s_SPECIAL_DEVICE_LIST = {
+        private static final String[][] SPECIAL_DEVICE_LIST = {
             {"Peanut", "peanut"},
         };
         private static final String TAG = "ChromiumCameraInfo";
@@ -56,7 +56,7 @@ class VideoCaptureFactory {
         private static int sNumberOfSystemCameras = -1;
 
         private static boolean isSpecialDevice() {
-            for (String[] device : s_SPECIAL_DEVICE_LIST) {
+            for (String[] device : SPECIAL_DEVICE_LIST) {
                 if (device[0].contentEquals(android.os.Build.MODEL) &&
                         device[1].contentEquals(android.os.Build.DEVICE)) {
                     return true;
@@ -90,7 +90,7 @@ class VideoCaptureFactory {
                 if (PackageManager.PERMISSION_GRANTED ==
                         appContext.getPackageManager().checkPermission(
                                 "android.permission.CAMERA", appContext.getPackageName())) {
-                    sNumberOfSystemCameras = Camera.getNumberOfCameras();
+                    sNumberOfSystemCameras = android.hardware.Camera.getNumberOfCameras();
                 } else {
                     sNumberOfSystemCameras = 0;
                     Log.w(TAG, "Missing android.permission.CAMERA permission, "
@@ -125,10 +125,10 @@ class VideoCaptureFactory {
                     return "";
                 }
                 Log.d(TAG, "Camera enumerated: " + (mCameraInfo.facing ==
-                        Camera.CameraInfo.CAMERA_FACING_FRONT ? "front" :
+                        android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? "front" :
                         "back"));
                 return "camera " + mId + ", facing " + (mCameraInfo.facing ==
-                        Camera.CameraInfo.CAMERA_FACING_FRONT ? "front" :
+                        android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT ? "front" :
                         "back");
             }
         }
@@ -136,18 +136,19 @@ class VideoCaptureFactory {
         @CalledByNative("ChromiumCameraInfo")
         private int getOrientation() {
             if (isSpecialCamera(mId)) {
-                return Camera.CameraInfo.CAMERA_FACING_BACK;
+                return android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
             } else {
                 return (mCameraInfo == null ? 0 : mCameraInfo.orientation);
             }
         }
 
-        private Camera.CameraInfo getCameraInfo(int id) {
-            Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
+        private android.hardware.Camera.CameraInfo getCameraInfo(int id) {
+            android.hardware.Camera.CameraInfo cameraInfo =
+                    new android.hardware.Camera.CameraInfo();
             try {
-                Camera.getCameraInfo(id, cameraInfo);
+                android.hardware.Camera.getCameraInfo(id, cameraInfo);
             } catch (RuntimeException ex) {
-                Log.e(TAG, "getCameraInfo: Camera.getCameraInfo: " + ex);
+                Log.e(TAG, "getCameraInfo: android.hardware.Camera.getCameraInfo: " + ex);
                 return null;
             }
             return cameraInfo;