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

Commit f9fc128d authored by Oleksiy Avramchenko's avatar Oleksiy Avramchenko Committed by Selim Cinek
Browse files

Customize camera gesture vibrator pattern

Value for camera gesture vibrator pattern changes between versions, e.g.
it was changed from 1000 to 750 in 7.0, which seems arbitrary and OEMs do
not stick with this value, but change it according to their requirements.

This change allows the value to be customized using overlays.

Bug: 32789246
Change-Id: I19e59d1fa191657a8575c486008db3991b347fc5
parent a3fa8135
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -48,6 +48,12 @@
    <!-- Whether or not we show the number in the bar. -->
    <bool name="config_statusBarShowNumber">false</bool>

    <!-- Vibrator pattern for camera gesture launch. -->
    <integer-array translatable="false" name="config_cameraLaunchGestureVibePattern">
        <item>0</item>
        <item>400</item>
    </integer-array>

    <!-- How many icons may be shown at once in the system bar. Includes any
         slots that may be reused for things like IME control. -->
    <integer name="config_maxNotificationIcons">5</integer>
+8 −1
Original line number Diff line number Diff line
@@ -561,6 +561,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    private int mLastCameraLaunchSource;
    private PowerManager.WakeLock mGestureWakeLock;
    private Vibrator mVibrator;
    private long[] mCameraLaunchGestureVibePattern;

    // Fingerprint (as computed by getLoggingFingerprint() of the last logged state.
    private int mLastLoggedStateFingerprint;
@@ -996,6 +997,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mGestureWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
                "GestureWakeLock");
        mVibrator = mContext.getSystemService(Vibrator.class);
        int[] pattern = mContext.getResources().getIntArray(
                R.array.config_cameraLaunchGestureVibePattern);
        mCameraLaunchGestureVibePattern = new long[pattern.length];
        for (int i = 0; i < pattern.length; i++) {
            mCameraLaunchGestureVibePattern[i] = pattern[i];
        }

        // receive broadcasts
        IntentFilter filter = new IntentFilter();
@@ -4876,7 +4883,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,

    private void vibrateForCameraGesture() {
        // Make sure to pass -1 for repeat so VibratorService doesn't stop us when going to sleep.
        mVibrator.vibrate(new long[]{0, 400}, -1 /* repeat */);
        mVibrator.vibrate(mCameraLaunchGestureVibePattern, -1 /* repeat */);
    }

    public void onScreenTurnedOn() {