Skip to content

Commit a01a2a8

Browse files
author
Philip Milne
committed
Fix 6538388: Home buttons do not respect the no "vibrate on touch" option.
Change-Id: I1792caf4c0501055329611f4c5e237815463d43d
1 parent a073e57 commit a01a2a8

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

packages/SystemUI/res/values/config.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
<bool name="config_showRotationLock">true</bool>
5959

6060
<!-- Vibration duration for MultiWaveView used in SearchPanelView -->
61-
<integer translatable="false" name="config_vibration_duration">20</integer>
61+
<integer translatable="false" name="config_vibration_duration">0</integer>
62+
63+
<!-- Vibration duration for MultiWaveView used in SearchPanelView -->
64+
<integer translatable="false" name="config_search_panel_view_vibration_duration">20</integer>
6265
</resources>
6366

packages/SystemUI/src/com/android/systemui/SearchPanelView.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@
1616

1717
package com.android.systemui;
1818

19-
import android.animation.Animator;
2019
import android.animation.LayoutTransition;
21-
import android.app.ActivityManagerNative;
2220
import android.app.ActivityOptions;
2321
import android.app.SearchManager;
2422
import android.content.ActivityNotFoundException;
2523
import android.content.ComponentName;
2624
import android.content.Context;
2725
import android.content.Intent;
2826
import android.content.pm.PackageManager;
27+
import android.content.res.Resources;
28+
import android.os.Vibrator;
29+
import android.provider.Settings;
2930
import android.util.AttributeSet;
3031
import android.util.Slog;
3132
import android.view.MotionEvent;
@@ -34,7 +35,6 @@
3435
import android.view.ViewTreeObserver;
3536
import android.view.ViewTreeObserver.OnPreDrawListener;
3637
import android.widget.FrameLayout;
37-
3838
import com.android.internal.widget.multiwaveview.MultiWaveView;
3939
import com.android.internal.widget.multiwaveview.MultiWaveView.OnTriggerListener;
4040
import com.android.systemui.R;
@@ -77,7 +77,7 @@ public boolean isAssistantAvailable() {
7777
Intent intent = getAssistIntent();
7878
return intent == null ? false
7979
: mContext.getPackageManager().queryIntentActivities(intent,
80-
PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
80+
PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
8181
}
8282

8383
private Intent getAssistIntent() {
@@ -142,13 +142,14 @@ public void onTrigger(View v, final int target) {
142142
case com.android.internal.R.drawable.ic_lockscreen_search:
143143
mWaitingForLaunch = true;
144144
startAssistActivity();
145+
vibrate();
145146
postDelayed(new Runnable() {
146147
public void run() {
147148
mWaitingForLaunch = false;
148149
mBar.hideSearchPanel();
149150
}
150151
}, SEARCH_PANEL_HOLD_DURATION);
151-
break;
152+
break;
152153
}
153154
}
154155

@@ -194,10 +195,20 @@ public boolean onPreDraw() {
194195
}
195196
};
196197

198+
private void vibrate() {
199+
Context context = getContext();
200+
if (Settings.System.getInt(context.getContentResolver(),
201+
Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0) {
202+
Resources res = context.getResources();
203+
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
204+
vibrator.vibrate(res.getInteger(R.integer.config_search_panel_view_vibration_duration));
205+
}
206+
}
207+
197208
public void show(final boolean show, boolean animate) {
198209
if (!show) {
199210
final LayoutTransition transitioner = animate ? createLayoutTransitioner() : null;
200-
((ViewGroup)mSearchTargetsContainer).setLayoutTransition(transitioner);
211+
((ViewGroup) mSearchTargetsContainer).setLayoutTransition(transitioner);
201212
}
202213
mShowing = show;
203214
if (show) {
@@ -207,6 +218,7 @@ public void show(final boolean show, boolean animate) {
207218
// right before we are drawn
208219
mMultiWaveView.suspendAnimations();
209220
getViewTreeObserver().addOnPreDrawListener(mPreDrawListener);
221+
vibrate();
210222
}
211223
setFocusable(true);
212224
setFocusableInTouchMode(true);

packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ private void startApplicationDetailsActivity(String packageName) {
253253
mContext.startActivity(intent);
254254
}
255255

256-
protected View.OnLongClickListener getNotificationLongClicker() {
256+
protected View.OnLongClickListener getNotificationLongClicker() {
257257
return new View.OnLongClickListener() {
258258
@Override
259259
public boolean onLongClick(View v) {

0 commit comments

Comments
 (0)