Camera: move CameraDeviceInfo from common to CTS

To counter the problem GTS code needs to support all
platform version.

Bug: 27967489
Change-Id: Ie917c26aa613173a23886d3c296016818887a4e0
diff --git a/build/device_info_package.mk b/build/device_info_package.mk
index 0ccb05d..b91c264 100644
--- a/build/device_info_package.mk
+++ b/build/device_info_package.mk
@@ -20,7 +20,6 @@
 DEVICE_INFO_INSTRUMENT := android.support.test.runner.AndroidJUnitRunner
 DEVICE_INFO_PERMISSIONS += android.permission.WRITE_EXTERNAL_STORAGE
 DEVICE_INFO_ACTIVITIES += \
-  $(DEVICE_INFO_PACKAGE).CameraDeviceInfo \
   $(DEVICE_INFO_PACKAGE).ConfigurationDeviceInfo \
   $(DEVICE_INFO_PACKAGE).CpuDeviceInfo \
   $(DEVICE_INFO_PACKAGE).FeatureDeviceInfo \
diff --git a/tools/cts-device-info/Android.mk b/tools/cts-device-info/Android.mk
index 99dc6d1..4b43d39 100644
--- a/tools/cts-device-info/Android.mk
+++ b/tools/cts-device-info/Android.mk
@@ -24,7 +24,8 @@
 DEVICE_INFO_PERMISSIONS :=
 
 DEVICE_INFO_ACTIVITIES := \
-    com.android.compatibility.common.deviceinfo.GlesStubActivity
+    com.android.compatibility.common.deviceinfo.GlesStubActivity \
+    com.android.cts.deviceinfo.CameraDeviceInfo
 
 LOCAL_PACKAGE_NAME := CtsDeviceInfo
 
diff --git a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/CameraDeviceInfo.java b/tools/cts-device-info/src/com/android/cts/deviceinfo/CameraDeviceInfo.java
similarity index 94%
rename from common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/CameraDeviceInfo.java
rename to tools/cts-device-info/src/com/android/cts/deviceinfo/CameraDeviceInfo.java
index 2cc4478..41afdb9eb 100644
--- a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/CameraDeviceInfo.java
+++ b/tools/cts-device-info/src/com/android/cts/deviceinfo/CameraDeviceInfo.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.android.compatibility.common.deviceinfo;
+package com.android.cts.deviceinfo;
 
 import android.content.Context;
 import android.graphics.Rect;
@@ -32,6 +32,7 @@
 import android.util.SizeF;
 import android.util.Range;
 
+import com.android.compatibility.common.deviceinfo.DeviceInfo;
 import com.android.compatibility.common.util.DeviceInfoStore;
 
 import java.lang.reflect.Array;
@@ -415,36 +416,25 @@
         store.addResult("profile_qcif", CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_QCIF));
         store.addResult("profile_qvga", CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_QVGA));
 
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.L) {
-            // query camera devices and store each camera's characteristics
-            CameraManager cameraManager = (CameraManager)
-                    getContext().getSystemService(Context.CAMERA_SERVICE);
-            try {
-                String[] cameraIdList = cameraManager.getCameraIdList();
-                store.addResult("num_of_camera", cameraIdList.length);
-                if (cameraIdList.length > 0) {
-                    CameraCharacteristicsStorer charsStorer =
-                            new CameraCharacteristicsStorer(cameraManager, store);
-                    store.startArray("per_camera_info");
-                    for (int i = 0; i < cameraIdList.length; i++) {
-                        charsStorer.storeCameraInfo(cameraIdList[i]);
-                    }
-                    store.endArray(); // per_camera_info
+        CameraManager cameraManager = (CameraManager)
+                getContext().getSystemService(Context.CAMERA_SERVICE);
+        try {
+            String[] cameraIdList = cameraManager.getCameraIdList();
+            store.addResult("num_of_camera", cameraIdList.length);
+            if (cameraIdList.length > 0) {
+                CameraCharacteristicsStorer charsStorer =
+                        new CameraCharacteristicsStorer(cameraManager, store);
+                store.startArray("per_camera_info");
+                for (int i = 0; i < cameraIdList.length; i++) {
+                    charsStorer.storeCameraInfo(cameraIdList[i]);
                 }
-            } catch (CameraAccessException e) {
-                Log.e(TAG,
-                        "Unable to get camera camera ID list, error: "
-                                + e.getMessage());
+                store.endArray(); // per_camera_info
             }
-        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
-            // Only supports Camera API1
-            int numCameras = Camera.getNumberOfCameras();
-            store.addResult("num_of_camera", numCameras);
-        } else {
-            // No Camera number query support
-            store.addResult("num_of_camera", 0);
+        } catch (CameraAccessException e) {
+            Log.e(TAG,
+                    "Unable to get camera camera ID list, error: "
+                            + e.getMessage());
         }
-
     }
 
     /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~