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

Commit ebdc01a8 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Automerger Merge Worker
Browse files

Merge "Revert "Revert "Remove IME surface when occured in multi-window mode"""...

Merge "Revert "Revert "Remove IME surface when occured in multi-window mode""" into rvc-dev am: 8ec4d3a3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11862408

Change-Id: I4c25f9752a8c2584754cc83579a7d8975da772e4
parents f357ca63 8ec4d3a3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -71,4 +71,6 @@ interface IInputMethodManager {

    void reportActivityView(in IInputMethodClient parentClient, int childDisplayId,
            in float[] matrixValues);

    void removeImeSurface();
}
+21 −3
Original line number Diff line number Diff line
@@ -19,11 +19,13 @@ package com.android.systemui.wm;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Handler;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Slog;
import android.util.SparseArray;
import android.view.IDisplayWindowInsetsController;
@@ -36,6 +38,7 @@ import android.view.WindowInsets;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;

import com.android.internal.view.IInputMethodManager;
import com.android.systemui.TransactionPool;
import com.android.systemui.dagger.qualifiers.Main;

@@ -352,6 +355,16 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                    dispatchEndPositioning(mDisplayId, mCancelled, t);
                    if (mAnimationDirection == DIRECTION_HIDE && !mCancelled) {
                        t.hide(mImeSourceControl.getLeash());
                        final IInputMethodManager imms = getImms();
                        if (imms != null) {
                            try {
                                // Remove the IME surface to make the insets invisible for
                                // non-client controlled insets.
                                imms.removeImeSurface();
                            } catch (RemoteException e) {
                                Slog.e(TAG, "Failed to remove IME surface.", e);
                            }
                        }
                    }
                    t.apply();
                    mTransactionPool.release(t);
@@ -406,4 +419,9 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
        default void onImeEndPositioning(int displayId, boolean cancel,
                SurfaceControl.Transaction t) {}
    }

    public IInputMethodManager getImms() {
        return IInputMethodManager.Stub.asInterface(
                ServiceManager.getService(Context.INPUT_METHOD_SERVICE));
    }
}
+16 −0
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    static final int MSG_HIDE_CURRENT_INPUT_METHOD = 1035;
    static final int MSG_INITIALIZE_IME = 1040;
    static final int MSG_CREATE_SESSION = 1050;
    static final int MSG_REMOVE_IME_SURFACE = 1060;

    static final int MSG_START_INPUT = 2000;

@@ -3946,6 +3947,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }
    }

    @Override
    public void removeImeSurface() {
        mContext.enforceCallingPermission(Manifest.permission.INTERNAL_SYSTEM_WINDOW, null);
        mHandler.sendMessage(mHandler.obtainMessage(MSG_REMOVE_IME_SURFACE));
    }

    @BinderThread
    private void notifyUserAction(@NonNull IBinder token) {
        if (DEBUG) {
@@ -4216,6 +4223,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                args.recycle();
                return true;
            }
            case MSG_REMOVE_IME_SURFACE: {
                try {
                    if (mEnabledSession != null && mEnabledSession.session != null) {
                        mEnabledSession.session.removeImeSurface();
                    }
                } catch (RemoteException e) {
                }
                return true;
            }
            // ---------------------------------------------------------

            case MSG_START_INPUT: {
+6 −0
Original line number Diff line number Diff line
@@ -1461,6 +1461,12 @@ public final class MultiClientInputMethodManagerService {
            return null;
        }

        @BinderThread
        @Override
        public void removeImeSurface() {
            reportNotSupported();
        }

        @BinderThread
        @Override
        public boolean showSoftInput(