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

Commit 905e8eaf authored by Lais Andrade's avatar Lais Andrade Committed by Android (Google) Code Review
Browse files

Merge "Fix VibrationThread handling old HAL callbacks" into main

parents 06892efb 2a9d5d3c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -145,3 +145,13 @@ flag {
        purpose: PURPOSE_FEATURE
    }
}

flag {
    namespace: "haptics"
    name: "fix_vibration_thread_callback_handling"
    description: "Fix how the VibrationThread handles late callbacks from the vibrator HAL"
    bug: "395005081"
    metadata {
      purpose: PURPOSE_BUGFIX
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -124,6 +124,8 @@ abstract class AbstractVibratorStep extends Step {
            Slog.d(VibrationThread.TAG,
                    "Turning off vibrator " + getVibratorId());
        }
        // Make sure we ignore any pending callback from old vibration commands.
        conductor.nextVibratorCallbackStepId(getVibratorId());
        controller.off();
        getVibration().stats.reportVibratorOff();
        mPendingVibratorOffDeadline = 0;
+2 −1
Original line number Diff line number Diff line
@@ -73,7 +73,8 @@ final class ComposePrimitivesVibratorStep extends AbstractComposedVibratorStep {

            PrimitiveSegment[] primitivesArray =
                    primitives.toArray(new PrimitiveSegment[primitives.size()]);
            long vibratorOnResult = controller.on(primitivesArray, getVibration().id);
            int stepId = conductor.nextVibratorCallbackStepId(getVibratorId());
            long vibratorOnResult = controller.on(primitivesArray, getVibration().id, stepId);
            handleVibratorOnResult(vibratorOnResult);
            getVibration().stats.reportComposePrimitives(vibratorOnResult, primitivesArray);

+2 −1
Original line number Diff line number Diff line
@@ -72,7 +72,8 @@ final class ComposePwleV2VibratorStep extends AbstractComposedVibratorStep {
                        + controller.getVibratorInfo().getId());
            }
            PwlePoint[] pwlesArray = pwles.toArray(new PwlePoint[pwles.size()]);
            long vibratorOnResult = controller.on(pwlesArray, getVibration().id);
            int stepId = conductor.nextVibratorCallbackStepId(getVibratorId());
            long vibratorOnResult = controller.on(pwlesArray, getVibration().id, stepId);
            handleVibratorOnResult(vibratorOnResult);
            getVibration().stats.reportComposePwle(vibratorOnResult, pwlesArray);

+2 −1
Original line number Diff line number Diff line
@@ -71,7 +71,8 @@ final class ComposePwleVibratorStep extends AbstractComposedVibratorStep {
                        + controller.getVibratorInfo().getId());
            }
            RampSegment[] pwlesArray = pwles.toArray(new RampSegment[pwles.size()]);
            long vibratorOnResult = controller.on(pwlesArray, getVibration().id);
            int stepId = conductor.nextVibratorCallbackStepId(getVibratorId());
            long vibratorOnResult = controller.on(pwlesArray, getVibration().id, stepId);
            handleVibratorOnResult(vibratorOnResult);
            getVibration().stats.reportComposePwle(vibratorOnResult, pwlesArray);

Loading