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

Commit 1487466d authored by Adam Powell's avatar Adam Powell
Browse files

Add View#cancelPendingInputEvents API

This API allows an application to cancel deferred high-level input
events already in flight. It forms one tool of several to help apps
debounce input events and prevent things like multiple startActivity
calls, FragmentTransactions, etc. from executing when only one was
desired since it's otherwise not desirable for things like click
events to fire synchronously.

Change-Id: I60b12cd5350898065f0019d616e24d779eb8cff9
parent 7f71206d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -27431,6 +27431,7 @@ package android.view {
    method public boolean canScrollHorizontally(int);
    method public boolean canScrollVertically(int);
    method public void cancelLongPress();
    method public final void cancelPendingInputEvents();
    method public boolean checkInputConnectionProxy(android.view.View);
    method public void clearAnimation();
    method public void clearFocus();
@@ -27658,6 +27659,7 @@ package android.view {
    method protected void onAnimationEnd();
    method protected void onAnimationStart();
    method protected void onAttachedToWindow();
    method public void onCancelPendingInputEvents();
    method public boolean onCheckIsTextEditor();
    method protected void onConfigurationChanged(android.content.res.Configuration);
    method protected void onCreateContextMenu(android.view.ContextMenu);
+7 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.app;

import android.util.ArrayMap;
import android.util.SuperNotCalledException;
import com.android.internal.app.ActionBarImpl;
import com.android.internal.policy.PolicyManager;

@@ -3436,6 +3437,12 @@ public class Activity extends ContextThemeWrapper
                // activity is finished, no matter what happens to it.
                mStartedActivity = true;
            }

            final View decor = mWindow != null ? mWindow.peekDecorView() : null;
            if (decor != null) {
                decor.cancelPendingInputEvents();
            }
            // TODO Consider clearing/flushing other event sources and events for child windows.
        } else {
            if (options != null) {
                mParent.startActivityFromChild(this, intent, requestCode, options);
+1 −6
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ import android.util.Log;
import android.util.LogPrinter;
import android.util.PrintWriterPrinter;
import android.util.Slog;
import android.util.SuperNotCalledException;
import android.view.Display;
import android.view.HardwareRenderer;
import android.view.View;
@@ -116,12 +117,6 @@ import libcore.io.IoUtils;

import dalvik.system.CloseGuard;

final class SuperNotCalledException extends AndroidRuntimeException {
    public SuperNotCalledException(String msg) {
        super(msg);
    }
}

final class RemoteServiceException extends AndroidRuntimeException {
    public RemoteServiceException(String msg) {
        super(msg);
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.util.AttributeSet;
import android.util.DebugUtils;
import android.util.Log;
import android.util.SparseArray;
import android.util.SuperNotCalledException;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.util.DebugUtils;
import android.util.Log;
import android.util.LogWriter;
import android.util.SparseArray;
import android.util.SuperNotCalledException;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
Loading