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

Commit 21f2c00d authored by Ilya Matyukhin's avatar Ilya Matyukhin Committed by android-build-merger
Browse files

Merge "Updated haptic effect for success" into pi-dev am: d6dbebf7

am: f015c6d0

Change-Id: I9a33d58b2b9d9af17e9aa3082cf7ab63b7e5d0d5
parents 261d67e3 f015c6d0
Loading
Loading
Loading
Loading
+1 −22
Original line number Original line Diff line number Diff line
@@ -80,7 +80,7 @@ public abstract class ClientMonitor implements IBinder.DeathRecipient {
        mGroupId = groupId;
        mGroupId = groupId;
        mIsRestricted = restricted;
        mIsRestricted = restricted;
        mOwner = owner;
        mOwner = owner;
        mSuccessVibrationEffect = getSuccessVibrationEffect(context);
        mSuccessVibrationEffect = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
        mErrorVibrationEffect = VibrationEffect.get(VibrationEffect.EFFECT_DOUBLE_CLICK);
        mErrorVibrationEffect = VibrationEffect.get(VibrationEffect.EFFECT_DOUBLE_CLICK);
        try {
        try {
            if (token != null) {
            if (token != null) {
@@ -239,25 +239,4 @@ public abstract class ClientMonitor implements IBinder.DeathRecipient {
            vibrator.vibrate(mErrorVibrationEffect, FINGERPRINT_SONFICATION_ATTRIBUTES);
            vibrator.vibrate(mErrorVibrationEffect, FINGERPRINT_SONFICATION_ATTRIBUTES);
        }
        }
    }
    }

    private static VibrationEffect getSuccessVibrationEffect(Context ctx) {
        int[] arr = ctx.getResources().getIntArray(
                com.android.internal.R.array.config_longPressVibePattern);
        final long[] vibePattern;
        if (arr == null || arr.length == 0) {
            vibePattern = DEFAULT_SUCCESS_VIBRATION_PATTERN;
        } else {
            vibePattern = new long[arr.length];
            for (int i = 0; i < arr.length; i++) {
                vibePattern[i] = arr[i];
            }
        }
        if (vibePattern.length == 1) {
            return VibrationEffect.createOneShot(
                    vibePattern[0], VibrationEffect.DEFAULT_AMPLITUDE);
        } else {
            return VibrationEffect.createWaveform(vibePattern, -1);
        }
    }

}
}