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

Commit c73d735e authored by StevenHarperUK's avatar StevenHarperUK Committed by Gerrit Code Review
Browse files

Lockscreen Vibrate option 1 of 2

The new System setting Settings.System.LOCKSCREEN_VIBRATE_ENABLED
which defaults to 1, will effect the lockscreen on touch event
(when touching the unlock icon - or sliding it).

The GlowPadView (Slider) now has no Vibrate when the user selects the behaviour
in the Lockscreen Settings (see 2 of 2 patch).

No Restart is needed to make the change.

Change-Id: I59c52c6ea2f54427bbc883cd829952cefa58143c
parent 7a995c3f
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -2216,6 +2216,12 @@ public final class Settings {
         */
         */
        public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";
        public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";


        /**
         * Whether the lockscreen vibrate should be enabled.
         * @hide
         */
        public static final String LOCKSCREEN_VIBRATE_ENABLED = "lockscreen.vibrate_enabled";

        /**
        /**
         * Stores values for custom lockscreen targets
         * Stores values for custom lockscreen targets
         * @hide
         * @hide
@@ -2830,6 +2836,7 @@ public final class Settings {
            LOCKSCREEN_ALWAYS_SHOW_BATTERY,
            LOCKSCREEN_ALWAYS_SHOW_BATTERY,
            SYSTEM_PROFILES_ENABLED,
            SYSTEM_PROFILES_ENABLED,
            POWER_MENU_SCREENSHOT_ENABLED,
            POWER_MENU_SCREENSHOT_ENABLED,
            LOCKSCREEN_VIBRATE_ENABLED,
        };
        };


        // Settings moved to Settings.Secure
        // Settings moved to Settings.Secure
+5 −1
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -32,6 +33,7 @@ import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Vibrator;
import android.os.Vibrator;
import android.provider.Settings;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Log;
@@ -310,7 +312,9 @@ public class GlowPadView extends View {
        mGravity = a.getInt(android.R.styleable.LinearLayout_gravity, Gravity.TOP);
        mGravity = a.getInt(android.R.styleable.LinearLayout_gravity, Gravity.TOP);
        a.recycle();
        a.recycle();


        setVibrateEnabled(mVibrationDuration > 0);
        final ContentResolver resolver = context.getContentResolver();
        boolean vibrateEnabled = Settings.System.getInt(resolver,Settings.System.LOCKSCREEN_VIBRATE_ENABLED, 1) == 1;
        setVibrateEnabled(vibrateEnabled ? mVibrationDuration > 0 : false);


        assignDefaultsIfNeeded();
        assignDefaultsIfNeeded();