summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CaptureModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/CaptureModule.java')
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java49
1 files changed, 32 insertions, 17 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 595352692..27b993aab 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -143,6 +143,7 @@ public class CaptureModule implements CameraModule, PhotoController,
public static final int BAYER_ID = 0;
public static int MONO_ID = -1;
public static int FRONT_ID = -1;
+ public static int LOGICAL_ID = -1;
public static final int INTENT_MODE_NORMAL = 0;
public static final int INTENT_MODE_CAPTURE = 1;
public static final int INTENT_MODE_VIDEO = 2;
@@ -645,6 +646,8 @@ public class CaptureModule implements CameraModule, PhotoController,
public void onError(CameraDevice cameraDevice, int error) {
int id = Integer.parseInt(cameraDevice.getId());
Log.e(TAG, "onError " + id + " " + error);
+ cameraDevice.close();
+ mCameraDevice[id] = null;
mCameraOpenCloseLock.release();
mCamerasOpened = false;
@@ -971,9 +974,7 @@ public class CaptureModule implements CameraModule, PhotoController,
break;
}
} else {
- int switchId = Integer.parseInt(
- mSettingsManager.getValue(SettingsManager.KEY_SWITCH_CAMERA));
- int cameraId = switchId == -1? FRONT_ID : switchId;
+ int cameraId = LOGICAL_ID == -1? FRONT_ID : LOGICAL_ID;
createSession(cameraId);
}
}
@@ -1329,10 +1330,8 @@ public class CaptureModule implements CameraModule, PhotoController,
break;
}
} else {
- int switchId = Integer.parseInt(
- mSettingsManager.getValue(SettingsManager.KEY_SWITCH_CAMERA));
- int cameraId = switchId == -1 ? FRONT_ID : switchId;
- if (takeZSLPicture(cameraId)) {
+ int cameraId = LOGICAL_ID == -1? FRONT_ID : LOGICAL_ID;
+ if(takeZSLPicture(cameraId)) {
return;
}
lockFocus(cameraId);
@@ -1366,7 +1365,7 @@ public class CaptureModule implements CameraModule, PhotoController,
break;
}
} else {
- cameraId = FRONT_ID;
+ cameraId = LOGICAL_ID == -1? FRONT_ID : LOGICAL_ID;
}
captureStillPicture(cameraId);
}
@@ -2451,6 +2450,7 @@ public class CaptureModule implements CameraModule, PhotoController,
@Override
public void onResumeAfterSuper() {
Log.d(TAG, "onResume " + getCameraMode());
+ reinit();
initializeValues();
updatePreviewSize();
mCameraIdList = new ArrayList<>();
@@ -2478,9 +2478,7 @@ public class CaptureModule implements CameraModule, PhotoController,
break;
}
} else {
- int switchId = Integer.parseInt(
- mSettingsManager.getValue(SettingsManager.KEY_SWITCH_CAMERA));
- int cameraId = switchId == -1? FRONT_ID : switchId;
+ int cameraId = LOGICAL_ID == -1? FRONT_ID : LOGICAL_ID;
msg.arg1 = cameraId;
mCameraHandler.sendMessage(msg);
}
@@ -2619,7 +2617,8 @@ public class CaptureModule implements CameraModule, PhotoController,
break;
}
} else {
- applyZoomAndUpdate(FRONT_ID);
+ int cameraId = LOGICAL_ID == -1? FRONT_ID : LOGICAL_ID;
+ applyZoomAndUpdate(cameraId);
}
mUI.updateFaceViewCameraBound(mCropRegion[getMainCameraId()]);
}
@@ -2634,6 +2633,8 @@ public class CaptureModule implements CameraModule, PhotoController,
case MONO_MODE:
return cameraId == MONO_ID;
}
+ } else if (LOGICAL_ID != -1) {
+ return cameraId == LOGICAL_ID;
} else {
return cameraId == FRONT_ID;
}
@@ -2802,7 +2803,8 @@ public class CaptureModule implements CameraModule, PhotoController,
break;
}
} else {
- triggerFocusAtPoint(x, y, FRONT_ID);
+ int cameraId = LOGICAL_ID == -1? FRONT_ID : LOGICAL_ID;
+ triggerFocusAtPoint(x, y, cameraId);
}
}
@@ -2817,9 +2819,7 @@ public class CaptureModule implements CameraModule, PhotoController,
}
return 0;
} else {
- int switchId = Integer.parseInt(
- mSettingsManager.getValue(SettingsManager.KEY_SWITCH_CAMERA));
- int cameraId = switchId == -1? FRONT_ID : switchId;
+ int cameraId = LOGICAL_ID == -1? FRONT_ID : LOGICAL_ID;
return cameraId;
}
}
@@ -4449,6 +4449,7 @@ public class CaptureModule implements CameraModule, PhotoController,
boolean updatePreviewBayer = false;
boolean updatePreviewMono = false;
boolean updatePreviewFront = false;
+ boolean updatePreviewLogical = false;
int count = 0;
for (SettingsManager.SettingState settingState : settings) {
String key = settingState.key;
@@ -4514,7 +4515,9 @@ public class CaptureModule implements CameraModule, PhotoController,
updatePreviewMono |= applyPreferenceToPreview(MONO_ID, key, value);
break;
}
- } else {
+ } else if (LOGICAL_ID != -1) {
+ updatePreviewLogical = applyPreferenceToPreview(LOGICAL_ID,key,value);
+ }else {
updatePreviewFront |= applyPreferenceToPreview(FRONT_ID, key, value);
}
count++;
@@ -4557,6 +4560,18 @@ public class CaptureModule implements CameraModule, PhotoController,
e.printStackTrace();
}
}
+
+ if (updatePreviewLogical) {
+ try {
+ if (checkSessionAndBuilder(mCaptureSession[LOGICAL_ID],
+ mPreviewRequestBuilder[LOGICAL_ID])) {
+ mCaptureSession[LOGICAL_ID].setRepeatingRequest(mPreviewRequestBuilder[LOGICAL_ID]
+ .build(), mCaptureCallback, mCameraHandler);
+ }
+ } catch (CameraAccessException | IllegalStateException e) {
+ e.printStackTrace();
+ }
+ }
}
private boolean isPanoSetting(String value) {