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

Commit 026914dc authored by Daisuke Miyakawa's avatar Daisuke Miyakawa Committed by Android (Google) Code Review
Browse files

Merge "Call stopTone() when 0 is long-pressed"

parents c2bda56d a521f477
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -802,8 +802,11 @@ public class DialpadFragment extends Fragment
            view.jumpDrawablesToCurrentState();
            mDialpadPressCount--;
            if (mDialpadPressCount < 0) {
                // May happen when the user action is detected as horizontal swipe, at which only
                // e.g.
                // - when the user action is detected as horizontal swipe, at which only
                //   "up" event is thrown.
                // - when the user long-press '0' button, at which dialpad will decrease this count
                //   while it still gets press-up event here.
                if (DEBUG) Log.d(TAG, "mKeyPressCount become negative.");
                stopTone();
                mDialpadPressCount = 0;
@@ -898,6 +901,14 @@ public class DialpadFragment extends Fragment
                // Remove tentative input ('0') done by onTouch().
                removePreviousDigitIfPossible();
                keyPressed(KeyEvent.KEYCODE_PLUS);

                // Stop tone immediately and decrease the press count, so that possible subsequent
                // dial button presses won't honor the 0 click any more.
                // Note: this *will* make mDialpadPressCount negative when the 0 key is released,
                // which should be handled appropriately.
                stopTone();
                if (mDialpadPressCount > 0) mDialpadPressCount--;

                return true;
            }
            case R.id.digits: {