Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +20 −3 Original line number Diff line number Diff line Loading @@ -25,12 +25,14 @@ import android.os.SystemClock; import android.os.ServiceManager; import android.util.AttributeSet; import android.util.Slog; import android.view.accessibility.AccessibilityEvent; import android.view.HapticFeedbackConstants; import android.view.IWindowManager; import android.view.InputDevice; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.SoundEffectConstants; import android.view.ViewConfiguration; import android.widget.ImageView; import android.widget.RemoteViews.RemoteView; Loading @@ -45,6 +47,8 @@ public class KeyButtonView extends ImageView { boolean mSending; int mCode; int mRepeat; int mTouchSlop; Runnable mCheckLongPress = new Runnable() { public void run() { if (isPressed()) { Loading @@ -53,6 +57,9 @@ public class KeyButtonView extends ImageView { KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY | KeyEvent.FLAG_LONG_PRESS); sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); //playSoundEffect(SoundEffectConstants.CLICK); } } }; Loading @@ -78,6 +85,7 @@ public class KeyButtonView extends ImageView { ServiceManager.getService(Context.WINDOW_SERVICE)); setClickable(true); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); } public boolean onTouchEvent(MotionEvent ev) { Loading @@ -100,7 +108,10 @@ public class KeyButtonView extends ImageView { if (mSending) { x = (int)ev.getX(); y = (int)ev.getY(); setPressed(x >= 0 && x < getWidth() && y >= 0 && y < getHeight()); setPressed(x >= -mTouchSlop && x < getWidth() + mTouchSlop && y >= -mTouchSlop && y < getHeight() + mTouchSlop); } break; case MotionEvent.ACTION_CANCEL: Loading @@ -114,12 +125,18 @@ public class KeyButtonView extends ImageView { } break; case MotionEvent.ACTION_UP: final boolean doIt = isPressed(); setPressed(false); if (mSending) { mSending = false; removeCallbacks(mCheckLongPress); if (doIt) { sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY); removeCallbacks(mCheckLongPress); sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); playSoundEffect(SoundEffectConstants.CLICK); } } break; } Loading packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +21 −11 Original line number Diff line number Diff line Loading @@ -42,11 +42,13 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.text.TextUtils; import android.util.Slog; import android.view.accessibility.AccessibilityEvent; import android.view.Gravity; import android.view.IWindowManager; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.SoundEffectConstants; import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; Loading Loading @@ -1181,6 +1183,8 @@ public class TabletStatusBar extends StatusBar implements // dragging off the bottom doesn't count && (int)event.getY() < v.getBottom()) { animateExpand(); v.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); v.playSoundEffect(SoundEffectConstants.CLICK); } mVT.recycle(); Loading Loading @@ -1264,6 +1268,7 @@ public class TabletStatusBar extends StatusBar implements case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PEEK); if (!peeking) { if (action == MotionEvent.ACTION_UP // was this a sloppy tap? && Math.abs(event.getX() - mInitialTouchX) < mTouchSlop Loading @@ -1274,8 +1279,13 @@ public class TabletStatusBar extends StatusBar implements peekMsg.arg1 = mPeekIndex; mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PEEK); mHandler.sendMessage(peekMsg); v.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); v.playSoundEffect(SoundEffectConstants.CLICK); peeking = true; // not technically true yet, but the next line will run } } if (peeking) { mHandler.sendEmptyMessageDelayed(MSG_CLOSE_NOTIFICATION_PEEK, Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +20 −3 Original line number Diff line number Diff line Loading @@ -25,12 +25,14 @@ import android.os.SystemClock; import android.os.ServiceManager; import android.util.AttributeSet; import android.util.Slog; import android.view.accessibility.AccessibilityEvent; import android.view.HapticFeedbackConstants; import android.view.IWindowManager; import android.view.InputDevice; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.SoundEffectConstants; import android.view.ViewConfiguration; import android.widget.ImageView; import android.widget.RemoteViews.RemoteView; Loading @@ -45,6 +47,8 @@ public class KeyButtonView extends ImageView { boolean mSending; int mCode; int mRepeat; int mTouchSlop; Runnable mCheckLongPress = new Runnable() { public void run() { if (isPressed()) { Loading @@ -53,6 +57,9 @@ public class KeyButtonView extends ImageView { KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY | KeyEvent.FLAG_LONG_PRESS); sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); //playSoundEffect(SoundEffectConstants.CLICK); } } }; Loading @@ -78,6 +85,7 @@ public class KeyButtonView extends ImageView { ServiceManager.getService(Context.WINDOW_SERVICE)); setClickable(true); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); } public boolean onTouchEvent(MotionEvent ev) { Loading @@ -100,7 +108,10 @@ public class KeyButtonView extends ImageView { if (mSending) { x = (int)ev.getX(); y = (int)ev.getY(); setPressed(x >= 0 && x < getWidth() && y >= 0 && y < getHeight()); setPressed(x >= -mTouchSlop && x < getWidth() + mTouchSlop && y >= -mTouchSlop && y < getHeight() + mTouchSlop); } break; case MotionEvent.ACTION_CANCEL: Loading @@ -114,12 +125,18 @@ public class KeyButtonView extends ImageView { } break; case MotionEvent.ACTION_UP: final boolean doIt = isPressed(); setPressed(false); if (mSending) { mSending = false; removeCallbacks(mCheckLongPress); if (doIt) { sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY); removeCallbacks(mCheckLongPress); sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); playSoundEffect(SoundEffectConstants.CLICK); } } break; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +21 −11 Original line number Diff line number Diff line Loading @@ -42,11 +42,13 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.text.TextUtils; import android.util.Slog; import android.view.accessibility.AccessibilityEvent; import android.view.Gravity; import android.view.IWindowManager; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.SoundEffectConstants; import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; Loading Loading @@ -1181,6 +1183,8 @@ public class TabletStatusBar extends StatusBar implements // dragging off the bottom doesn't count && (int)event.getY() < v.getBottom()) { animateExpand(); v.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); v.playSoundEffect(SoundEffectConstants.CLICK); } mVT.recycle(); Loading Loading @@ -1264,6 +1268,7 @@ public class TabletStatusBar extends StatusBar implements case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PEEK); if (!peeking) { if (action == MotionEvent.ACTION_UP // was this a sloppy tap? && Math.abs(event.getX() - mInitialTouchX) < mTouchSlop Loading @@ -1274,8 +1279,13 @@ public class TabletStatusBar extends StatusBar implements peekMsg.arg1 = mPeekIndex; mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PEEK); mHandler.sendMessage(peekMsg); v.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); v.playSoundEffect(SoundEffectConstants.CLICK); peeking = true; // not technically true yet, but the next line will run } } if (peeking) { mHandler.sendEmptyMessageDelayed(MSG_CLOSE_NOTIFICATION_PEEK, Loading