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

Commit 5d6a8c6d authored by Ashwin R C's avatar Ashwin R C Committed by Bruno Martins
Browse files

KeyHandler: Use VibrationEffect

The method vibrate(long milliseconds) was deprecated in API level 26
(https://developer.android.com/reference/android/os/Vibrator?hl=en#vibrate(long))

Change-Id: Icf937393b4b1031a46e4c122ff2f71d2a5353779
parent 1522f156
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
<!--
/**
 * Copyright 2016, The CyanogenMod Project
 * Copyright 2017-2019, The LineageOS Project
 * Copyright 2017-2020, The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@
    <uses-permission android:name="android.permission.BIND_DEVICE_ADMIN" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.READ_SEARCH_INDEXABLES" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <uses-permission android:name="lineageos.permission.MANAGE_REMOTE_PREFERENCES" />

+4 −2
Original line number Diff line number Diff line
/**
 * Copyright (C) 2016 The CyanogenMod project
 *               2017 The LineageOS Project
 *               2017-2020 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@ import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.provider.Settings;
import android.util.Log;
@@ -385,7 +386,8 @@ public class KeyHandler implements DeviceKeyHandler {
            final boolean enabled = LineageSettings.System.getInt(mContext.getContentResolver(),
                    LineageSettings.System.TOUCHSCREEN_GESTURE_HAPTIC_FEEDBACK, 1) != 0;
            if (enabled) {
                mVibrator.vibrate(50);
                mVibrator.vibrate(VibrationEffect.createOneShot(50,
                        VibrationEffect.DEFAULT_AMPLITUDE));
            }
        }
    }