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

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

Snap for 12348750 from 2ef9ab38 to 24Q4-release

Change-Id: I8981893258da036c9e1fbfb40f3b112d9b07a00c
parents 0003b87f 2ef9ab38
Loading
Loading
Loading
Loading
+26 −28
Original line number Diff line number Diff line
@@ -2975,15 +2975,15 @@ class StreamLogicDefaultDriver : public StreamLogicDriver {

    // The five methods below is intended to be called after the worker
    // thread has joined, thus no extra synchronization is needed.
    bool hasObservablePositionIncrease() const { return mObservablePositionIncrease; }
    bool hasObservableRetrogradePosition() const { return mRetrogradeObservablePosition; }
    bool hasObservablePositionIncrease() const { return mObservable.hasPositionIncrease; }
    bool hasObservableRetrogradePosition() const { return mObservable.hasRetrogradePosition; }
    bool hasHardwarePositionIncrease() const {
        // For non-MMap, always return true to pass the validation.
        return mIsMmap ? mHardwarePositionIncrease : true;
        return mIsMmap ? mHardware.hasPositionIncrease : true;
    }
    bool hasHardwareRetrogradePosition() const {
        // For non-MMap, always return false to pass the validation.
        return mIsMmap ? mRetrogradeHardwarePosition : false;
        return mIsMmap ? mHardware.hasRetrogradePosition : false;
    }
    std::string getUnexpectedStateTransition() const { return mUnexpectedTransition; }

@@ -3011,25 +3011,9 @@ class StreamLogicDefaultDriver : public StreamLogicDriver {
    }
    bool interceptRawReply(const StreamDescriptor::Reply&) override { return false; }
    bool processValidReply(const StreamDescriptor::Reply& reply) override {
        if (reply.observable.frames != StreamDescriptor::Position::UNKNOWN) {
            if (mPreviousObservableFrames.has_value()) {
                if (reply.observable.frames > mPreviousObservableFrames.value()) {
                    mObservablePositionIncrease = true;
                } else if (reply.observable.frames < mPreviousObservableFrames.value()) {
                    mRetrogradeObservablePosition = true;
                }
            }
            mPreviousObservableFrames = reply.observable.frames;
        }
        mObservable.update(reply.observable.frames);
        if (mIsMmap) {
            if (mPreviousHardwareFrames.has_value()) {
                if (reply.hardware.frames > mPreviousHardwareFrames.value()) {
                    mHardwarePositionIncrease = true;
                } else if (reply.hardware.frames < mPreviousHardwareFrames.value()) {
                    mRetrogradeHardwarePosition = true;
                }
            }
            mPreviousHardwareFrames = reply.hardware.frames;
            mHardware.update(reply.hardware.frames);
        }

        auto expected = mCommands->getExpectedStates();
@@ -3054,16 +3038,30 @@ class StreamLogicDefaultDriver : public StreamLogicDriver {
    }

  protected:
    struct FramesCounter {
        std::optional<int64_t> previous;
        bool hasPositionIncrease = false;
        bool hasRetrogradePosition = false;

        void update(int64_t position) {
            if (position == StreamDescriptor::Position::UNKNOWN) return;
            if (previous.has_value()) {
                if (position > previous.value()) {
                    hasPositionIncrease = true;
                } else if (position < previous.value()) {
                    hasRetrogradePosition = true;
                }
            }
            previous = position;
        }
    };

    std::shared_ptr<StateSequence> mCommands;
    const size_t mFrameSizeBytes;
    const bool mIsMmap;
    std::optional<StreamDescriptor::State> mPreviousState;
    std::optional<int64_t> mPreviousObservableFrames;
    bool mObservablePositionIncrease = false;
    bool mRetrogradeObservablePosition = false;
    std::optional<int64_t> mPreviousHardwareFrames;
    bool mHardwarePositionIncrease = false;
    bool mRetrogradeHardwarePosition = false;
    FramesCounter mObservable;
    FramesCounter mHardware;
    std::string mUnexpectedTransition;
};

+6 −0
Original line number Diff line number Diff line
@@ -22,6 +22,12 @@ aidl_interface {
        cpp: {
            enabled: false,
        },
        ndk: {
            apex_available: [
                "//apex_available:anyapex",
                "//apex_available:platform",
            ],
        },
    },
    versions_with_info: [
        {
+5 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ cc_library {
    //   SPDX-license-identifier-Apache-2.0
    name: "android.hardware.biometrics.common.config",
    export_include_dirs: ["include"],
    vendor: true,
    vendor_available: true,
    srcs: [
        "Config.cpp",
    ],
@@ -30,6 +30,10 @@ cc_library {
        "libbase",
        "libbinder_ndk",
    ],
    apex_available: [
        "//apex_available:anyapex",
        "//apex_available:platform",
    ],
}

cc_test_host {
+5 −1
Original line number Diff line number Diff line
@@ -10,10 +10,14 @@ cc_library {
    //   SPDX-license-identifier-Apache-2.0
    name: "android.hardware.biometrics.common.thread",
    export_include_dirs: ["include"],
    vendor: true,
    vendor_available: true,
    srcs: [
        "WorkerThread.cpp",
    ],
    apex_available: [
        "//apex_available:anyapex",
        "//apex_available:platform",
    ],
}

cc_test_host {
+5 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ cc_library {
    //   SPDX-license-identifier-Apache-2.0
    name: "android.hardware.biometrics.common.util",
    export_include_dirs: ["include"],
    vendor: true,
    vendor_available: true,
    srcs: [
        "CancellationSignal.cpp",
    ],
@@ -15,4 +15,8 @@ cc_library {
        "libbinder_ndk",
        "android.hardware.biometrics.common-V4-ndk",
    ],
    apex_available: [
        "//apex_available:anyapex",
        "//apex_available:platform",
    ],
}
Loading