diff options
| author | 2016-10-03 13:11:08 +0200 | |
|---|---|---|
| committer | 2016-11-10 15:09:45 -0800 | |
| commit | f9fc128d7f0efee23a7ac80fb8b808af58726233 (patch) | |
| tree | 438b5ae45ba706602177a0625e92d28866e542bf | |
| parent | a3fa81358f2134fb18ac24f97ed455b77af0ba04 (diff) | |
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
| -rw-r--r-- | packages/SystemUI/res/values/config.xml | 6 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 9eea3750a8ec..0f5d37ea3691 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -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> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 599fcba068e0..c29c0fa5b92f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -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() { |