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

Commit 5cf25319 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Update input policy to handle embedded windows

ANR - If embedded windows are slow in handling inputs the system should blame the embedded app.

PointerDownOutsideFocus - if a user taps outside the currently focused window onto an
embedded window, treat it as if the host window was tapped.

Rename blessInputSurface -> grantInputChannel and add a name to embedded windows.

Bug: 134365580
Test: b WindowlessWmTest
Test: atest CtsWindowManagerDeviceTestCases:WindowlessWmTests

Change-Id: If88970cf6ce17669b41fec995535151a492fab12
parent f8a28911
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -4415,6 +4415,10 @@ package android.view {
    method public abstract String asyncImpl() default "";
    method public abstract String asyncImpl() default "";
  }
  }


  public class SurfaceView extends android.view.View {
    method @Nullable public android.os.IBinder getInputToken();
  }

  @UiThread public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
  @UiThread public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
    method public android.view.View getTooltipView();
    method public android.view.View getTooltipView();
    method public boolean isAutofilled();
    method public boolean isAutofilled();
@@ -4462,8 +4466,9 @@ package android.view {
  }
  }


  public class WindowlessViewRoot {
  public class WindowlessViewRoot {
    ctor public WindowlessViewRoot(android.content.Context, android.view.Display, android.view.SurfaceControl);
    ctor public WindowlessViewRoot(@NonNull android.content.Context, @NonNull android.view.Display, @NonNull android.view.SurfaceControl, @Nullable android.os.IBinder);
    method public void addView(android.view.View, android.view.WindowManager.LayoutParams);
    method public void addView(android.view.View, android.view.WindowManager.LayoutParams);
    method public void dispose();
    method public void relayout(android.view.WindowManager.LayoutParams);
    method public void relayout(android.view.WindowManager.LayoutParams);
  }
  }


+2 −1
Original line number Original line Diff line number Diff line
@@ -314,5 +314,6 @@ interface IWindowSession {
    * Request the server to call setInputWindowInfo on a given Surface, and return
    * Request the server to call setInputWindowInfo on a given Surface, and return
    * an input channel where the client can receive input.
    * an input channel where the client can receive input.
    */
    */
    void blessInputSurface(int displayId, in SurfaceControl surface, out InputChannel outInputChannel);
    void grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window,
            in IBinder hostInputToken, out InputChannel outInputChannel);
}
}
+7 −1
Original line number Original line Diff line number Diff line
@@ -36,7 +36,7 @@ public final class InputApplicationHandle {
    // Dispatching timeout.
    // Dispatching timeout.
    public long dispatchingTimeoutNanos;
    public long dispatchingTimeoutNanos;


    public IBinder token;
    public final IBinder token;


    private native void nativeDispose();
    private native void nativeDispose();


@@ -44,6 +44,12 @@ public final class InputApplicationHandle {
        this.token = token;
        this.token = token;
    }
    }


    public InputApplicationHandle(InputApplicationHandle handle) {
        this.token = handle.token;
        this.dispatchingTimeoutNanos = handle.dispatchingTimeoutNanos;
        this.name = handle.name;
    }

    @Override
    @Override
    protected void finalize() throws Throwable {
    protected void finalize() throws Throwable {
        try {
        try {
+11 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package android.view;
package android.view;


import android.annotation.UnsupportedAppUsage;
import android.annotation.UnsupportedAppUsage;
import android.os.IBinder;
import android.os.Looper;
import android.os.Looper;
import android.os.MessageQueue;
import android.os.MessageQueue;
import android.util.Log;
import android.util.Log;
@@ -184,6 +185,16 @@ public abstract class InputEventReceiver {
        return false;
        return false;
    }
    }


    /**
     * @return Returns a token to identify the input channel.
     */
    public IBinder getToken() {
        if (mInputChannel == null) {
            return null;
        }
        return mInputChannel.getToken();
    }

    // Called from native code.
    // Called from native code.
    @SuppressWarnings("unused")
    @SuppressWarnings("unused")
    @UnsupportedAppUsage
    @UnsupportedAppUsage
+16 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,8 @@ import static android.view.WindowManagerPolicyConstants.APPLICATION_MEDIA_OVERLA
import static android.view.WindowManagerPolicyConstants.APPLICATION_MEDIA_SUBLAYER;
import static android.view.WindowManagerPolicyConstants.APPLICATION_MEDIA_SUBLAYER;
import static android.view.WindowManagerPolicyConstants.APPLICATION_PANEL_SUBLAYER;
import static android.view.WindowManagerPolicyConstants.APPLICATION_PANEL_SUBLAYER;


import android.annotation.Nullable;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Context;
import android.content.res.CompatibilityInfo.Translator;
import android.content.res.CompatibilityInfo.Translator;
@@ -34,6 +36,7 @@ import android.graphics.Region;
import android.graphics.RenderNode;
import android.graphics.RenderNode;
import android.os.Build;
import android.os.Build;
import android.os.Handler;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Looper;
import android.os.SystemClock;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.AttributeSet;
@@ -1443,6 +1446,19 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
        return mSurfaceControl;
        return mSurfaceControl;
    }
    }


    /**
     * @return The token used to identify the windows input channel.
     * @hide
     */
    @TestApi
    public @Nullable IBinder getInputToken() {
        final ViewRootImpl viewRoot = getViewRootImpl();
        if (viewRoot == null) {
            return null;
        }
        return viewRoot.getInputToken();
    }

    /**
    /**
     * Set window stopped to false and update surface visibility when ViewRootImpl surface is
     * Set window stopped to false and update surface visibility when ViewRootImpl surface is
     * created.
     * created.
Loading