// Returns the camera index for camera with name |deviceName|, or -1 if no such camera can be
 // found. If |deviceName| is empty, the first available device is used.
 private static int lookupDeviceName(String deviceName) {
   Logging.d(TAG, "lookupDeviceName: " + deviceName);
   if (deviceName == null || Camera.getNumberOfCameras() == 0) {
     return -1;
   }
   if (deviceName.isEmpty()) {
     return 0;
   }
   for (int i = 0; i < Camera.getNumberOfCameras(); ++i) {
     if (deviceName.equals(CameraEnumerationAndroid.getDeviceName(i))) {
       return i;
     }
   }
   return -1;
 }