Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd96a1fb authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12637843 from fbcf1e99 to 25Q1-release

Change-Id: Ib73849c5b2f509f74ea73ed6e6b22371dfa5c448
parents 3f87f905 fbcf1e99
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -175,16 +175,10 @@ flag {

flag {
    namespace: "camera_platform"
    name: "use_context_attribution_source"
    description: "Use the context-provided AttributionSource when checking for client permissions"
    bug: "190657833"
}

flag {
    namespace: "camera_platform"
    name: "check_full_attribution_source_chain"
    description: "Pass the full AttributionSource chain to PermissionChecker"
    name: "data_delivery_permission_checks"
    description: "Pass the full AttributionSource chain to PermissionChecker for data delivery"
    bug: "190657833"
    is_fixed_read_only: true
}

flag {
@@ -226,3 +220,12 @@ flag {
    description: "Gives apps explicit control on reflects zoom via ZOOM_RATIO capture result"
    bug: "298899993"
}

flag {
    namespace: "camera_platform"
    is_exported: true
    name: "ae_priority"
    description: "Add AE priority modes"
    bug: "359944765"
}
+1 −0
Original line number Diff line number Diff line
@@ -563,6 +563,7 @@ ACameraMetadata::isCaptureRequestTag(const uint32_t tag) {
        case ACAMERA_CONTROL_SETTINGS_OVERRIDE:
        case ACAMERA_CONTROL_AUTOFRAMING:
        case ACAMERA_CONTROL_ZOOM_METHOD:
        case ACAMERA_CONTROL_AE_PRIORITY_MODE:
        case ACAMERA_EDGE_MODE:
        case ACAMERA_FLASH_MODE:
        case ACAMERA_FLASH_STRENGTH_LEVEL:
+103 −3
Original line number Diff line number Diff line
@@ -563,7 +563,9 @@ typedef enum acamera_metadata_tag {
     * application's selected exposure time, sensor sensitivity,
     * and frame duration (ACAMERA_SENSOR_EXPOSURE_TIME,
     * ACAMERA_SENSOR_SENSITIVITY, and
     * ACAMERA_SENSOR_FRAME_DURATION). If one of the FLASH modes
     * ACAMERA_SENSOR_FRAME_DURATION). If ACAMERA_CONTROL_AE_PRIORITY_MODE is
     * enabled, the relevant priority CaptureRequest settings will not be overridden.
     * See ACAMERA_CONTROL_AE_PRIORITY_MODE for more details. If one of the FLASH modes
     * is selected, the camera device's flash unit controls are
     * also overridden.</p>
     * <p>The FLASH modes are only available if the camera device
@@ -583,6 +585,7 @@ typedef enum acamera_metadata_tag {
     * different ACAMERA_FLASH_STRENGTH_LEVEL.</p>
     *
     * @see ACAMERA_CONTROL_AE_MODE
     * @see ACAMERA_CONTROL_AE_PRIORITY_MODE
     * @see ACAMERA_CONTROL_MODE
     * @see ACAMERA_FLASH_INFO_AVAILABLE
     * @see ACAMERA_FLASH_MODE
@@ -2435,6 +2438,61 @@ typedef enum acamera_metadata_tag {
     */
    ACAMERA_CONTROL_ZOOM_METHOD =                               // byte (acamera_metadata_enum_android_control_zoom_method_t)
            ACAMERA_CONTROL_START + 60,
    /**
     * <p>Turn on AE priority mode.</p>
     *
     * <p>Type: byte (acamera_metadata_enum_android_control_ae_priority_mode_t)</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks</li>
     *   <li>ACaptureRequest</li>
     * </ul></p>
     *
     * <p>This control is only effective if ACAMERA_CONTROL_MODE is
     * AUTO and ACAMERA_CONTROL_AE_MODE is set to one of its
     * ON modes, with the exception of ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY.</p>
     * <p>When a priority mode is enabled, the camera device's
     * auto-exposure routine will maintain the application's
     * selected parameters relevant to the priority mode while overriding
     * the remaining exposure parameters
     * (ACAMERA_SENSOR_EXPOSURE_TIME, ACAMERA_SENSOR_SENSITIVITY, and
     * ACAMERA_SENSOR_FRAME_DURATION). For example, if
     * SENSOR_SENSITIVITY_PRIORITY mode is enabled, the camera device will
     * maintain the application-selected ACAMERA_SENSOR_SENSITIVITY
     * while adjusting ACAMERA_SENSOR_EXPOSURE_TIME
     * and ACAMERA_SENSOR_FRAME_DURATION. The overridden fields for a
     * given capture will be available in its CaptureResult.</p>
     *
     * @see ACAMERA_CONTROL_AE_MODE
     * @see ACAMERA_CONTROL_MODE
     * @see ACAMERA_SENSOR_EXPOSURE_TIME
     * @see ACAMERA_SENSOR_FRAME_DURATION
     * @see ACAMERA_SENSOR_SENSITIVITY
     */
    ACAMERA_CONTROL_AE_PRIORITY_MODE =                          // byte (acamera_metadata_enum_android_control_ae_priority_mode_t)
            ACAMERA_CONTROL_START + 61,
    /**
     * <p>List of auto-exposure priority modes for ACAMERA_CONTROL_AE_PRIORITY_MODE
     * that are supported by this camera device.</p>
     *
     * @see ACAMERA_CONTROL_AE_PRIORITY_MODE
     *
     * <p>Type: byte[n]</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     * </ul></p>
     *
     * <p>This entry lists the valid modes for
     * ACAMERA_CONTROL_AE_PRIORITY_MODE for this camera device.
     * If no AE priority modes are available for a device, this will only list OFF.</p>
     *
     * @see ACAMERA_CONTROL_AE_PRIORITY_MODE
     */
    ACAMERA_CONTROL_AE_AVAILABLE_PRIORITY_MODES =               // byte[n]
            ACAMERA_CONTROL_START + 62,
    ACAMERA_CONTROL_END,
    /**
@@ -4921,9 +4979,12 @@ typedef enum acamera_metadata_tag {
     * duration exposed to the nearest possible value (rather than expose longer).
     * The final exposure time used will be available in the output capture result.</p>
     * <p>This control is only effective if ACAMERA_CONTROL_AE_MODE or ACAMERA_CONTROL_MODE is set to
     * OFF; otherwise the auto-exposure algorithm will override this value.</p>
     * OFF; otherwise the auto-exposure algorithm will override this value. However, in the
     * case that ACAMERA_CONTROL_AE_PRIORITY_MODE is set to SENSOR_EXPOSURE_TIME_PRIORITY, this
     * control will be effective and not controlled by the auto-exposure algorithm.</p>
     *
     * @see ACAMERA_CONTROL_AE_MODE
     * @see ACAMERA_CONTROL_AE_PRIORITY_MODE
     * @see ACAMERA_CONTROL_MODE
     */
    ACAMERA_SENSOR_EXPOSURE_TIME =                              // int64
@@ -5032,7 +5093,9 @@ typedef enum acamera_metadata_tag {
     * value. The final sensitivity used will be available in the
     * output capture result.</p>
     * <p>This control is only effective if ACAMERA_CONTROL_AE_MODE or ACAMERA_CONTROL_MODE is set to
     * OFF; otherwise the auto-exposure algorithm will override this value.</p>
     * OFF; otherwise the auto-exposure algorithm will override this value. However, in the
     * case that ACAMERA_CONTROL_AE_PRIORITY_MODE is set to SENSOR_SENSITIVITY_PRIORITY, this
     * control will be effective and not controlled by the auto-exposure algorithm.</p>
     * <p>Note that for devices supporting postRawSensitivityBoost, the total sensitivity applied
     * to the final processed image is the combination of ACAMERA_SENSOR_SENSITIVITY and
     * ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST. In case the application uses the sensor
@@ -5041,6 +5104,7 @@ typedef enum acamera_metadata_tag {
     * set postRawSensitivityBoost.</p>
     *
     * @see ACAMERA_CONTROL_AE_MODE
     * @see ACAMERA_CONTROL_AE_PRIORITY_MODE
     * @see ACAMERA_CONTROL_MODE
     * @see ACAMERA_CONTROL_POST_RAW_SENSITIVITY_BOOST
     * @see ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE
@@ -9686,6 +9750,42 @@ typedef enum acamera_metadata_enum_acamera_control_low_light_boost_state {
} acamera_metadata_enum_android_control_low_light_boost_state_t;
// ACAMERA_CONTROL_AE_PRIORITY_MODE
typedef enum acamera_metadata_enum_acamera_control_ae_priority_mode {
    /**
     * <p>Disable AE priority mode. This is the default value.</p>
     */
    ACAMERA_CONTROL_AE_PRIORITY_MODE_OFF                             = 0,
    /**
     * <p>The camera device's auto-exposure routine is active and
     * prioritizes the application-selected ISO (ACAMERA_SENSOR_SENSITIVITY).</p>
     * <p>The application has control over ACAMERA_SENSOR_SENSITIVITY while
     * the application's values for ACAMERA_SENSOR_EXPOSURE_TIME and
     * ACAMERA_SENSOR_FRAME_DURATION are ignored.</p>
     *
     * @see ACAMERA_SENSOR_EXPOSURE_TIME
     * @see ACAMERA_SENSOR_FRAME_DURATION
     * @see ACAMERA_SENSOR_SENSITIVITY
     */
    ACAMERA_CONTROL_AE_PRIORITY_MODE_SENSOR_SENSITIVITY_PRIORITY     = 1,
    /**
     * <p>The camera device's auto-exposure routine is active and
     * prioritizes the application-selected exposure time
     * (ACAMERA_SENSOR_EXPOSURE_TIME).</p>
     * <p>The application has control over ACAMERA_SENSOR_EXPOSURE_TIME while
     * the application's values for ACAMERA_SENSOR_SENSITIVITY and
     * ACAMERA_SENSOR_FRAME_DURATION are ignored.</p>
     *
     * @see ACAMERA_SENSOR_EXPOSURE_TIME
     * @see ACAMERA_SENSOR_FRAME_DURATION
     * @see ACAMERA_SENSOR_SENSITIVITY
     */
    ACAMERA_CONTROL_AE_PRIORITY_MODE_SENSOR_EXPOSURE_TIME_PRIORITY   = 2,
} acamera_metadata_enum_android_control_ae_priority_mode_t;
// ACAMERA_EDGE_MODE
+11 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

#include "aaudio/AAudio.h"
#include "aaudio/AAudioTesting.h"
#include "system/aaudio/AAudio.h"
#include <fuzzer/FuzzedDataProvider.h>

#include <functional>
@@ -183,6 +184,12 @@ void LibAaudioFuzzer::invokeAAudioSetAPIs(FuzzedDataProvider &fdp){
          fdp.PickValueInArray({AAUDIO_UNSPECIFIED, fdp.ConsumeIntegral<int32_t>()});
  AAudioStreamBuilder_setFramesPerDataCallback(mAaudioBuilder, framesPerDataCallback);

  const size_t tagsNumBytes = fdp.ConsumeIntegralInRange<size_t>(
          0, AAUDIO_ATTRIBUTES_TAGS_MAX_SIZE + 10);
  AAudioStreamBuilder_setTags(mAaudioBuilder,
                              (tagsNumBytes == 0 ? nullptr
                                                 : fdp.ConsumeBytesAsString(tagsNumBytes).c_str()));

  aaudio_policy_t policy =
          fdp.PickValueInArray({fdp.PickValueInArray(kPolicies), fdp.ConsumeIntegral<int32_t>()});
  AAudio_setMMapPolicy(policy);
@@ -193,6 +200,7 @@ void LibAaudioFuzzer::process(const uint8_t *data, size_t size) {
  int32_t maxFrames = 0;
  int32_t count = 0;
  aaudio_stream_state_t state = AAUDIO_STREAM_STATE_UNKNOWN;
  char tags[AAUDIO_ATTRIBUTES_TAGS_MAX_SIZE + 1];

  invokeAAudioSetAPIs(fdp);

@@ -311,6 +319,9 @@ void LibAaudioFuzzer::process(const uint8_t *data, size_t size) {
            [&]() {
                (void)AAudioStream_getBufferSizeInFrames(mAaudioStream);
            },
            [&]() {
                (void)AAudioStream_getTags(mAaudioStream, tags);
            },
            [&]() {
                (void)AAudioStream_isMMapUsed(mAaudioStream);
            },
+9 −9
Original line number Diff line number Diff line
@@ -2275,7 +2275,7 @@ Status CameraService::connectDevice(

    bool isNonSystemNdk = clientPackageNameMaybe.size() == 0;

    if (!flags::use_context_attribution_source()) {
    if (!flags::data_delivery_permission_checks()) {
        resolvedClientAttribution.pid = USE_CALLING_PID;
    }

@@ -4281,7 +4281,7 @@ status_t CameraService::BasicClient::notifyCameraOpening() {
    ATRACE_CALL();

    // Don't start watching until we're streaming when using permissionChecker for data delivery
    if (!flags::check_full_attribution_source_chain()) {
    if (!flags::data_delivery_permission_checks()) {
        ALOGD("%s: Start camera ops, package name = %s, client UID = %d", __FUNCTION__,
              getPackageName().c_str(), getClientUid());

@@ -4303,7 +4303,7 @@ status_t CameraService::BasicClient::notifyCameraOpening() {
            }
        }
    } else {
        // TODO: Remove when removing the check_full_attribution_source_chain flag
        // TODO: Remove when removing the data_delivery_permission_checks flag
        ALOGD("%s: Bypassing checkOp for uid %d", __FUNCTION__, getClientUid());
    }

@@ -4337,7 +4337,7 @@ status_t CameraService::BasicClient::startCameraStreamingOps() {
          getPackageName().c_str(), getClientUid());

    if (mAppOpsManager != nullptr) {
        if (flags::check_full_attribution_source_chain()) {
        if (flags::data_delivery_permission_checks()) {
            ALOGD("%s: Start data delivery for uid %d", __FUNCTION__, getClientUid());

            const PermissionChecker::PermissionResult result =
@@ -4381,7 +4381,7 @@ status_t CameraService::BasicClient::noteAppOp() {

    // noteAppOp is only used for when camera mute is not supported, in order
    // to trigger the sensor privacy "Unblock" dialog
    if (flags::check_full_attribution_source_chain()) {
    if (flags::data_delivery_permission_checks()) {
        // Ignore the result, since we're only triggering the dialog
        ALOGD("%s: Check data delivery permissions for uid %d", __FUNCTION__, getClientUid());
        hasPermissionsForCameraForDataDelivery(std::string(), mClientAttribution);
@@ -4413,7 +4413,7 @@ status_t CameraService::BasicClient::finishCameraStreamingOps() {
    }

    if (mAppOpsManager != nullptr) {
        if (flags::check_full_attribution_source_chain()) {
        if (flags::data_delivery_permission_checks()) {
            ALOGD("%s: finishDataDelivery for uid %d", __FUNCTION__, getClientUid());
            finishDataDelivery(mClientAttribution);

@@ -4458,7 +4458,7 @@ status_t CameraService::BasicClient::notifyCameraClosing() {
    }

    // When using the data delivery permission checks, the open state does not involve AppOps
    if (!flags::check_full_attribution_source_chain()) {
    if (!flags::data_delivery_permission_checks()) {
        // Always stop watching, even if no camera op is active
        if (mOpsCallback != nullptr && mAppOpsManager != nullptr) {
            mAppOpsManager->stopWatchingMode(mOpsCallback);
@@ -4486,7 +4486,7 @@ void CameraService::BasicClient::opChanged(int32_t op, const String16&) {
    }

    PermissionChecker::PermissionResult res;
    if (flags::check_full_attribution_source_chain()) {
    if (flags::data_delivery_permission_checks()) {
        int32_t appOpMode = AppOpsManager::MODE_ALLOWED;
        std::for_each(AttrSourceItr{mClientAttribution}, AttrSourceItr::end(),
                [&](const auto& attr) {
@@ -4522,7 +4522,7 @@ void CameraService::BasicClient::opChanged(int32_t op, const String16&) {
        // Uid may be active, but not visible to the user (e.g. PROCESS_STATE_FOREGROUND_SERVICE).
        // If not visible, but still active, then we want to block instead of muting the camera.
        int32_t procState = ActivityManager::PROCESS_STATE_NONEXISTENT;
        if (flags::check_full_attribution_source_chain()) {
        if (flags::data_delivery_permission_checks()) {
            // Use the proc state of the last uid in the chain (ultimately receiving the data)
            // when determining whether to mute or block
            int32_t uid = -1;
Loading