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

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

Merge "Respect empty vibration effect configs in PhoneWindowManager and...

Merge "Respect empty vibration effect configs in PhoneWindowManager and VibratorService" into oc-dev
parents 5176a4cd 017939e4
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -222,7 +222,9 @@ public class VibratorService extends IVibratorService.Stub
        long[] clickEffectTimings = getLongIntArray(context.getResources(),
                com.android.internal.R.array.config_virtualKeyVibePattern);
        VibrationEffect clickEffect;
        if (clickEffectTimings.length == 1) {
        if (clickEffectTimings.length == 0) {
            clickEffect = null;
        } else if (clickEffectTimings.length == 1) {
            clickEffect = VibrationEffect.createOneShot(
                    clickEffectTimings[0], VibrationEffect.DEFAULT_AMPLITUDE);
        } else {
@@ -232,7 +234,6 @@ public class VibratorService extends IVibratorService.Stub
                new long[] {0, 30, 100, 30} /*timings*/, -1);

        mFallbackEffects = new VibrationEffect[] { clickEffect, doubleClickEffect };

    }

    public void systemReady() {
@@ -701,7 +702,7 @@ public class VibratorService extends IVibratorService.Stub
                }
            }
            final int id = prebaked.getId();
            if (id < 0 || id >= mFallbackEffects.length) {
            if (id < 0 || id >= mFallbackEffects.length || mFallbackEffects[id] == null) {
                Slog.w(TAG, "Failed to play prebaked effect, no fallback");
                return 0;
            }
+4 −1
Original line number Diff line number Diff line
@@ -7691,7 +7691,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            default:
                return null;
        }
        if (pattern.length == 1) {
        if (pattern.length == 0) {
            // No vibration
            return null;
        } else if (pattern.length == 1) {
            // One-shot vibration
            return VibrationEffect.createOneShot(pattern[0], VibrationEffect.DEFAULT_AMPLITUDE);
        } else {