summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Huibers <andyhuibers@google.com>2015-02-26 16:39:20 -0800
committerAndy Huibers <andyhuibers@google.com>2015-02-26 16:41:04 -0800
commit0877b74d42b0e33952fcf5b1640d6accafcc3826 (patch)
treec558509fad2d4911b44c0cff8f777343c5ff7603
parentf307e8544b96e6ac2b226cd7fd8f8dcab58f7131 (diff)
downloadandroid_packages_apps_Camera2-0877b74d42b0e33952fcf5b1640d6accafcc3826.tar.gz
android_packages_apps_Camera2-0877b74d42b0e33952fcf5b1640d6accafcc3826.tar.bz2
android_packages_apps_Camera2-0877b74d42b0e33952fcf5b1640d6accafcc3826.zip
Allow number of Images in ImageReader to be variable.
Goes with ag/644111. Bug: 19534046 Change-Id: I7c54de56cd97798f0c325260d6215e1ad8834348
-rw-r--r--src/com/android/camera/one/v2/OneCameraManagerImpl.java16
-rw-r--r--src_pd/com/android/camera/util/GservicesHelper.java4
2 files changed, 15 insertions, 5 deletions
diff --git a/src/com/android/camera/one/v2/OneCameraManagerImpl.java b/src/com/android/camera/one/v2/OneCameraManagerImpl.java
index 293357356..8546df353 100644
--- a/src/com/android/camera/one/v2/OneCameraManagerImpl.java
+++ b/src/com/android/camera/one/v2/OneCameraManagerImpl.java
@@ -42,6 +42,7 @@ import com.android.camera.one.config.OneCameraFeatureConfig;
import com.android.camera.one.v2.photo.ImageRotationCalculator;
import com.android.camera.util.AndroidServices;
import com.android.camera.util.ApiHelper;
+import com.android.camera.util.GservicesHelper;
import com.android.camera.util.Size;
import com.google.common.base.Optional;
@@ -57,6 +58,7 @@ public class OneCameraManagerImpl extends OneCameraManager {
private final OneCameraFeatureConfig mFeatureConfig;
private final CameraManager mCameraManager;
private final int mMaxMemoryMB;
+ private final int mMaxImages;
private final DisplayMetrics mDisplayMetrics;
private final SoundPlayer mSoundPlayer;
@@ -75,8 +77,11 @@ public class OneCameraManagerImpl extends OneCameraManager {
final int maxMemoryMB = activity.getServices().getMemoryManager()
.getMaxAllowedNativeMemoryAllocation();
final SoundPlayer soundPlayer = activity.getSoundPlayer();
+ final int maxImages = GservicesHelper.
+ getMaxAllowedImageReaderCount(activity.getContentResolver());
OneCameraManager oneCameraManager = new OneCameraManagerImpl(
- activity, featureConfig, cameraManager, maxMemoryMB, displayMetrics, soundPlayer);
+ activity, featureConfig, cameraManager, maxMemoryMB, maxImages, displayMetrics,
+ soundPlayer);
return Optional.of(oneCameraManager);
}
@@ -88,12 +93,13 @@ public class OneCameraManagerImpl extends OneCameraManager {
* during capture and processing, in megabytes.
*/
public OneCameraManagerImpl(AppController appController, OneCameraFeatureConfig featureConfig,
- CameraManager cameraManager, int maxMemoryMB, DisplayMetrics displayMetrics,
- SoundPlayer soundPlayer) {
+ CameraManager cameraManager, int maxMemoryMB, int maxImages,
+ DisplayMetrics displayMetrics, SoundPlayer soundPlayer) {
mAppController = appController;
mFeatureConfig = featureConfig;
mCameraManager = cameraManager;
mMaxMemoryMB = maxMemoryMB;
+ mMaxImages = maxImages;
mDisplayMetrics = displayMetrics;
mSoundPlayer = soundPlayer;
}
@@ -154,8 +160,8 @@ public class OneCameraManagerImpl extends OneCameraManager {
// enabled.
OneCamera oneCamera = OneCameraCreator.create(mAppController, useHdr,
mFeatureConfig, device, characteristics, pictureSize,
- mMaxMemoryMB, mDisplayMetrics, mSoundPlayer, mainThread,
- imageRotationCalculator, burstController);
+ mMaxMemoryMB, mMaxImages, mDisplayMetrics, mSoundPlayer,
+ mainThread, imageRotationCalculator, burstController);
openCallback.onCameraOpened(oneCamera);
} catch (CameraAccessException e) {
Log.d(TAG, "Could not get camera characteristics");
diff --git a/src_pd/com/android/camera/util/GservicesHelper.java b/src_pd/com/android/camera/util/GservicesHelper.java
index c79b69520..9cddbff04 100644
--- a/src_pd/com/android/camera/util/GservicesHelper.java
+++ b/src_pd/com/android/camera/util/GservicesHelper.java
@@ -37,6 +37,10 @@ public class GservicesHelper {
return -1;
}
+ public static int getMaxAllowedImageReaderCount(ContentResolver contentResolver) {
+ return 15;
+ }
+
public static boolean useCamera2ApiThroughPortabilityLayer(ContentResolver contentResolver) {
// Use the camera2 API by default. This only affects PhotoModule on L.
return true;