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

Commit c4544d3c authored by Danesh Mondegarian's avatar Danesh Mondegarian
Browse files

This fixes the lockscreen haptic issue.

Now reads all values rather than first one.

Change-Id: I43649ba064adb63e8461ac56ff70295f91280dff
parent 0a3f4ff8
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -931,7 +931,8 @@ public class RotarySelector extends View {
            mVibrator = (android.os.Vibrator)
                    getContext().getSystemService(Context.VIBRATOR_SERVICE);
        }
        mVibrator.vibrate(Integer.parseInt((Settings.System.getString(getContext().getContentResolver(),Settings.System.HAPTIC_DOWN_ARRAY)).split( ",\\s*" )[0]));
        long[] hapFeedback = stringToLongArray(Settings.System.getString(getContext().getContentResolver(),Settings.System.HAPTIC_DOWN_ARRAY));
        mVibrator.vibrate(hapFeedback, -1);
    }

    /**
@@ -1081,6 +1082,22 @@ public class RotarySelector extends View {
        mTime12_24=time12_24;
    }

    private long[] stringToLongArray(String inpString) {
        if (inpString == null) {
            long[] returnLong = new long[1];
            returnLong[0] = 0;
            return returnLong;
        }
        String[] splitStr = inpString.split(",");
        int los = splitStr.length;
        long[] returnLong = new long[los];
        int i;
        for (i = 0; i < los; i++) {
            returnLong[i] = Long.parseLong(splitStr[i].trim());
        }
        return returnLong;
    }

    // Debugging / testing code

    private void log(String msg) {
+18 −1
Original line number Diff line number Diff line
@@ -809,7 +809,8 @@ public class SlidingTab extends ViewGroup {
            mVibrator = (android.os.Vibrator)
                    getContext().getSystemService(Context.VIBRATOR_SERVICE);
        }
        mVibrator.vibrate(Integer.parseInt((Settings.System.getString(getContext().getContentResolver(),Settings.System.HAPTIC_DOWN_ARRAY)).split( ",\\s*" )[0]));
        long[] hapFeedback = stringToLongArray(Settings.System.getString(getContext().getContentResolver(),Settings.System.HAPTIC_DOWN_ARRAY));
        mVibrator.vibrate(hapFeedback, -1);
    }

    /**
@@ -845,6 +846,22 @@ public class SlidingTab extends ViewGroup {
        }
    }

     private long[] stringToLongArray(String inpString) {
        if (inpString == null) {
            long[] returnLong = new long[1];
            returnLong[0] = 0;
            return returnLong;
        }
        String[] splitStr = inpString.split(",");
        int los = splitStr.length;
        long[] returnLong = new long[los];
        int i;
        for (i = 0; i < los; i++) {
            returnLong[i] = Long.parseLong(splitStr[i].trim());
        }
        return returnLong;
    }

    private void log(String msg) {
        Log.d(LOG_TAG, msg);
    }