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

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

Snap for 11200327 from e2ab81bd to 24Q1-release

Change-Id: I9b2ae8194f83bc2510506233d726f09a3878a6f7
parents aac54ea8 e2ab81bd
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -148,6 +148,18 @@ interface ICameraService
     */
     */
    void remapCameraIds(in CameraIdRemapping cameraIdRemapping);
    void remapCameraIds(in CameraIdRemapping cameraIdRemapping);


    /**
     * Inject Session Params into an existing camera session.
     *
     * @param cameraId the camera id session to inject session params into. Note that
     *                 if there is no active session for the input cameraid, this operation
     *                 will be a no-op. In addition, future camera sessions for cameraid will
     *                 not be affected.
     * @param sessionParams the session params to override for the existing session.
     */
    void injectSessionParams(@utf8InCpp String cameraId,
            in CameraMetadataNative sessionParams);

    /**
    /**
     * Remove listener for changes to camera device and flashlight state.
     * Remove listener for changes to camera device and flashlight state.
     */
     */
+7 −0
Original line number Original line Diff line number Diff line
@@ -62,3 +62,10 @@ flag {
    description: "Enable session parameter injection via reconfiguration"
    description: "Enable session parameter injection via reconfiguration"
    bug: "308984721"
    bug: "308984721"
}
}

flag {
     namespace: "camera_platform"
     name: "camera_ae_mode_low_light_boost"
     description: "An AE mode that enables increased brightening in low light scenes"
     bug: "312803148"
}
+85 −0
Original line number Original line Diff line number Diff line
@@ -2244,6 +2244,39 @@ typedef enum acamera_metadata_tag {
     */
     */
    ACAMERA_CONTROL_AUTOFRAMING_STATE =                         // byte (acamera_metadata_enum_android_control_autoframing_state_t)
    ACAMERA_CONTROL_AUTOFRAMING_STATE =                         // byte (acamera_metadata_enum_android_control_autoframing_state_t)
            ACAMERA_CONTROL_START + 54,
            ACAMERA_CONTROL_START + 54,
    /**
     * <p>The operating luminance range of low light boost measured in lux (lx).</p>
     *
     * <p>Type: float[2]</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     * </ul></p>
     *
     */
    ACAMERA_CONTROL_LOW_LIGHT_BOOST_INFO_LUMINANCE_RANGE =      // float[2]
            ACAMERA_CONTROL_START + 55,
    /**
     * <p>Current state of the low light boost AE mode.</p>
     *
     * <p>Type: byte (acamera_metadata_enum_android_control_low_light_boost_state_t)</p>
     *
     * <p>This tag may appear in:
     * <ul>
     *   <li>ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks</li>
     * </ul></p>
     *
     * <p>When low light boost is enabled by setting the AE mode to
     * 'ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY', it can dynamically apply a low light
     * boost when the light level threshold is exceeded.</p>
     * <p>This state indicates when low light boost is 'ACTIVE' and applied. Similarly, it can
     * indicate when it is not being applied by returning 'INACTIVE'.</p>
     * <p>This key will be absent from the CaptureResult if AE mode is not set to
     * 'ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY.</p>
     */
    ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE =                     // byte (acamera_metadata_enum_android_control_low_light_boost_state_t)
            ACAMERA_CONTROL_START + 56,
    ACAMERA_CONTROL_END,
    ACAMERA_CONTROL_END,
    /**
    /**
@@ -8214,6 +8247,44 @@ typedef enum acamera_metadata_enum_acamera_control_ae_mode {
     */
     */
    ACAMERA_CONTROL_AE_MODE_ON_EXTERNAL_FLASH                        = 5,
    ACAMERA_CONTROL_AE_MODE_ON_EXTERNAL_FLASH                        = 5,
    /**
     * <p>Like 'ON' but applies additional brightness boost in low light scenes.</p>
     * <p>When the scene lighting conditions are within the range defined by
     * ACAMERA_CONTROL_LOW_LIGHT_BOOST_INFO_LUMINANCE_RANGE this mode will apply additional
     * brightness boost.</p>
     * <p>This mode will automatically adjust the intensity of low light boost applied
     * according to the scene lighting conditions. A darker scene will receive more boost
     * while a brighter scene will receive less boost.</p>
     * <p>This mode can ignore the set target frame rate to allow more light to be captured
     * which can result in choppier motion. The frame rate can extend to lower than the
     * ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES but will not go below 10 FPS. This mode
     * can also increase the sensor sensitivity gain which can result in increased luma
     * and chroma noise. The sensor sensitivity gain can extend to higher values beyond
     * ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE. This mode may also apply additional
     * processing to recover details in dark and bright areas of the image,and noise
     * reduction at high sensitivity gain settings to manage the trade-off between light
     * sensitivity and capture noise.</p>
     * <p>This mode is restricted to two output surfaces. One output surface type can either
     * be SurfaceView or TextureView. Another output surface type can either be MediaCodec
     * or MediaRecorder. This mode cannot be used with a target FPS range higher than 30
     * FPS.</p>
     * <p>If the session configuration is not supported, the AE mode reported in the
     * CaptureResult will be 'ON' instead of 'ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY'.</p>
     * <p>The application can observe the CapturerResult field
     * ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE to determine when low light boost is 'ACTIVE' or
     * 'INACTIVE'.</p>
     * <p>The low light boost is 'ACTIVE' once the scene lighting condition is less than the
     * upper bound lux value defined by ACAMERA_CONTROL_LOW_LIGHT_BOOST_INFO_LUMINANCE_RANGE.
     * This mode will be 'INACTIVE' once the scene lighting condition is greater than the
     * upper bound lux value defined by ACAMERA_CONTROL_LOW_LIGHT_BOOST_INFO_LUMINANCE_RANGE.</p>
     *
     * @see ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES
     * @see ACAMERA_CONTROL_LOW_LIGHT_BOOST_INFO_LUMINANCE_RANGE
     * @see ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE
     * @see ACAMERA_SENSOR_INFO_SENSITIVITY_RANGE
     */
    ACAMERA_CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY   = 6,
} acamera_metadata_enum_android_control_ae_mode_t;
} acamera_metadata_enum_android_control_ae_mode_t;
// ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER
// ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER
@@ -9215,6 +9286,20 @@ typedef enum acamera_metadata_enum_acamera_control_autoframing_state {
} acamera_metadata_enum_android_control_autoframing_state_t;
} acamera_metadata_enum_android_control_autoframing_state_t;
// ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE
typedef enum acamera_metadata_enum_acamera_control_low_light_boost_state {
    /**
     * <p>The AE mode 'ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY' is enabled but not applied.</p>
     */
    ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE_INACTIVE                   = 0,
    /**
     * <p>The AE mode 'ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY' is enabled and applied.</p>
     */
    ACAMERA_CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE                     = 1,
} acamera_metadata_enum_android_control_low_light_boost_state_t;
// ACAMERA_EDGE_MODE
// ACAMERA_EDGE_MODE
+15 −0
Original line number Original line Diff line number Diff line
@@ -117,6 +117,16 @@ struct C2SyncVariables {
     */
     */
    void notifyAll();
    void notifyAll();


    /**
     * Invalide current sync variables on the death of the other process.
     */
    void invalidate();

    /**
     * If a dead process holds the lock, clear the lock.
     */
    void clearLockIfNecessary();

    C2SyncVariables() {}
    C2SyncVariables() {}


private:
private:
@@ -135,6 +145,11 @@ private:
     */
     */
    int wait();
    int wait();


    /**
     * try lock for the specified duration.
     */
    bool tryLockFor(size_t ms);

    std::atomic<uint32_t> mLock;
    std::atomic<uint32_t> mLock;
    std::atomic<uint32_t> mCond;
    std::atomic<uint32_t> mCond;
    int32_t mMaxDequeueCount;
    int32_t mMaxDequeueCount;
+59 −4
Original line number Original line Diff line number Diff line
@@ -396,6 +396,12 @@ private:
                    if (c2Fence) {
                    if (c2Fence) {
                        *c2Fence = _C2FenceFactory::CreateSurfaceFence(mSyncMem, waitId);
                        *c2Fence = _C2FenceFactory::CreateSurfaceFence(mSyncMem, waitId);
                    }
                    }
                    if (mInvalidated) {
                        if (c2Fence) {
                            *c2Fence = C2Fence();
                        }
                        return C2_BAD_STATE;
                    }
                    return C2_BLOCKING;
                    return C2_BLOCKING;
                }
                }
                if (syncVar->getSyncStatusLocked() != C2SyncVariables::STATUS_ACTIVE) {
                if (syncVar->getSyncStatusLocked() != C2SyncVariables::STATUS_ACTIVE) {
@@ -404,6 +410,12 @@ private:
                    if (c2Fence) {
                    if (c2Fence) {
                        *c2Fence = _C2FenceFactory::CreateSurfaceFence(mSyncMem, waitId);
                        *c2Fence = _C2FenceFactory::CreateSurfaceFence(mSyncMem, waitId);
                    }
                    }
                    if (mInvalidated) {
                        if (c2Fence) {
                            *c2Fence = C2Fence();
                        }
                        return C2_BAD_STATE;
                    }
                    return C2_BLOCKING;
                    return C2_BLOCKING;
                }
                }
                syncVar->notifyDequeuedLocked();
                syncVar->notifyDequeuedLocked();
@@ -690,7 +702,6 @@ public:
            }
            }
        }
        }
        int migrated = 0;
        int migrated = 0;
        std::shared_ptr<C2SurfaceSyncMemory> oldMem;
        // poolDatas dtor should not be called during lock is held.
        // poolDatas dtor should not be called during lock is held.
        std::shared_ptr<C2BufferQueueBlockPoolData>
        std::shared_ptr<C2BufferQueueBlockPoolData>
                poolDatas[NUM_BUFFER_SLOTS];
                poolDatas[NUM_BUFFER_SLOTS];
@@ -708,8 +719,22 @@ public:
                mGeneration = 0;
                mGeneration = 0;
                ALOGD("configuring null producer: igbp_information(%d)", bqInformation);
                ALOGD("configuring null producer: igbp_information(%d)", bqInformation);
            }
            }
            oldMem = mSyncMem; // preven destruction while locked.
            if (mInvalidated) {
                return;
            }
            {
                std::unique_lock<std::mutex> memLock(mSyncMemMutex);
                mOldMem = mSyncMem; // prevent destruction while locked.
                                    // The waiters from the old memory will be
                                    // woken up by the client after this
                                    // configuration from HAL being finished.
                                    // But we will keep this in case of the
                                    // client being dead in between.
                                    // In the case the death listener will wake
                                    // up the wiators for the old memory using
                                    // mOldMem here.
                mSyncMem = c2SyncMem;
                mSyncMem = c2SyncMem;
            }
            C2SyncVariables *syncVar = mSyncMem ? mSyncMem->mem() : nullptr;
            C2SyncVariables *syncVar = mSyncMem ? mSyncMem->mem() : nullptr;
            if (syncVar) {
            if (syncVar) {
                syncVar->lock();
                syncVar->lock();
@@ -736,6 +761,9 @@ public:
                // is no longer valid.
                // is no longer valid.
                mIgbpValidityToken = std::make_shared<int>(0);
                mIgbpValidityToken = std::make_shared<int>(0);
            }
            }
            if (mInvalidated) {
                mIgbpValidityToken = std::make_shared<int>(0);
            }
            for (int i = 0; i < NUM_BUFFER_SLOTS; ++i) {
            for (int i = 0; i < NUM_BUFFER_SLOTS; ++i) {
                mBuffers[i] = buffers[i];
                mBuffers[i] = buffers[i];
                mPoolDatas[i] = poolDatas[i];
                mPoolDatas[i] = poolDatas[i];
@@ -754,8 +782,33 @@ public:
    }
    }


    void invalidate() {
    void invalidate() {
        mInvalidated = true;
        std::shared_ptr<C2SurfaceSyncMemory> syncMem;
        std::shared_ptr<C2SurfaceSyncMemory> oldMem;
        {
            std::unique_lock<std::mutex> l(mSyncMemMutex);
            bool old = mInvalidated.exchange(true);
            if (old) {
                return;
            }
            syncMem = mSyncMem;
            oldMem = mOldMem;
        }
        mIgbpValidityToken.reset();
        mIgbpValidityToken.reset();
        C2SyncVariables *syncVar = syncMem ? syncMem->mem(): nullptr;
        if (syncVar) {
            syncVar->invalidate();
        }
        C2SyncVariables *oldVar = oldMem ? oldMem->mem(): nullptr;
        if (oldVar) {
            oldVar->invalidate();
        }
        // invalidate pending lock from a dead process if any
        if (syncVar) {
            syncVar->clearLockIfNecessary();
        }
        if (oldVar) {
            oldVar->clearLockIfNecessary();
        }
    }
    }


private:
private:
@@ -780,7 +833,9 @@ private:
    sp<GraphicBuffer> mBuffers[NUM_BUFFER_SLOTS];
    sp<GraphicBuffer> mBuffers[NUM_BUFFER_SLOTS];
    std::weak_ptr<C2BufferQueueBlockPoolData> mPoolDatas[NUM_BUFFER_SLOTS];
    std::weak_ptr<C2BufferQueueBlockPoolData> mPoolDatas[NUM_BUFFER_SLOTS];


    std::mutex mSyncMemMutex;
    std::shared_ptr<C2SurfaceSyncMemory> mSyncMem;
    std::shared_ptr<C2SurfaceSyncMemory> mSyncMem;
    std::shared_ptr<C2SurfaceSyncMemory> mOldMem;


    // IGBP invalidation notification token.
    // IGBP invalidation notification token.
    // The buffers(C2BufferQueueBlockPoolData) has the reference to the IGBP where
    // The buffers(C2BufferQueueBlockPoolData) has the reference to the IGBP where
Loading