Loading core/java/android/hardware/ICameraService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ interface ICameraService /** * Keep up-to-date with frameworks/av/include/camera/ICameraService.h */ int getNumberOfCameras(); int getNumberOfCameras(int type); // rest of 'int' return values in this file are actually status_t Loading core/java/android/hardware/camera2/CameraManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -64,6 +64,9 @@ public final class CameraManager { private static final int API_VERSION_1 = 1; private static final int API_VERSION_2 = 2; private static final int CAMERA_TYPE_BACKWARD_COMPATIBLE = 0; private static final int CAMERA_TYPE_ALL = 1; private ArrayList<String> mDeviceIdList; private final Context mContext; Loading Loading @@ -615,7 +618,7 @@ public final class CameraManager { } try { numCameras = cameraService.getNumberOfCameras(); numCameras = cameraService.getNumberOfCameras(CAMERA_TYPE_ALL); } catch(CameraRuntimeException e) { throw e.asChecked(); } catch (RemoteException e) { Loading core/jni/android_hardware_Camera.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -497,6 +497,12 @@ static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz, jint cameraId, jobject info_obj) { CameraInfo cameraInfo; if (cameraId >= Camera::getNumberOfCameras() || cameraId < 0) { ALOGE("%s: Unknown camera ID %d", __FUNCTION__, cameraId); jniThrowRuntimeException(env, "Unknown camera ID"); return; } status_t rc = Camera::getCameraInfo(cameraId, &cameraInfo); if (rc != NO_ERROR) { jniThrowRuntimeException(env, "Fail to get camera info"); Loading media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,9 @@ public class CameraBinderTest extends AndroidTestCase { private static final int API_VERSION_1 = 1; private static final int API_VERSION_2 = 2; private static final int CAMERA_TYPE_BACKWARD_COMPATIBLE = 0; private static final int CAMERA_TYPE_ALL = 1; protected CameraBinderTestUtils mUtils; public CameraBinderTest() { Loading @@ -71,7 +74,7 @@ public class CameraBinderTest extends AndroidTestCase { @SmallTest public void testNumberOfCameras() throws Exception { int numCameras = mUtils.getCameraService().getNumberOfCameras(); int numCameras = mUtils.getCameraService().getNumberOfCameras(CAMERA_TYPE_ALL); assertTrue("At least this many cameras: " + mUtils.getGuessedNumCameras(), numCameras >= mUtils.getGuessedNumCameras()); Log.v(TAG, "Number of cameras " + numCameras); Loading Loading
core/java/android/hardware/ICameraService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ interface ICameraService /** * Keep up-to-date with frameworks/av/include/camera/ICameraService.h */ int getNumberOfCameras(); int getNumberOfCameras(int type); // rest of 'int' return values in this file are actually status_t Loading
core/java/android/hardware/camera2/CameraManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -64,6 +64,9 @@ public final class CameraManager { private static final int API_VERSION_1 = 1; private static final int API_VERSION_2 = 2; private static final int CAMERA_TYPE_BACKWARD_COMPATIBLE = 0; private static final int CAMERA_TYPE_ALL = 1; private ArrayList<String> mDeviceIdList; private final Context mContext; Loading Loading @@ -615,7 +618,7 @@ public final class CameraManager { } try { numCameras = cameraService.getNumberOfCameras(); numCameras = cameraService.getNumberOfCameras(CAMERA_TYPE_ALL); } catch(CameraRuntimeException e) { throw e.asChecked(); } catch (RemoteException e) { Loading
core/jni/android_hardware_Camera.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -497,6 +497,12 @@ static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz, jint cameraId, jobject info_obj) { CameraInfo cameraInfo; if (cameraId >= Camera::getNumberOfCameras() || cameraId < 0) { ALOGE("%s: Unknown camera ID %d", __FUNCTION__, cameraId); jniThrowRuntimeException(env, "Unknown camera ID"); return; } status_t rc = Camera::getCameraInfo(cameraId, &cameraInfo); if (rc != NO_ERROR) { jniThrowRuntimeException(env, "Fail to get camera info"); Loading
media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,9 @@ public class CameraBinderTest extends AndroidTestCase { private static final int API_VERSION_1 = 1; private static final int API_VERSION_2 = 2; private static final int CAMERA_TYPE_BACKWARD_COMPATIBLE = 0; private static final int CAMERA_TYPE_ALL = 1; protected CameraBinderTestUtils mUtils; public CameraBinderTest() { Loading @@ -71,7 +74,7 @@ public class CameraBinderTest extends AndroidTestCase { @SmallTest public void testNumberOfCameras() throws Exception { int numCameras = mUtils.getCameraService().getNumberOfCameras(); int numCameras = mUtils.getCameraService().getNumberOfCameras(CAMERA_TYPE_ALL); assertTrue("At least this many cameras: " + mUtils.getGuessedNumCameras(), numCameras >= mUtils.getGuessedNumCameras()); Log.v(TAG, "Number of cameras " + numCameras); Loading