Loading aidl/com/android/media/permission/PermissionEnum.aidl +15 −5 Original line number Diff line number Diff line Loading @@ -21,11 +21,21 @@ package com.android.media.permission; * {@hide} */ enum PermissionEnum { MODIFY_AUDIO_ROUTING = 0, MODIFY_PHONE_STATE = 1, CALL_AUDIO_INTERCEPTION = 2, // This is a runtime + WIU permission, which means data delivery should be protected by AppOps // We query the controller only for early fails/hard errors RECORD_AUDIO = 3, ENUM_SIZE = 4, // Not for actual usage RECORD_AUDIO = 0, MODIFY_AUDIO_ROUTING = 1, MODIFY_AUDIO_SETTINGS = 2, MODIFY_PHONE_STATE = 3, MODIFY_DEFAULT_AUDIO_EFFECTS = 4, WRITE_SECURE_SETTINGS = 5, CALL_AUDIO_INTERCEPTION = 6, ACCESS_ULTRASOUND = 7, CAPTURE_AUDIO_OUTPUT = 8, CAPTURE_MEDIA_OUTPUT = 9, CAPTURE_AUDIO_HOTWORD = 10, CAPTURE_TUNER_AUDIO_INPUT = 11, CAPTURE_VOICE_COMMUNICATION_OUTPUT = 12, BLUETOOTH_CONNECT = 13, ENUM_SIZE = 14, // Not for actual usage, used by Java } camera/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ cc_library { local_include_dirs: ["aidl"], include_dirs: [ "frameworks/native/aidl/gui", "frameworks/native/libs/permission/aidl", ], }, Loading Loading @@ -112,6 +113,7 @@ cc_library { shared_libs: [ "camera_platform_flags_c_lib", "framework-permission-aidl-cpp", "lib-platform-compat-native-api", "libbase", "libbinder", Loading @@ -120,6 +122,7 @@ cc_library { "libgui", "liblog", "libnativewindow", "libpermission", "libutils", ], Loading @@ -132,6 +135,7 @@ cc_library { "include/camera", ], export_shared_lib_headers: [ "framework-permission-aidl-cpp", "libcamera_metadata", "libgui", "libnativewindow", Loading camera/Camera.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -69,13 +69,12 @@ Camera::~Camera() // deadlock if we call any method of ICamera here. } sp<Camera> Camera::connect(int cameraId, const std::string& clientPackageName, int clientUid, int clientPid, int targetSdkVersion, int rotationOverride, bool forceSlowJpegMode, int32_t deviceId, int32_t devicePolicy) sp<Camera> Camera::connect(int cameraId, int targetSdkVersion, int rotationOverride, bool forceSlowJpegMode, const AttributionSourceState& clientAttribution, int32_t devicePolicy) { return CameraBaseT::connect(cameraId, clientPackageName, clientUid, clientPid, targetSdkVersion, rotationOverride, forceSlowJpegMode, deviceId, devicePolicy); return CameraBaseT::connect(cameraId, targetSdkVersion, rotationOverride, forceSlowJpegMode, clientAttribution, devicePolicy); } status_t Camera::reconnect() Loading camera/CameraBase.cpp +13 −12 Original line number Diff line number Diff line Loading @@ -161,10 +161,10 @@ const sp<::android::hardware::ICameraService> CameraBase<TCam, TCamTraits>::getC template <typename TCam, typename TCamTraits> sp<TCam> CameraBase<TCam, TCamTraits>::connect(int cameraId, const std::string& clientPackageName, int clientUid, int clientPid, int targetSdkVersion, int rotationOverride, bool forceSlowJpegMode, int32_t deviceId, int32_t devicePolicy) int targetSdkVersion, int rotationOverride, bool forceSlowJpegMode, const AttributionSourceState& clientAttribution, int32_t devicePolicy) { ALOGV("%s: connect", __FUNCTION__); sp<TCam> c = new TCam(cameraId); Loading @@ -176,9 +176,9 @@ sp<TCam> CameraBase<TCam, TCamTraits>::connect(int cameraId, TCamConnectService fnConnectService = TCamTraits::fnConnectService; ALOGI("Connect camera (legacy API) - rotationOverride %d, forceSlowJpegMode %d", rotationOverride, forceSlowJpegMode); ret = (cs.get()->*fnConnectService)(cl, cameraId, clientPackageName, clientUid, clientPid, targetSdkVersion, rotationOverride, forceSlowJpegMode, deviceId, devicePolicy, /*out*/ &c->mCamera); ret = (cs.get()->*fnConnectService)(cl, cameraId, targetSdkVersion, rotationOverride, forceSlowJpegMode, clientAttribution, devicePolicy, /*out*/ &c->mCamera); } if (ret.isOk() && c->mCamera != nullptr) { IInterface::asBinder(c->mCamera)->linkToDeath(c); Loading Loading @@ -257,7 +257,8 @@ void CameraBase<TCam, TCamTraits>::notifyCallback(int32_t msgType, } template <typename TCam, typename TCamTraits> int CameraBase<TCam, TCamTraits>::getNumberOfCameras(int32_t deviceId, int32_t devicePolicy) { int CameraBase<TCam, TCamTraits>::getNumberOfCameras( const AttributionSourceState& clientAttribution, int32_t devicePolicy) { const sp<::android::hardware::ICameraService> cs = getCameraService(); if (!cs.get()) { Loading @@ -266,7 +267,7 @@ int CameraBase<TCam, TCamTraits>::getNumberOfCameras(int32_t deviceId, int32_t d } int32_t count; binder::Status res = cs->getNumberOfCameras( ::android::hardware::ICameraService::CAMERA_TYPE_BACKWARD_COMPATIBLE, deviceId, ::android::hardware::ICameraService::CAMERA_TYPE_BACKWARD_COMPATIBLE, clientAttribution, devicePolicy, &count); if (!res.isOk()) { ALOGE("Error reading number of cameras: %s", Loading @@ -279,12 +280,12 @@ int CameraBase<TCam, TCamTraits>::getNumberOfCameras(int32_t deviceId, int32_t d // this can be in BaseCamera but it should be an instance method template <typename TCam, typename TCamTraits> status_t CameraBase<TCam, TCamTraits>::getCameraInfo(int cameraId, int rotationOverride, int32_t deviceId, int32_t devicePolicy, int rotationOverride, const AttributionSourceState& clientAttribution, int32_t devicePolicy, struct hardware::CameraInfo* cameraInfo) { const sp<::android::hardware::ICameraService> cs = getCameraService(); if (cs == 0) return UNKNOWN_ERROR; binder::Status res = cs->getCameraInfo(cameraId, rotationOverride, deviceId, devicePolicy, cameraInfo); binder::Status res = cs->getCameraInfo(cameraId, rotationOverride, clientAttribution, devicePolicy, cameraInfo); return res.isOk() ? OK : res.serviceSpecificErrorCode(); } Loading camera/aidl/android/hardware/ICameraService.aidl +31 −37 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware; import android.content.AttributionSourceState; import android.hardware.ICamera; import android.hardware.ICameraClient; import android.hardware.camera2.ICameraDeviceUser; Loading Loading @@ -66,13 +67,13 @@ interface ICameraService * * @param type The type of the camera, can be either CAMERA_TYPE_BACKWARD_COMPATIBLE * or CAMERA_TYPE_ALL. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default * policy. */ int getNumberOfCameras(int type, int deviceId, int devicePolicy); int getNumberOfCameras(int type, in AttributionSourceState clientAttribution, int devicePolicy); /** * If changed, reflect in Loading @@ -97,19 +98,20 @@ interface ICameraService * will override the sensor orientation and rotate and crop, while {@link * ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed * without changing the sensor orientation. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default * policy. * @return CameraInfo for the camera. */ CameraInfo getCameraInfo(int cameraId, int rotationOverride, int deviceId, int devicePolicy); CameraInfo getCameraInfo(int cameraId, int rotationOverride, in AttributionSourceState clientAttribution, int devicePolicy); /** * Default UID/PID values for non-privileged callers of * connect() and connectDevice() * Default UID/PID values for non-privileged callers of connect() and connectDevice(). Can be * used to set the pid/uid fields of AttributionSourceState to indicate the calling uid/pid * should be used. */ const int USE_CALLING_UID = -1; const int USE_CALLING_PID = -1; Loading @@ -118,9 +120,6 @@ interface ICameraService * Open a camera device through the old camera API. * * @param cameraId The ID of the camera to open. * @param opPackageName The package name to report for the app-ops. * @param clientUid UID for the calling client. * @param clientPid PID for the calling client. * @param targetSdkVersion the target sdk level of the application calling this function. * @param rotationOverride Whether to override the sensor orientation information to * correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT} Loading @@ -128,7 +127,7 @@ interface ICameraService * ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed * without changing the sensor orientation. * @param forceSlowJpegMode Whether to force slow jpeg mode. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -136,12 +135,10 @@ interface ICameraService */ ICamera connect(ICameraClient client, int cameraId, @utf8InCpp String opPackageName, int clientUid, int clientPid, int targetSdkVersion, int rotationOverride, boolean forceSlowJpegMode, int deviceId, in AttributionSourceState clientAttribution, int devicePolicy); /** Loading @@ -149,15 +146,13 @@ interface ICameraService * Only supported for device HAL versions >= 3.2. * * @param cameraId The ID of the camera to open. * @param opPackageName The package name to report for the app-ops. * @param clientUid UID for the calling client. * @param targetSdkVersion the target sdk level of the application calling this function. * @param rotationOverride Whether to override the sensor orientation information to * correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT} * will override the sensor orientation and rotate and crop, while {@link * ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed * without changing the sensor orientation. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -165,12 +160,10 @@ interface ICameraService */ ICameraDeviceUser connectDevice(ICameraDeviceCallbacks callbacks, @utf8InCpp String cameraId, @utf8InCpp String opPackageName, @nullable @utf8InCpp String featureId, int clientUid, int oomScoreOffset, int oomScoreOffset, int targetSdkVersion, int rotationOverride, int deviceId, in AttributionSourceState clientAttribution, int devicePolicy); /** Loading @@ -194,7 +187,7 @@ interface ICameraService * * @param sessions the set of camera id and session configuration pairs to be queried. * @param targetSdkVersion the target sdk level of the application calling this function. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -206,7 +199,7 @@ interface ICameraService */ boolean isConcurrentSessionConfigurationSupported( in CameraIdAndSessionConfiguration[] sessions, int targetSdkVersion, int deviceId, int devicePolicy); int targetSdkVersion, in AttributionSourceState clientAttribution, int devicePolicy); /** * Inject Session Params into an existing camera session. Loading Loading @@ -236,7 +229,7 @@ interface ICameraService * will override the sensor orientation and rotate and crop, while {@link * ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed * without changing the sensor orientation. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -244,7 +237,7 @@ interface ICameraService * @return Characteristics for the given camera. */ CameraMetadataNative getCameraCharacteristics(@utf8InCpp String cameraId, int targetSdkVersion, int rotationOverride, int deviceId, int devicePolicy); int rotationOverride, in AttributionSourceState clientAttribution, int devicePolicy); /** * Read in the vendor tag descriptors from the camera module HAL. Loading Loading @@ -284,14 +277,14 @@ interface ICameraService * Set the torch mode for a camera device. * * @param cameraId The ID of the camera to set torch mode for. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default * policy. */ void setTorchMode(@utf8InCpp String cameraId, boolean enabled, IBinder clientBinder, int deviceId, int devicePolicy); in AttributionSourceState clientAttribution, int devicePolicy); /** * Change the brightness level of the flash unit associated with cameraId to strengthLevel. Loading @@ -299,27 +292,28 @@ interface ICameraService * * @param cameraId The ID of the camera. * @param strengthLevel The torch strength level to set for the camera. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default * policy. */ void turnOnTorchWithStrengthLevel(@utf8InCpp String cameraId, int strengthLevel, IBinder clientBinder, int deviceId, int devicePolicy); IBinder clientBinder, in AttributionSourceState clientAttribution, int devicePolicy); /** * Get the brightness level of the flash unit associated with cameraId. * * @param cameraId The ID of the camera. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default * policy. * @return Torch strength level for the camera. */ int getTorchStrengthLevel(@utf8InCpp String cameraId, int deviceId, int devicePolicy); int getTorchStrengthLevel(@utf8InCpp String cameraId, in AttributionSourceState clientAttribution, int devicePolicy); /** * Notify the camera service of a system event. Should only be called from system_server. Loading Loading @@ -385,7 +379,7 @@ interface ICameraService * * @param cameraId The camera id to create the CaptureRequest for. * @param templateId The template id create the CaptureRequest for. * @param deviceId the device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -393,7 +387,7 @@ interface ICameraService * @return Metadata representing the CaptureRequest. */ CameraMetadataNative createDefaultRequest(@utf8InCpp String cameraId, int templateId, int deviceId, int devicePolicy); in AttributionSourceState clientAttribution, int devicePolicy); /** * Check whether a particular session configuration with optional session parameters Loading @@ -402,7 +396,7 @@ interface ICameraService * @param cameraId The camera id to query session configuration for * @param targetSdkVersion the target sdk level of the application calling this function. * @param sessionConfiguration Specific session configuration to be verified. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -412,7 +406,7 @@ interface ICameraService */ boolean isSessionConfigurationWithParametersSupported(@utf8InCpp String cameraId, int targetSdkVersion, in SessionConfiguration sessionConfiguration, int deviceId, int devicePolicy); in AttributionSourceState clientAttribution, int devicePolicy); /** * Get the camera characteristics for a particular session configuration for Loading @@ -427,7 +421,7 @@ interface ICameraService * without changing the sensor orientation. * @param sessionConfiguration Session configuration for which the characteristics * must be fetched. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -438,6 +432,6 @@ interface ICameraService int targetSdkVersion, int rotationOverride, in SessionConfiguration sessionConfiguration, int deviceId, in AttributionSourceState clientAttribution, int devicePolicy); } Loading
aidl/com/android/media/permission/PermissionEnum.aidl +15 −5 Original line number Diff line number Diff line Loading @@ -21,11 +21,21 @@ package com.android.media.permission; * {@hide} */ enum PermissionEnum { MODIFY_AUDIO_ROUTING = 0, MODIFY_PHONE_STATE = 1, CALL_AUDIO_INTERCEPTION = 2, // This is a runtime + WIU permission, which means data delivery should be protected by AppOps // We query the controller only for early fails/hard errors RECORD_AUDIO = 3, ENUM_SIZE = 4, // Not for actual usage RECORD_AUDIO = 0, MODIFY_AUDIO_ROUTING = 1, MODIFY_AUDIO_SETTINGS = 2, MODIFY_PHONE_STATE = 3, MODIFY_DEFAULT_AUDIO_EFFECTS = 4, WRITE_SECURE_SETTINGS = 5, CALL_AUDIO_INTERCEPTION = 6, ACCESS_ULTRASOUND = 7, CAPTURE_AUDIO_OUTPUT = 8, CAPTURE_MEDIA_OUTPUT = 9, CAPTURE_AUDIO_HOTWORD = 10, CAPTURE_TUNER_AUDIO_INPUT = 11, CAPTURE_VOICE_COMMUNICATION_OUTPUT = 12, BLUETOOTH_CONNECT = 13, ENUM_SIZE = 14, // Not for actual usage, used by Java }
camera/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ cc_library { local_include_dirs: ["aidl"], include_dirs: [ "frameworks/native/aidl/gui", "frameworks/native/libs/permission/aidl", ], }, Loading Loading @@ -112,6 +113,7 @@ cc_library { shared_libs: [ "camera_platform_flags_c_lib", "framework-permission-aidl-cpp", "lib-platform-compat-native-api", "libbase", "libbinder", Loading @@ -120,6 +122,7 @@ cc_library { "libgui", "liblog", "libnativewindow", "libpermission", "libutils", ], Loading @@ -132,6 +135,7 @@ cc_library { "include/camera", ], export_shared_lib_headers: [ "framework-permission-aidl-cpp", "libcamera_metadata", "libgui", "libnativewindow", Loading
camera/Camera.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -69,13 +69,12 @@ Camera::~Camera() // deadlock if we call any method of ICamera here. } sp<Camera> Camera::connect(int cameraId, const std::string& clientPackageName, int clientUid, int clientPid, int targetSdkVersion, int rotationOverride, bool forceSlowJpegMode, int32_t deviceId, int32_t devicePolicy) sp<Camera> Camera::connect(int cameraId, int targetSdkVersion, int rotationOverride, bool forceSlowJpegMode, const AttributionSourceState& clientAttribution, int32_t devicePolicy) { return CameraBaseT::connect(cameraId, clientPackageName, clientUid, clientPid, targetSdkVersion, rotationOverride, forceSlowJpegMode, deviceId, devicePolicy); return CameraBaseT::connect(cameraId, targetSdkVersion, rotationOverride, forceSlowJpegMode, clientAttribution, devicePolicy); } status_t Camera::reconnect() Loading
camera/CameraBase.cpp +13 −12 Original line number Diff line number Diff line Loading @@ -161,10 +161,10 @@ const sp<::android::hardware::ICameraService> CameraBase<TCam, TCamTraits>::getC template <typename TCam, typename TCamTraits> sp<TCam> CameraBase<TCam, TCamTraits>::connect(int cameraId, const std::string& clientPackageName, int clientUid, int clientPid, int targetSdkVersion, int rotationOverride, bool forceSlowJpegMode, int32_t deviceId, int32_t devicePolicy) int targetSdkVersion, int rotationOverride, bool forceSlowJpegMode, const AttributionSourceState& clientAttribution, int32_t devicePolicy) { ALOGV("%s: connect", __FUNCTION__); sp<TCam> c = new TCam(cameraId); Loading @@ -176,9 +176,9 @@ sp<TCam> CameraBase<TCam, TCamTraits>::connect(int cameraId, TCamConnectService fnConnectService = TCamTraits::fnConnectService; ALOGI("Connect camera (legacy API) - rotationOverride %d, forceSlowJpegMode %d", rotationOverride, forceSlowJpegMode); ret = (cs.get()->*fnConnectService)(cl, cameraId, clientPackageName, clientUid, clientPid, targetSdkVersion, rotationOverride, forceSlowJpegMode, deviceId, devicePolicy, /*out*/ &c->mCamera); ret = (cs.get()->*fnConnectService)(cl, cameraId, targetSdkVersion, rotationOverride, forceSlowJpegMode, clientAttribution, devicePolicy, /*out*/ &c->mCamera); } if (ret.isOk() && c->mCamera != nullptr) { IInterface::asBinder(c->mCamera)->linkToDeath(c); Loading Loading @@ -257,7 +257,8 @@ void CameraBase<TCam, TCamTraits>::notifyCallback(int32_t msgType, } template <typename TCam, typename TCamTraits> int CameraBase<TCam, TCamTraits>::getNumberOfCameras(int32_t deviceId, int32_t devicePolicy) { int CameraBase<TCam, TCamTraits>::getNumberOfCameras( const AttributionSourceState& clientAttribution, int32_t devicePolicy) { const sp<::android::hardware::ICameraService> cs = getCameraService(); if (!cs.get()) { Loading @@ -266,7 +267,7 @@ int CameraBase<TCam, TCamTraits>::getNumberOfCameras(int32_t deviceId, int32_t d } int32_t count; binder::Status res = cs->getNumberOfCameras( ::android::hardware::ICameraService::CAMERA_TYPE_BACKWARD_COMPATIBLE, deviceId, ::android::hardware::ICameraService::CAMERA_TYPE_BACKWARD_COMPATIBLE, clientAttribution, devicePolicy, &count); if (!res.isOk()) { ALOGE("Error reading number of cameras: %s", Loading @@ -279,12 +280,12 @@ int CameraBase<TCam, TCamTraits>::getNumberOfCameras(int32_t deviceId, int32_t d // this can be in BaseCamera but it should be an instance method template <typename TCam, typename TCamTraits> status_t CameraBase<TCam, TCamTraits>::getCameraInfo(int cameraId, int rotationOverride, int32_t deviceId, int32_t devicePolicy, int rotationOverride, const AttributionSourceState& clientAttribution, int32_t devicePolicy, struct hardware::CameraInfo* cameraInfo) { const sp<::android::hardware::ICameraService> cs = getCameraService(); if (cs == 0) return UNKNOWN_ERROR; binder::Status res = cs->getCameraInfo(cameraId, rotationOverride, deviceId, devicePolicy, cameraInfo); binder::Status res = cs->getCameraInfo(cameraId, rotationOverride, clientAttribution, devicePolicy, cameraInfo); return res.isOk() ? OK : res.serviceSpecificErrorCode(); } Loading
camera/aidl/android/hardware/ICameraService.aidl +31 −37 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware; import android.content.AttributionSourceState; import android.hardware.ICamera; import android.hardware.ICameraClient; import android.hardware.camera2.ICameraDeviceUser; Loading Loading @@ -66,13 +67,13 @@ interface ICameraService * * @param type The type of the camera, can be either CAMERA_TYPE_BACKWARD_COMPATIBLE * or CAMERA_TYPE_ALL. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default * policy. */ int getNumberOfCameras(int type, int deviceId, int devicePolicy); int getNumberOfCameras(int type, in AttributionSourceState clientAttribution, int devicePolicy); /** * If changed, reflect in Loading @@ -97,19 +98,20 @@ interface ICameraService * will override the sensor orientation and rotate and crop, while {@link * ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed * without changing the sensor orientation. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default * policy. * @return CameraInfo for the camera. */ CameraInfo getCameraInfo(int cameraId, int rotationOverride, int deviceId, int devicePolicy); CameraInfo getCameraInfo(int cameraId, int rotationOverride, in AttributionSourceState clientAttribution, int devicePolicy); /** * Default UID/PID values for non-privileged callers of * connect() and connectDevice() * Default UID/PID values for non-privileged callers of connect() and connectDevice(). Can be * used to set the pid/uid fields of AttributionSourceState to indicate the calling uid/pid * should be used. */ const int USE_CALLING_UID = -1; const int USE_CALLING_PID = -1; Loading @@ -118,9 +120,6 @@ interface ICameraService * Open a camera device through the old camera API. * * @param cameraId The ID of the camera to open. * @param opPackageName The package name to report for the app-ops. * @param clientUid UID for the calling client. * @param clientPid PID for the calling client. * @param targetSdkVersion the target sdk level of the application calling this function. * @param rotationOverride Whether to override the sensor orientation information to * correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT} Loading @@ -128,7 +127,7 @@ interface ICameraService * ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed * without changing the sensor orientation. * @param forceSlowJpegMode Whether to force slow jpeg mode. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -136,12 +135,10 @@ interface ICameraService */ ICamera connect(ICameraClient client, int cameraId, @utf8InCpp String opPackageName, int clientUid, int clientPid, int targetSdkVersion, int rotationOverride, boolean forceSlowJpegMode, int deviceId, in AttributionSourceState clientAttribution, int devicePolicy); /** Loading @@ -149,15 +146,13 @@ interface ICameraService * Only supported for device HAL versions >= 3.2. * * @param cameraId The ID of the camera to open. * @param opPackageName The package name to report for the app-ops. * @param clientUid UID for the calling client. * @param targetSdkVersion the target sdk level of the application calling this function. * @param rotationOverride Whether to override the sensor orientation information to * correspond to portrait: {@link ICameraService#ROTATION_OVERRIDE_OVERRIDE_TO_PORTRAIT} * will override the sensor orientation and rotate and crop, while {@link * ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed * without changing the sensor orientation. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -165,12 +160,10 @@ interface ICameraService */ ICameraDeviceUser connectDevice(ICameraDeviceCallbacks callbacks, @utf8InCpp String cameraId, @utf8InCpp String opPackageName, @nullable @utf8InCpp String featureId, int clientUid, int oomScoreOffset, int oomScoreOffset, int targetSdkVersion, int rotationOverride, int deviceId, in AttributionSourceState clientAttribution, int devicePolicy); /** Loading @@ -194,7 +187,7 @@ interface ICameraService * * @param sessions the set of camera id and session configuration pairs to be queried. * @param targetSdkVersion the target sdk level of the application calling this function. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -206,7 +199,7 @@ interface ICameraService */ boolean isConcurrentSessionConfigurationSupported( in CameraIdAndSessionConfiguration[] sessions, int targetSdkVersion, int deviceId, int devicePolicy); int targetSdkVersion, in AttributionSourceState clientAttribution, int devicePolicy); /** * Inject Session Params into an existing camera session. Loading Loading @@ -236,7 +229,7 @@ interface ICameraService * will override the sensor orientation and rotate and crop, while {@link * ICameraService#ROTATION_OVERRIDE_ROTATION_ONLY} will rotate and crop the camera feed * without changing the sensor orientation. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -244,7 +237,7 @@ interface ICameraService * @return Characteristics for the given camera. */ CameraMetadataNative getCameraCharacteristics(@utf8InCpp String cameraId, int targetSdkVersion, int rotationOverride, int deviceId, int devicePolicy); int rotationOverride, in AttributionSourceState clientAttribution, int devicePolicy); /** * Read in the vendor tag descriptors from the camera module HAL. Loading Loading @@ -284,14 +277,14 @@ interface ICameraService * Set the torch mode for a camera device. * * @param cameraId The ID of the camera to set torch mode for. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default * policy. */ void setTorchMode(@utf8InCpp String cameraId, boolean enabled, IBinder clientBinder, int deviceId, int devicePolicy); in AttributionSourceState clientAttribution, int devicePolicy); /** * Change the brightness level of the flash unit associated with cameraId to strengthLevel. Loading @@ -299,27 +292,28 @@ interface ICameraService * * @param cameraId The ID of the camera. * @param strengthLevel The torch strength level to set for the camera. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default * policy. */ void turnOnTorchWithStrengthLevel(@utf8InCpp String cameraId, int strengthLevel, IBinder clientBinder, int deviceId, int devicePolicy); IBinder clientBinder, in AttributionSourceState clientAttribution, int devicePolicy); /** * Get the brightness level of the flash unit associated with cameraId. * * @param cameraId The ID of the camera. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default * policy. * @return Torch strength level for the camera. */ int getTorchStrengthLevel(@utf8InCpp String cameraId, int deviceId, int devicePolicy); int getTorchStrengthLevel(@utf8InCpp String cameraId, in AttributionSourceState clientAttribution, int devicePolicy); /** * Notify the camera service of a system event. Should only be called from system_server. Loading Loading @@ -385,7 +379,7 @@ interface ICameraService * * @param cameraId The camera id to create the CaptureRequest for. * @param templateId The template id create the CaptureRequest for. * @param deviceId the device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -393,7 +387,7 @@ interface ICameraService * @return Metadata representing the CaptureRequest. */ CameraMetadataNative createDefaultRequest(@utf8InCpp String cameraId, int templateId, int deviceId, int devicePolicy); in AttributionSourceState clientAttribution, int devicePolicy); /** * Check whether a particular session configuration with optional session parameters Loading @@ -402,7 +396,7 @@ interface ICameraService * @param cameraId The camera id to query session configuration for * @param targetSdkVersion the target sdk level of the application calling this function. * @param sessionConfiguration Specific session configuration to be verified. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -412,7 +406,7 @@ interface ICameraService */ boolean isSessionConfigurationWithParametersSupported(@utf8InCpp String cameraId, int targetSdkVersion, in SessionConfiguration sessionConfiguration, int deviceId, int devicePolicy); in AttributionSourceState clientAttribution, int devicePolicy); /** * Get the camera characteristics for a particular session configuration for Loading @@ -427,7 +421,7 @@ interface ICameraService * without changing the sensor orientation. * @param sessionConfiguration Session configuration for which the characteristics * must be fetched. * @param deviceId The device id of the context associated with the caller. * @param clientAttribution The AttributionSource of the client. * @param devicePolicy The camera policy of the device of the associated context (default * policy for default device context). Only virtual cameras would be exposed * only for custom policy and only real cameras would be exposed for default Loading @@ -438,6 +432,6 @@ interface ICameraService int targetSdkVersion, int rotationOverride, in SessionConfiguration sessionConfiguration, int deviceId, in AttributionSourceState clientAttribution, int devicePolicy); }