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

Commit 3e9aeb2e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove impl from InputClassifier HAL"

parents 592b5927 443e98b1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
cc_binary {
    name: "android.hardware.input.classifier@1.0-service-example",
    init_rc: ["android.hardware.input.classifier@1.0-service-example.rc"],
    name: "android.hardware.input.classifier@1.0-service.default",
    init_rc: ["android.hardware.input.classifier@1.0-service.default.rc"],
    relative_install_path: "hw",
    vendor: true,
    vintf_fragments: ["manifest_input.classifier.xml"],
+8 −25
Original line number Diff line number Diff line
@@ -31,41 +31,24 @@ namespace V1_0 {
namespace implementation {

// Methods from ::android::hardware::input::classifier::V1_0::IInputClassifier follow.
Return<Classification> InputClassifier::classify(const MotionEvent& event) {
Return<Classification> InputClassifier::classify(const MotionEvent& /*event*/) {
    /**
     * In this example implementation, we will see how many "pixels" inside the video frame
     * exceed the value of 250. If more than 6 such pixels are present, then treat the event
     * as a "DEEP_PRESS".
     * The touchscreen data is highly device-dependent.
     * As a result, the implementation of this method will likely be hardware-specific.
     * Here we just report gesture as not having any classification, which means that the
     * default action will be taken in the framework.
     * This is equivalent to not having the InputClassifier HAL at all.
     */
    if (event.frames.size() == 0) {
        return Classification::NONE;
    }
    ALOGI("Frame(O) timestamp = %" PRIu64 ", received %zu frame(s)", event.frames[0].timestamp,
          event.frames.size());
    for (const VideoFrame& frame : event.frames) {
        size_t count = 0;
        for (size_t i = 0; i < frame.data.size(); i++) {
            if (frame.data[i] > 250) {
                count++;
            }
        }
        if (count > 6) {
            return Classification::DEEP_PRESS;
        }
    }

    return Classification::NONE;
}

Return<void> InputClassifier::reset() {
    // We don't have any internal state in this example implementation,
    // so no work needed here.
    // We don't have any internal state, so no work needed here.
    return Void();
}

Return<void> InputClassifier::resetDevice(int32_t /*deviceId*/) {
    // We don't have any internal per-device state in this example implementation,
    // so no work needed here.
    // We don't have any internal per-device state, so no work needed here.
    return Void();
}

+1 −1
Original line number Diff line number Diff line
service vendor.input.classifier-1-0 /vendor/bin/hw/android.hardware.input.classifier@1.0-service-example
service vendor.input.classifier-1-0 /vendor/bin/hw/android.hardware.input.classifier@1.0-service.default
    # Must be specified if "disabled" is set. This HAL will only start if requested via getService
    interface android.hardware.input.classifier@1.0::IInputClassifier default
    class hal