diff options
author | Sai Kumar Sanagavarapu <ssanagav@codeaurora.org> | 2015-08-14 11:13:17 +0530 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-02-20 19:22:17 +0100 |
commit | d66352da822956f16a0607f2c6d6074c62361c61 (patch) | |
tree | 15c11a63a26e341b9d74d6c2cd7557433c4b3311 | |
parent | 9122ac2e99de22fccdab8ce90c14fe8526fe73f3 (diff) | |
download | frameworks_base-d66352da822956f16a0607f2c6d6074c62361c61.zip frameworks_base-d66352da822956f16a0607f2c6d6074c62361c61.tar.gz frameworks_base-d66352da822956f16a0607f2c6d6074c62361c61.tar.bz2 |
Camera: Force HAL1 for predefined package list.
Force HAL1 for some of the popular apps to optimize power savings.
Use the following setprop to add any package : camera.hal1.packagelist
Change-Id: I14321c63516178dead54f04e2f6828e10225ed9e
-rw-r--r-- | core/java/android/hardware/Camera.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index dc576a5..940f9e5 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -40,6 +40,7 @@ import android.util.Log; import android.text.TextUtils; import android.view.Surface; import android.view.SurfaceHolder; +import android.os.SystemProperties; import java.io.IOException; import java.lang.ref.WeakReference; @@ -483,8 +484,21 @@ public class Camera { mEventHandler = null; } - return native_setup(new WeakReference<Camera>(this), cameraId, halVersion, - ActivityThread.currentOpPackageName()); + String packageName = ActivityThread.currentOpPackageName(); + + //Force HAL1 if the package name falls in this bucket + String packageList = SystemProperties.get("camera.hal1.packagelist", ""); + if (packageList.length() > 0) { + TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(','); + splitter.setString(packageList); + for (String str : splitter) { + if (packageName.equals(str)) { + halVersion = CAMERA_HAL_API_VERSION_1_0; + break; + } + } + } + return native_setup(new WeakReference<Camera>(this), cameraId, halVersion, packageName); } private int cameraInitNormal(int cameraId) { |