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

Commit 53031674 authored by Simon Bowden's avatar Simon Bowden Committed by Android (Google) Code Review
Browse files

Merge "Make the binder call in performHapticFeedback asynchronous."

parents ecbb2370 9a3d604e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -152,6 +152,12 @@ interface IWindowSession {
    @UnsupportedAppUsage
    boolean performHapticFeedback(int effectId, boolean always);

    /**
     * Called by attached views to perform predefined haptic feedback without requiring VIBRATE
     * permission.
     */
    oneway void performHapticFeedbackAsync(int effectId, boolean always);

    /**
     * Initiate the drag operation itself
     *
+15 −1
Original line number Diff line number Diff line
@@ -279,6 +279,14 @@ public final class ViewRootImpl implements ViewParent,
     */
    private static final boolean ENABLE_INPUT_LATENCY_TRACKING = true;

    /**
     * Controls whether to use the new oneway performHapticFeedback call. This returns
     * true in a few more conditions, but doesn't affect which haptics happen. Notably, it
     * makes the call to performHapticFeedback non-blocking, which reduces potential UI jank.
     * This is intended as a temporary flag, ultimately becoming permanently 'true'.
     */
    private static final boolean USE_ASYNC_PERFORM_HAPTIC_FEEDBACK = true;

    /**
     * Whether the caption is drawn by the shell.
     * @hide
@@ -8583,7 +8591,13 @@ public final class ViewRootImpl implements ViewParent,
        }

        try {
            if (USE_ASYNC_PERFORM_HAPTIC_FEEDBACK) {
                mWindowSession.performHapticFeedbackAsync(effectId, always);
                return true;
            } else {
                // Original blocking binder call path.
                return mWindowSession.performHapticFeedback(effectId, always);
            }
        } catch (RemoteException e) {
            return false;
        }
+5 −0
Original line number Diff line number Diff line
@@ -465,6 +465,11 @@ public class WindowlessWindowManager implements IWindowSession {
        return false;
    }

    @Override
    public void performHapticFeedbackAsync(int effectId, boolean always) {
        performHapticFeedback(effectId, always);
    }

    @Override
    public android.os.IBinder performDrag(android.view.IWindow window, int flags,
            android.view.SurfaceControl surface, int touchSource, float touchX, float touchY,
+5 −0
Original line number Diff line number Diff line
@@ -310,6 +310,11 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
        }
    }

    @Override
    public void performHapticFeedbackAsync(int effectId, boolean always) {
        performHapticFeedback(effectId, always);
    }

    /* Drag/drop */

    @Override