Loading core/java/android/hardware/Camera.java +36 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.os.Looper; import android.os.Message; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RenderScript; Loading Loading @@ -246,13 +247,44 @@ public class Camera { /** * Returns the number of physical cameras available on this device. */ public native static int getNumberOfCameras(); public static int getNumberOfCameras() { boolean exposeAuxCamera = false; String packageName = ActivityThread.currentOpPackageName(); /* Force to expose only two cameras * if the package name does not falls in this bucket */ String packageList = SystemProperties.get("camera.aux.packagelist"); if (packageList.length() > 0) { TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(','); splitter.setString(packageList); for (String str : splitter) { if (packageName.equals(str)) { exposeAuxCamera = true; break; } } } int numberOfCameras = _getNumberOfCameras(); if (exposeAuxCamera == false && (numberOfCameras > 2)) { numberOfCameras = 2; } return numberOfCameras; } /** * Returns the number of physical cameras available on this device. */ /** @hide */ public native static int _getNumberOfCameras(); /** * Returns the information about a particular camera. * If {@link #getNumberOfCameras()} returns N, the valid id is 0 to N-1. */ public static void getCameraInfo(int cameraId, CameraInfo cameraInfo) { if(cameraId >= getNumberOfCameras()){ throw new RuntimeException("Unknown camera ID"); } _getCameraInfo(cameraId, cameraInfo); IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE); IAudioService audioService = IAudioService.Stub.asInterface(b); Loading Loading @@ -534,6 +566,9 @@ public class Camera { /** used by Camera#open, Camera#open(int) */ Camera(int cameraId) { if(cameraId >= getNumberOfCameras()){ throw new RuntimeException("Unknown camera ID"); } int err = cameraInitNormal(cameraId); if (checkInitErrors(err)) { if (err == -EACCES) { Loading core/java/android/hardware/camera2/CameraManager.java +46 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.hardware.camera2; import android.annotation.RequiresPermission; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityThread; import android.content.Context; import android.hardware.ICameraService; import android.hardware.ICameraServiceListener; Loading @@ -34,6 +35,8 @@ import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceSpecificException; import android.os.SystemProperties; import android.text.TextUtils; import android.util.Log; import android.util.ArrayMap; Loading Loading @@ -689,6 +692,25 @@ public final class CameraManager { try { numCameras = cameraService.getNumberOfCameras(CAMERA_TYPE_ALL); /* Force to expose only two cameras * if the package name does not falls in this bucket */ boolean exposeAuxCamera = false; String packageName = ActivityThread.currentOpPackageName(); String packageList = SystemProperties.get("camera.aux.packagelist"); if (packageList.length() > 0) { TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(','); splitter.setString(packageList); for (String str : splitter) { if (packageName.equals(str)) { exposeAuxCamera = true; break; } } } if (exposeAuxCamera == false && (numCameras > 2)) { numCameras = 2; } } catch(ServiceSpecificException e) { throwAsPublicException(e); } catch (RemoteException e) { Loading Loading @@ -1016,6 +1038,30 @@ public final class CameraManager { } private void onStatusChangedLocked(int status, String id) { /* Force to ignore the last mono/aux camera status update * if the package name does not falls in this bucket */ boolean exposeMonoCamera = false; String packageName = ActivityThread.currentOpPackageName(); String packageList = SystemProperties.get("camera.aux.packagelist"); if (packageList.length() > 0) { TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(','); splitter.setString(packageList); for (String str : splitter) { if (packageName.equals(str)) { exposeMonoCamera = true; break; } } } if (exposeMonoCamera == false) { if (Integer.parseInt(id) >= 2) { Log.w(TAG, "[soar.cts] ignore the status update of camera: " + id); return; } } if (DEBUG) { Log.v(TAG, String.format("Camera id %s has status changed to 0x%x", id, status)); Loading core/java/com/android/internal/app/AlertController.java 100644 → 100755 +18 −1 Original line number Diff line number Diff line Loading @@ -1111,7 +1111,24 @@ public class AlertController { if (mCursor != null) { adapter = new SimpleCursorAdapter(mContext, layout, mCursor, new String[] { mLabelColumn }, new int[] { R.id.text1 }); new String[] { mLabelColumn }, new int[] { R.id.text1 }) { @Override public View getView(int position, View convertView, ViewGroup parent) { View view = super.getView(position, convertView, parent); if (view instanceof CheckedTextView) { final CheckedTextView checkedTextView = (CheckedTextView) view; if (mCheckedItem != -1) { if (mCheckedItem != position) { checkedTextView.setChecked(false); } } return checkedTextView; } else { return view; } } }; } else if (mAdapter != null) { adapter = mAdapter; } else { Loading core/jni/android_hardware_Camera.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1105,7 +1105,7 @@ static void android_hardware_Camera_enableFocusMoveCallback(JNIEnv *env, jobject //------------------------------------------------- static const JNINativeMethod camMethods[] = { { "getNumberOfCameras", { "_getNumberOfCameras", "()I", (void *)android_hardware_Camera_getNumberOfCameras }, { "_getCameraInfo", Loading include/androidfw/AssetManager.h +1 −1 Original line number Diff line number Diff line Loading @@ -359,7 +359,7 @@ private: void addOverlay(const String8& path, const asset_path& overlay); bool getOverlay(const String8& path, size_t idx, asset_path* out) const; void closeZipFromPath(const String8& zip); private: void closeZip(int idx); Loading Loading
core/java/android/hardware/Camera.java +36 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.os.Looper; import android.os.Message; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RenderScript; Loading Loading @@ -246,13 +247,44 @@ public class Camera { /** * Returns the number of physical cameras available on this device. */ public native static int getNumberOfCameras(); public static int getNumberOfCameras() { boolean exposeAuxCamera = false; String packageName = ActivityThread.currentOpPackageName(); /* Force to expose only two cameras * if the package name does not falls in this bucket */ String packageList = SystemProperties.get("camera.aux.packagelist"); if (packageList.length() > 0) { TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(','); splitter.setString(packageList); for (String str : splitter) { if (packageName.equals(str)) { exposeAuxCamera = true; break; } } } int numberOfCameras = _getNumberOfCameras(); if (exposeAuxCamera == false && (numberOfCameras > 2)) { numberOfCameras = 2; } return numberOfCameras; } /** * Returns the number of physical cameras available on this device. */ /** @hide */ public native static int _getNumberOfCameras(); /** * Returns the information about a particular camera. * If {@link #getNumberOfCameras()} returns N, the valid id is 0 to N-1. */ public static void getCameraInfo(int cameraId, CameraInfo cameraInfo) { if(cameraId >= getNumberOfCameras()){ throw new RuntimeException("Unknown camera ID"); } _getCameraInfo(cameraId, cameraInfo); IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE); IAudioService audioService = IAudioService.Stub.asInterface(b); Loading Loading @@ -534,6 +566,9 @@ public class Camera { /** used by Camera#open, Camera#open(int) */ Camera(int cameraId) { if(cameraId >= getNumberOfCameras()){ throw new RuntimeException("Unknown camera ID"); } int err = cameraInitNormal(cameraId); if (checkInitErrors(err)) { if (err == -EACCES) { Loading
core/java/android/hardware/camera2/CameraManager.java +46 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.hardware.camera2; import android.annotation.RequiresPermission; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityThread; import android.content.Context; import android.hardware.ICameraService; import android.hardware.ICameraServiceListener; Loading @@ -34,6 +35,8 @@ import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceSpecificException; import android.os.SystemProperties; import android.text.TextUtils; import android.util.Log; import android.util.ArrayMap; Loading Loading @@ -689,6 +692,25 @@ public final class CameraManager { try { numCameras = cameraService.getNumberOfCameras(CAMERA_TYPE_ALL); /* Force to expose only two cameras * if the package name does not falls in this bucket */ boolean exposeAuxCamera = false; String packageName = ActivityThread.currentOpPackageName(); String packageList = SystemProperties.get("camera.aux.packagelist"); if (packageList.length() > 0) { TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(','); splitter.setString(packageList); for (String str : splitter) { if (packageName.equals(str)) { exposeAuxCamera = true; break; } } } if (exposeAuxCamera == false && (numCameras > 2)) { numCameras = 2; } } catch(ServiceSpecificException e) { throwAsPublicException(e); } catch (RemoteException e) { Loading Loading @@ -1016,6 +1038,30 @@ public final class CameraManager { } private void onStatusChangedLocked(int status, String id) { /* Force to ignore the last mono/aux camera status update * if the package name does not falls in this bucket */ boolean exposeMonoCamera = false; String packageName = ActivityThread.currentOpPackageName(); String packageList = SystemProperties.get("camera.aux.packagelist"); if (packageList.length() > 0) { TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(','); splitter.setString(packageList); for (String str : splitter) { if (packageName.equals(str)) { exposeMonoCamera = true; break; } } } if (exposeMonoCamera == false) { if (Integer.parseInt(id) >= 2) { Log.w(TAG, "[soar.cts] ignore the status update of camera: " + id); return; } } if (DEBUG) { Log.v(TAG, String.format("Camera id %s has status changed to 0x%x", id, status)); Loading
core/java/com/android/internal/app/AlertController.java 100644 → 100755 +18 −1 Original line number Diff line number Diff line Loading @@ -1111,7 +1111,24 @@ public class AlertController { if (mCursor != null) { adapter = new SimpleCursorAdapter(mContext, layout, mCursor, new String[] { mLabelColumn }, new int[] { R.id.text1 }); new String[] { mLabelColumn }, new int[] { R.id.text1 }) { @Override public View getView(int position, View convertView, ViewGroup parent) { View view = super.getView(position, convertView, parent); if (view instanceof CheckedTextView) { final CheckedTextView checkedTextView = (CheckedTextView) view; if (mCheckedItem != -1) { if (mCheckedItem != position) { checkedTextView.setChecked(false); } } return checkedTextView; } else { return view; } } }; } else if (mAdapter != null) { adapter = mAdapter; } else { Loading
core/jni/android_hardware_Camera.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1105,7 +1105,7 @@ static void android_hardware_Camera_enableFocusMoveCallback(JNIEnv *env, jobject //------------------------------------------------- static const JNINativeMethod camMethods[] = { { "getNumberOfCameras", { "_getNumberOfCameras", "()I", (void *)android_hardware_Camera_getNumberOfCameras }, { "_getCameraInfo", Loading
include/androidfw/AssetManager.h +1 −1 Original line number Diff line number Diff line Loading @@ -359,7 +359,7 @@ private: void addOverlay(const String8& path, const asset_path& overlay); bool getOverlay(const String8& path, size_t idx, asset_path* out) const; void closeZipFromPath(const String8& zip); private: void closeZip(int idx); Loading