diff options
-rw-r--r-- | res/values/config.xml | 4 | ||||
-rw-r--r-- | src/com/android/camera/CameraHolder.java | 16 | ||||
-rw-r--r-- | src/com/android/camera/app/CameraApp.java | 13 |
3 files changed, 32 insertions, 1 deletions
diff --git a/res/values/config.xml b/res/values/config.xml index 7ada8d775..644891fbe 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012 The Android Open Source Project + 2015 The CyanogenMod Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,4 +28,7 @@ <!-- This value may be changed to true to enable the warped pano preview overlayed on top of the fullscreen pano preview. --> <bool name="enable_warped_pano_preview">true</bool> + + <!-- Set's parameter "lge-camera" for LGE devices --> + <bool name="lge_camera">false</bool> </resources> diff --git a/src/com/android/camera/CameraHolder.java b/src/com/android/camera/CameraHolder.java index 0797fad44..780008315 100644 --- a/src/com/android/camera/CameraHolder.java +++ b/src/com/android/camera/CameraHolder.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 The Android Open Source Project + * 2015 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +19,7 @@ package com.android.camera; import static com.android.camera.util.CameraUtil.Assert; +import android.content.Context; import android.hardware.Camera.CameraInfo; import android.hardware.Camera.Parameters; import android.os.Build; @@ -26,7 +28,9 @@ import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.util.Log; +import org.codeaurora.snapcam.R; +import com.android.camera.app.CameraApp; import com.android.camera.CameraManager.CameraProxy; import java.io.IOException; @@ -191,6 +195,9 @@ public class CameraHolder { public synchronized CameraProxy open( Handler handler, int cameraId, CameraManager.CameraOpenErrorCallback cb) { + + Context context = CameraApp.getContext(); + if (DEBUG_OPEN_RELEASE) { collectState(cameraId, mCameraDevice); if (mCameraOpened) { @@ -223,6 +230,15 @@ public class CameraHolder { } mCameraId = cameraId; mParameters = mCameraDevice.getCamera().getParameters(); + + // LGE Camera + final boolean lgeCamera = context.getResources().getBoolean(R.bool.lge_camera); + if (lgeCamera && mParameters != null) { + Log.d(TAG, "Set parameter lge-camera = 1"); + mParameters.set("lge-camera", "1"); + mCameraDevice.setParameters(mParameters); + } + } else { if (!mCameraDevice.reconnect(handler, cb)) { Log.e(TAG, "fail to reconnect Camera:" + mCameraId + ", aborting."); diff --git a/src/com/android/camera/app/CameraApp.java b/src/com/android/camera/app/CameraApp.java index b46d615b0..b5a5f4db8 100644 --- a/src/com/android/camera/app/CameraApp.java +++ b/src/com/android/camera/app/CameraApp.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 The Android Open Source Project + * 2015 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +19,7 @@ package com.android.camera.app; import android.app.ActivityManager; import android.app.Application; +import android.content.Context; import com.android.camera.SDCard; import com.android.camera.util.CameraUtil; @@ -27,6 +29,8 @@ public class CameraApp extends Application { private static long mMaxSystemMemory; public static boolean mIsLowMemoryDevice = false; private static final long LOW_MEMORY_DEVICE_THRESHOLD = 2L*1024*1024*1024; + private static Application mApp = null; + @Override public void onCreate() { super.onCreate(); @@ -37,9 +41,16 @@ public class CameraApp extends Application { if(mMaxSystemMemory <= LOW_MEMORY_DEVICE_THRESHOLD) { mIsLowMemoryDevice = true; } + + mApp = this; + UsageStatistics.initialize(this); CameraUtil.initialize(this); SDCard.initialize(this); } -} + public static Context getContext() + { + return mApp.getApplicationContext(); + } +} |