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

Commit a8782e7b authored by Ahmad Khalil's avatar Ahmad Khalil
Browse files

Add CallerInfo to Vibration class.

Bug: 265265232
Test: com.android.server.vibrator.VibratorSettingsTest
Change-Id: I077ebf18e494ab0b913ebac64bab36bba4b7baca
parent b7ce6be9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -104,6 +104,10 @@ public class ExternalVibration implements Parcelable {
        return mAttrs;
    }

    public IBinder getToken() {
        return mToken;
    }

    public VibrationAttributes getVibrationAttributes() {
        return new VibrationAttributes.Builder(mAttrs).build();
    }
+3 −3
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ abstract class AbstractVibratorStep extends Step {
                    "Turning off vibrator " + getVibratorId());
        }
        controller.off();
        getVibration().stats().reportVibratorOff();
        getVibration().stats.reportVibratorOff();
        mPendingVibratorOffDeadline = 0;
    }

@@ -136,7 +136,7 @@ abstract class AbstractVibratorStep extends Step {
                    "Amplitude changed on vibrator " + getVibratorId() + " to " + amplitude);
        }
        controller.setAmplitude(amplitude);
        getVibration().stats().reportSetAmplitude();
        getVibration().stats.reportSetAmplitude();
    }

    /**
@@ -170,7 +170,7 @@ abstract class AbstractVibratorStep extends Step {
            // Count the loops that were played.
            int loopSize = effectSize - repeatIndex;
            int loopSegmentsPlayed = nextSegmentIndex - repeatIndex;
            getVibration().stats().reportRepetition(loopSegmentsPlayed / loopSize);
            getVibration().stats.reportRepetition(loopSegmentsPlayed / loopSize);
            nextSegmentIndex = repeatIndex + ((nextSegmentIndex - effectSize) % loopSize);
        }
        Step nextStep = conductor.nextVibrateStep(nextStartTime, controller, effect,
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ final class ComposePrimitivesVibratorStep extends AbstractVibratorStep {
                    primitives.toArray(new PrimitiveSegment[primitives.size()]);
            long vibratorOnResult = controller.on(primitivesArray, getVibration().id);
            handleVibratorOnResult(vibratorOnResult);
            getVibration().stats().reportComposePrimitives(vibratorOnResult, primitivesArray);
            getVibration().stats.reportComposePrimitives(vibratorOnResult, primitivesArray);

            // The next start and off times will be calculated from mVibratorOnResult.
            return nextSteps(/* segmentsPlayed= */ primitives.size());
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ final class ComposePwleVibratorStep extends AbstractVibratorStep {
            RampSegment[] pwlesArray = pwles.toArray(new RampSegment[pwles.size()]);
            long vibratorOnResult = controller.on(pwlesArray, getVibration().id);
            handleVibratorOnResult(vibratorOnResult);
            getVibration().stats().reportComposePwle(vibratorOnResult, pwlesArray);
            getVibration().stats.reportComposePwle(vibratorOnResult, pwlesArray);

            // The next start and off times will be calculated from mVibratorOnResult.
            return nextSteps(/* segmentsPlayed= */ pwles.size());
+4 −2
Original line number Diff line number Diff line
@@ -51,7 +51,8 @@ final class FinishSequentialEffectStep extends Step {
                Slog.d(VibrationThread.TAG,
                        "FinishSequentialEffectStep for effect #" + startedStep.currentIndex);
            }
            conductor.vibratorManagerHooks.noteVibratorOff(conductor.getVibration().uid);
            conductor.vibratorManagerHooks.noteVibratorOff(
                    conductor.getVibration().callerInfo.uid);
            Step nextStep = startedStep.nextStep();
            return nextStep == null ? VibrationStepConductor.EMPTY_STEP_LIST
                    : Arrays.asList(nextStep);
@@ -68,6 +69,7 @@ final class FinishSequentialEffectStep extends Step {

    @Override
    public void cancelImmediately() {
        conductor.vibratorManagerHooks.noteVibratorOff(conductor.getVibration().uid);
        conductor.vibratorManagerHooks.noteVibratorOff(
                conductor.getVibration().callerInfo.uid);
    }
}
Loading