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

Commit c0263d94 authored by Taran Singh's avatar Taran Singh Committed by Android (Google) Code Review
Browse files

Merge "Add showInsets method in IWindow"

parents 0cb92ada 0bedd949
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -73,6 +73,14 @@ oneway interface IWindow {
     */
    void insetsControlChanged(in InsetsState insetsState, in InsetsSourceControl[] activeControls);

    /**
     * Called when a set of insets source window should be shown by policy.
     *
     * @param types internal inset types (WindowInsets.Type.InsetType) to show
     * @param fromIme true if this request originated from IME (InputMethodService).
     */
    void showInsets(int types, boolean fromIme);

    void moved(int newX, int newY);
    void dispatchAppVisibility(boolean visible);
    void dispatchGetNewSurface();
+1 −1
Original line number Diff line number Diff line
@@ -224,7 +224,7 @@ public class InsetsController implements WindowInsetsController {
        show(types, false /* fromIme */);
    }

    private void show(@InsetType int types, boolean fromIme) {
    void show(@InsetType int types, boolean fromIme) {
        // TODO: Support a ResultReceiver for IME.
        // TODO(b/123718661): Make show() work for multi-session IME.
        int typesReady = 0;
+21 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ import android.view.SurfaceControl.Transaction;
import android.view.View.AttachInfo;
import android.view.View.FocusDirection;
import android.view.View.MeasureSpec;
import android.view.WindowInsets.Type.InsetType;
import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
@@ -4528,6 +4529,8 @@ public final class ViewRootImpl implements ViewParent,
    private static final int MSG_INSETS_CONTROL_CHANGED = 31;
    private static final int MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED = 32;
    private static final int MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED = 33;
    private static final int MSG_SHOW_INSETS = 34;


    final class ViewRootHandler extends Handler {
        @Override
@@ -4591,6 +4594,8 @@ public final class ViewRootImpl implements ViewParent,
                    return "MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED";
                case MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED:
                    return "MSG_LOCATION_IN_PARENT_DISPLAY_CHANGED";
                case MSG_SHOW_INSETS:
                    return "MSG_SHOW_INSETS";
            }
            return super.getMessageName(message);
        }
@@ -4705,6 +4710,10 @@ public final class ViewRootImpl implements ViewParent,
                    mInsetsController.onStateChanged((InsetsState) args.arg1);
                    break;
                }
                case MSG_SHOW_INSETS: {
                    mInsetsController.show(msg.arg1, msg.arg2 == 1);
                    break;
                }
                case MSG_WINDOW_MOVED:
                    if (mAdded) {
                        final int w = mWinFrame.width();
@@ -7484,6 +7493,10 @@ public final class ViewRootImpl implements ViewParent,
        mHandler.obtainMessage(MSG_INSETS_CONTROL_CHANGED, args).sendToTarget();
    }

    private void showInsets(@InsetType int types, boolean fromIme) {
        mHandler.obtainMessage(MSG_SHOW_INSETS, types, fromIme ? 1 : 0).sendToTarget();
    }

    public void dispatchMoved(int newX, int newY) {
        if (DEBUG_LAYOUT) Log.v(mTag, "Window moved " + this + ": newX=" + newX + " newY=" + newY);
        if (mTranslator != null) {
@@ -8598,6 +8611,14 @@ public final class ViewRootImpl implements ViewParent,
            }
        }

        @Override
        public void showInsets(@InsetType int types, boolean fromIme) {
            final ViewRootImpl viewAncestor = mViewAncestor.get();
            if (viewAncestor != null) {
                viewAncestor.showInsets(types, fromIme);
            }
        }

        @Override
        public void moved(int newX, int newY) {
            final ViewRootImpl viewAncestor = mViewAncestor.get();
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.view.IWindowSession;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
import android.view.PointerIcon;
import android.view.WindowInsets.Type.InsetType;

import com.android.internal.os.IResultReceiver;

@@ -74,6 +75,10 @@ public class BaseIWindow extends IWindow.Stub {
            InsetsSourceControl[] activeControls) throws RemoteException {
    }

    @Override
    public void showInsets(@InsetType int types, boolean fromIme)  throws RemoteException {
    }

    @Override
    public void moved(int newX, int newY) {
    }
+12 −0
Original line number Diff line number Diff line
@@ -16,9 +16,21 @@

package com.android.server.wm;

import android.inputmethodservice.InputMethodService;
import android.view.WindowInsets.Type.InsetType;

/**
 * Generalization of an object that can control insets state.
 */
interface InsetsControlTarget {
    void notifyInsetsControlChanged();

    /**
     * Instructs the control target to show inset sources.
     *
     * @param types to specify which types of insets source window should be shown.
     * @param fromIme {@code true} if IME show request originated from {@link InputMethodService}.
     */
    default void showInsets(@InsetType int types, boolean fromIme) {
    }
}
Loading