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

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

Merge "Measure baseline IMF latency (2/n)"

parents b8165b65 5c61eefb
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -46,6 +46,7 @@ import static android.inputmethodservice.InputMethodServiceProto.STATUS_ICON;
import static android.inputmethodservice.InputMethodServiceProto.TOKEN;
import static android.inputmethodservice.InputMethodServiceProto.TOKEN;
import static android.inputmethodservice.InputMethodServiceProto.VIEWS_CREATED;
import static android.inputmethodservice.InputMethodServiceProto.VIEWS_CREATED;
import static android.inputmethodservice.InputMethodServiceProto.WINDOW_VISIBLE;
import static android.inputmethodservice.InputMethodServiceProto.WINDOW_VISIBLE;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static android.view.WindowInsets.Type.navigationBars;
import static android.view.WindowInsets.Type.navigationBars;
@@ -80,6 +81,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.IBinder;
import android.os.ResultReceiver;
import android.os.ResultReceiver;
import android.os.SystemClock;
import android.os.SystemClock;
import android.os.Trace;
import android.provider.Settings;
import android.provider.Settings;
import android.text.InputType;
import android.text.InputType;
import android.text.Layout;
import android.text.Layout;
@@ -645,7 +647,9 @@ public class InputMethodService extends AbstractInputMethodService {
        @Override
        @Override
        public void startInput(InputConnection ic, EditorInfo attribute) {
        public void startInput(InputConnection ic, EditorInfo attribute) {
            if (DEBUG) Log.v(TAG, "startInput(): editor=" + attribute);
            if (DEBUG) Log.v(TAG, "startInput(): editor=" + attribute);
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.startInput");
            doStartInput(ic, attribute, false);
            doStartInput(ic, attribute, false);
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        }
        }


        /**
        /**
@@ -705,6 +709,8 @@ public class InputMethodService extends AbstractInputMethodService {
                return;
                return;
            }
            }
            final boolean wasVisible = isInputViewShown();
            final boolean wasVisible = isInputViewShown();
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.hideSoftInput");

            applyVisibilityInInsetsConsumerIfNecessary(false /* setVisible */);
            applyVisibilityInInsetsConsumerIfNecessary(false /* setVisible */);
            mShowInputFlags = 0;
            mShowInputFlags = 0;
            mShowInputRequested = false;
            mShowInputRequested = false;
@@ -717,6 +723,7 @@ public class InputMethodService extends AbstractInputMethodService {
                        : (wasVisible ? InputMethodManager.RESULT_UNCHANGED_SHOWN
                        : (wasVisible ? InputMethodManager.RESULT_UNCHANGED_SHOWN
                                : InputMethodManager.RESULT_UNCHANGED_HIDDEN), null);
                                : InputMethodManager.RESULT_UNCHANGED_HIDDEN), null);
            }
            }
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        }
        }


        /**
        /**
@@ -748,6 +755,13 @@ public class InputMethodService extends AbstractInputMethodService {
                        + " Use requestShowSelf(int) itself");
                        + " Use requestShowSelf(int) itself");
                return;
                return;
            }
            }

            if (Trace.isEnabled()) {
                Binder.enableTracing();
            } else {
                Binder.disableTracing();
            }
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.showSoftInput");
            final boolean wasVisible = isInputViewShown();
            final boolean wasVisible = isInputViewShown();
            if (dispatchOnShowInputRequested(flags, false)) {
            if (dispatchOnShowInputRequested(flags, false)) {


@@ -764,6 +778,7 @@ public class InputMethodService extends AbstractInputMethodService {
                        : (wasVisible ? InputMethodManager.RESULT_UNCHANGED_SHOWN
                        : (wasVisible ? InputMethodManager.RESULT_UNCHANGED_SHOWN
                                : InputMethodManager.RESULT_UNCHANGED_HIDDEN), null);
                                : InputMethodManager.RESULT_UNCHANGED_HIDDEN), null);
            }
            }
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        }
        }


        /**
        /**
+3 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.view;
package android.view;


import static android.os.Trace.TRACE_TAG_VIEW;
import static android.view.ImeInsetsSourceConsumerProto.INSETS_SOURCE_CONSUMER;
import static android.view.ImeInsetsSourceConsumerProto.INSETS_SOURCE_CONSUMER;
import static android.view.ImeInsetsSourceConsumerProto.IS_REQUESTED_VISIBLE_AWAITING_CONTROL;
import static android.view.ImeInsetsSourceConsumerProto.IS_REQUESTED_VISIBLE_AWAITING_CONTROL;
import static android.view.InsetsController.AnimationType;
import static android.view.InsetsController.AnimationType;
@@ -24,6 +25,7 @@ import static android.view.InsetsState.ITYPE_IME;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.inputmethodservice.InputMethodService;
import android.inputmethodservice.InputMethodService;
import android.os.IBinder;
import android.os.IBinder;
import android.os.Trace;
import android.util.proto.ProtoOutputStream;
import android.util.proto.ProtoOutputStream;
import android.view.SurfaceControl.Transaction;
import android.view.SurfaceControl.Transaction;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodManager;
@@ -105,6 +107,7 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {
    @Override
    @Override
    void notifyHidden() {
    void notifyHidden() {
        getImm().notifyImeHidden(mController.getHost().getWindowToken());
        getImm().notifyImeHidden(mController.getHost().getWindowToken());
        Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.hideRequestFromApi", 0);
    }
    }


    @Override
    @Override
+30 −9
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.view;
package android.view;


import static android.os.Trace.TRACE_TAG_VIEW;
import static android.view.InsetsControllerProto.CONTROL;
import static android.view.InsetsControllerProto.CONTROL;
import static android.view.InsetsControllerProto.STATE;
import static android.view.InsetsControllerProto.STATE;
import static android.view.InsetsState.ITYPE_CAPTION_BAR;
import static android.view.InsetsState.ITYPE_CAPTION_BAR;
@@ -829,6 +830,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
    public void show(@InsetsType int types, boolean fromIme) {
    public void show(@InsetsType int types, boolean fromIme) {
        if (fromIme) {
        if (fromIme) {
            ImeTracing.getInstance().triggerDump();
            ImeTracing.getInstance().triggerDump();
            Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApiToImeReady", 0);
            Trace.asyncTraceBegin(TRACE_TAG_VIEW, "IC.showRequestFromIme", 0);
        } else {
            Trace.asyncTraceBegin(TRACE_TAG_VIEW, "IC.showRequestFromApi", 0);
            Trace.asyncTraceBegin(TRACE_TAG_VIEW, "IC.showRequestFromApiToImeReady", 0);
        }
        }
        // Handle pending request ready in case there was one set.
        // Handle pending request ready in case there was one set.
        if (fromIme && mPendingImeControlRequest != null) {
        if (fromIme && mPendingImeControlRequest != null) {
@@ -880,6 +886,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
    void hide(@InsetsType int types, boolean fromIme) {
    void hide(@InsetsType int types, boolean fromIme) {
        if (fromIme) {
        if (fromIme) {
            ImeTracing.getInstance().triggerDump();
            ImeTracing.getInstance().triggerDump();
            Trace.asyncTraceBegin(TRACE_TAG_VIEW, "IC.hideRequestFromIme", 0);
        } else {
            Trace.asyncTraceBegin(TRACE_TAG_VIEW, "IC.hideRequestFromApi", 0);
        }
        }
        int typesReady = 0;
        int typesReady = 0;
        final ArraySet<Integer> internalTypes = InsetsState.toInternalType(types);
        final ArraySet<Integer> internalTypes = InsetsState.toInternalType(types);
@@ -989,6 +998,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
                });
                });
            }
            }
            updateRequestedVisibility();
            updateRequestedVisibility();
            Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApi", 0);
            return;
            return;
        }
        }


@@ -1014,11 +1024,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
            cancellationSignal.setOnCancelListener(() -> {
            cancellationSignal.setOnCancelListener(() -> {
                cancelAnimation(runner, true /* invokeCallback */);
                cancelAnimation(runner, true /* invokeCallback */);
            });
            });
        } else {
            Trace.asyncTraceBegin(TRACE_TAG_VIEW, "IC.pendingAnim", 0);
        }
        }
        if (layoutInsetsDuringAnimation == LAYOUT_INSETS_DURING_ANIMATION_SHOWN) {
        if (layoutInsetsDuringAnimation == LAYOUT_INSETS_DURING_ANIMATION_SHOWN) {
            showDirectly(types);
            showDirectly(types, fromIme);
        } else {
        } else {
            hideDirectly(types, false /* animationFinished */, animationType);
            hideDirectly(types, false /* animationFinished */, animationType, fromIme);
        }
        }
        updateRequestedVisibility();
        updateRequestedVisibility();
    }
    }
@@ -1141,10 +1153,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
        cancelAnimation(runner, false /* invokeCallback */);
        cancelAnimation(runner, false /* invokeCallback */);
        if (DEBUG) Log.d(TAG, "notifyFinished. shown: " + shown);
        if (DEBUG) Log.d(TAG, "notifyFinished. shown: " + shown);
        if (shown) {
        if (shown) {
            showDirectly(runner.getTypes());
            showDirectly(runner.getTypes(), true /* fromIme */);
        } else {
        } else {
            hideDirectly(runner.getTypes(), true /* animationFinished */,
            hideDirectly(runner.getTypes(), true /* animationFinished */,
                    runner.getAnimationType());
                    runner.getAnimationType(), true /* fromIme */);
        }
        }
    }
    }


@@ -1314,11 +1326,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
                show ? ANIMATION_TYPE_SHOW : ANIMATION_TYPE_HIDE,
                show ? ANIMATION_TYPE_SHOW : ANIMATION_TYPE_HIDE,
                show ? LAYOUT_INSETS_DURING_ANIMATION_SHOWN : LAYOUT_INSETS_DURING_ANIMATION_HIDDEN,
                show ? LAYOUT_INSETS_DURING_ANIMATION_SHOWN : LAYOUT_INSETS_DURING_ANIMATION_HIDDEN,
                !hasAnimationCallbacks /* useInsetsAnimationThread */);
                !hasAnimationCallbacks /* useInsetsAnimationThread */);

    }
    }


    private void hideDirectly(
    private void hideDirectly(
            @InsetsType int types, boolean animationFinished, @AnimationType int animationType) {
            @InsetsType int types, boolean animationFinished, @AnimationType int animationType,
            boolean fromIme) {
        if ((types & ime()) != 0) {
        if ((types & ime()) != 0) {
            ImeTracing.getInstance().triggerDump();
            ImeTracing.getInstance().triggerDump();
        }
        }
@@ -1327,9 +1339,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
            getSourceConsumer(internalTypes.valueAt(i)).hide(animationFinished, animationType);
            getSourceConsumer(internalTypes.valueAt(i)).hide(animationFinished, animationType);
        }
        }
        updateRequestedVisibility();
        updateRequestedVisibility();

        if (fromIme) {
            Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.hideRequestFromIme", 0);
        }
    }
    }


    private void showDirectly(@InsetsType int types) {
    private void showDirectly(@InsetsType int types, boolean fromIme) {
        if ((types & ime()) != 0) {
        if ((types & ime()) != 0) {
            ImeTracing.getInstance().triggerDump();
            ImeTracing.getInstance().triggerDump();
        }
        }
@@ -1338,6 +1354,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
            getSourceConsumer(internalTypes.valueAt(i)).show(false /* fromIme */);
            getSourceConsumer(internalTypes.valueAt(i)).show(false /* fromIme */);
        }
        }
        updateRequestedVisibility();
        updateRequestedVisibility();

        if (fromIme) {
            Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromIme", 0);
        }
    }
    }


    /**
    /**
@@ -1374,7 +1394,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
                if (WARN) Log.w(TAG, "startAnimation canceled before preDraw");
                if (WARN) Log.w(TAG, "startAnimation canceled before preDraw");
                return;
                return;
            }
            }
            Trace.asyncTraceBegin(Trace.TRACE_TAG_VIEW,
            Trace.asyncTraceBegin(TRACE_TAG_VIEW,
                    "InsetsAnimation: " + WindowInsets.Type.toString(types), types);
                    "InsetsAnimation: " + WindowInsets.Type.toString(types), types);
            for (int i = mRunningAnimations.size() - 1; i >= 0; i--) {
            for (int i = mRunningAnimations.size() - 1; i >= 0; i--) {
                RunningAnimation runningAnimation = mRunningAnimations.get(i);
                RunningAnimation runningAnimation = mRunningAnimations.get(i);
@@ -1382,6 +1402,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
                    runningAnimation.startDispatched = true;
                    runningAnimation.startDispatched = true;
                }
                }
            }
            }
            Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.pendingAnim", 0);
            mHost.dispatchWindowInsetsAnimationStart(animation, bounds);
            mHost.dispatchWindowInsetsAnimationStart(animation, bounds);
            mStartingAnimation = true;
            mStartingAnimation = true;
            controller.mReadyDispatched = true;
            controller.mReadyDispatched = true;
@@ -1392,7 +1413,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation


    @VisibleForTesting
    @VisibleForTesting
    public void dispatchAnimationEnd(WindowInsetsAnimation animation) {
    public void dispatchAnimationEnd(WindowInsetsAnimation animation) {
        Trace.asyncTraceEnd(Trace.TRACE_TAG_VIEW,
        Trace.asyncTraceEnd(TRACE_TAG_VIEW,
                "InsetsAnimation: " + WindowInsets.Type.toString(animation.getTypeMask()),
                "InsetsAnimation: " + WindowInsets.Type.toString(animation.getTypeMask()),
                animation.getTypeMask());
                animation.getTypeMask());
        mHost.dispatchWindowInsetsAnimationEnd(animation);
        mHost.dispatchWindowInsetsAnimationEnd(animation);
+55 −34
Original line number Original line Diff line number Diff line
@@ -15,6 +15,7 @@


package com.android.server.inputmethod;
package com.android.server.inputmethod;


import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.server.inputmethod.InputMethodManagerServiceProto.ACCESSIBILITY_REQUESTING_NO_SOFT_KEYBOARD;
import static android.server.inputmethod.InputMethodManagerServiceProto.ACCESSIBILITY_REQUESTING_NO_SOFT_KEYBOARD;
import static android.server.inputmethod.InputMethodManagerServiceProto.BACK_DISPOSITION;
import static android.server.inputmethod.InputMethodManagerServiceProto.BACK_DISPOSITION;
import static android.server.inputmethod.InputMethodManagerServiceProto.BOUND_TO_METHOD;
import static android.server.inputmethod.InputMethodManagerServiceProto.BOUND_TO_METHOD;
@@ -110,6 +111,7 @@ import android.os.ShellCallback;
import android.os.ShellCommand;
import android.os.ShellCommand;
import android.os.SystemClock;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManager;
import android.os.UserManagerInternal;
import android.os.UserManagerInternal;
@@ -3106,6 +3108,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    @Override
    @Override
    public boolean showSoftInput(IInputMethodClient client, IBinder windowToken, int flags,
    public boolean showSoftInput(IInputMethodClient client, IBinder windowToken, int flags,
            ResultReceiver resultReceiver) {
            ResultReceiver resultReceiver) {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.showSoftInput");
        int uid = Binder.getCallingUid();
        int uid = Binder.getCallingUid();
        synchronized (mMethodMap) {
        synchronized (mMethodMap) {
            if (!calledFromValidUserLocked()) {
            if (!calledFromValidUserLocked()) {
@@ -3133,6 +3136,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                        SoftInputShowHideReason.SHOW_SOFT_INPUT);
                        SoftInputShowHideReason.SHOW_SOFT_INPUT);
            } finally {
            } finally {
                Binder.restoreCallingIdentity(ident);
                Binder.restoreCallingIdentity(ident);
                Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
            }
            }
        }
        }
    }
    }
@@ -3225,6 +3229,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            }
            }
            final long ident = Binder.clearCallingIdentity();
            final long ident = Binder.clearCallingIdentity();
            try {
            try {
                Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.hideSoftInput");
                if (mCurClient == null || client == null
                if (mCurClient == null || client == null
                        || mCurClient.client.asBinder() != client.asBinder()) {
                        || mCurClient.client.asBinder() != client.asBinder()) {
                    // We need to check if this is the current client with
                    // We need to check if this is the current client with
@@ -3248,6 +3253,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                        SoftInputShowHideReason.HIDE_SOFT_INPUT);
                        SoftInputShowHideReason.HIDE_SOFT_INPUT);
            } finally {
            } finally {
                Binder.restoreCallingIdentity(ident);
                Binder.restoreCallingIdentity(ident);
                Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
            }
            }
        }
        }
    }
    }
@@ -3310,17 +3316,22 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            Slog.e(TAG, "windowToken cannot be null.");
            Slog.e(TAG, "windowToken cannot be null.");
            return InputBindResult.NULL;
            return InputBindResult.NULL;
        }
        }
        try {
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER,
                    "IMMS.startInputOrWindowGainedFocus");
            final int callingUserId = UserHandle.getCallingUserId();
            final int callingUserId = UserHandle.getCallingUserId();
            final int userId;
            final int userId;
            if (attribute != null && attribute.targetInputMethodUser != null
            if (attribute != null && attribute.targetInputMethodUser != null
                    && attribute.targetInputMethodUser.getIdentifier() != callingUserId) {
                    && attribute.targetInputMethodUser.getIdentifier() != callingUserId) {
                mContext.enforceCallingPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL,
                mContext.enforceCallingPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL,
                    "Using EditorInfo.targetInputMethodUser requires INTERACT_ACROSS_USERS_FULL.");
                        "Using EditorInfo.targetInputMethodUser requires"
                                + " INTERACT_ACROSS_USERS_FULL.");
                userId = attribute.targetInputMethodUser.getIdentifier();
                userId = attribute.targetInputMethodUser.getIdentifier();
                if (!mUserManagerInternal.isUserRunning(userId)) {
                if (!mUserManagerInternal.isUserRunning(userId)) {
                // There is a chance that we hit here because of race condition.  Let's just return
                    // There is a chance that we hit here because of race condition.  Let's just
                // an error code instead of crashing the caller process, which at least has
                    // return an error code instead of crashing the caller process, which at least
                // INTERACT_ACROSS_USERS_FULL permission thus is likely to be an important process.
                    // has INTERACT_ACROSS_USERS_FULL permission thus is likely to be an important
                    // process.
                    Slog.e(TAG, "User #" + userId + " is not running.");
                    Slog.e(TAG, "User #" + userId + " is not running.");
                    return InputBindResult.INVALID_USER;
                    return InputBindResult.INVALID_USER;
                }
                }
@@ -3346,7 +3357,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                        + " editorInfo=" + attribute);
                        + " editorInfo=" + attribute);
                return InputBindResult.NULL;
                return InputBindResult.NULL;
            }
            }

            return result;
            return result;
        } finally {
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        }
    }
    }


    @NonNull
    @NonNull
@@ -4124,6 +4139,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub


    @BinderThread
    @BinderThread
    private void applyImeVisibility(IBinder token, IBinder windowToken, boolean setVisible) {
    private void applyImeVisibility(IBinder token, IBinder windowToken, boolean setVisible) {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.applyImeVisibility");
        synchronized (mMethodMap) {
        synchronized (mMethodMap) {
            if (!calledWithValidTokenLocked(token)) {
            if (!calledWithValidTokenLocked(token)) {
                return;
                return;
@@ -4145,6 +4161,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                mWindowManagerInternal.showImePostLayout(mShowRequestWindowMap.get(windowToken));
                mWindowManagerInternal.showImePostLayout(mShowRequestWindowMap.get(windowToken));
            }
            }
        }
        }
        Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
    }
    }


    private void setInputMethodWithSubtypeIdLocked(IBinder token, String id, int subtypeId) {
    private void setInputMethodWithSubtypeIdLocked(IBinder token, String id, int subtypeId) {
@@ -4172,6 +4189,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub


    @BinderThread
    @BinderThread
    private void hideMySoftInput(@NonNull IBinder token, int flags) {
    private void hideMySoftInput(@NonNull IBinder token, int flags) {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.hideMySoftInput");
        synchronized (mMethodMap) {
        synchronized (mMethodMap) {
            if (!calledWithValidTokenLocked(token)) {
            if (!calledWithValidTokenLocked(token)) {
                return;
                return;
@@ -4186,10 +4204,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                Binder.restoreCallingIdentity(ident);
                Binder.restoreCallingIdentity(ident);
            }
            }
        }
        }
        Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
    }
    }


    @BinderThread
    @BinderThread
    private void showMySoftInput(@NonNull IBinder token, int flags) {
    private void showMySoftInput(@NonNull IBinder token, int flags) {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.showMySoftInput");
        synchronized (mMethodMap) {
        synchronized (mMethodMap) {
            if (!calledWithValidTokenLocked(token)) {
            if (!calledWithValidTokenLocked(token)) {
                return;
                return;
@@ -4202,6 +4222,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                Binder.restoreCallingIdentity(ident);
                Binder.restoreCallingIdentity(ident);
            }
            }
        }
        }
        Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
    }
    }


    void setEnabledSessionInMainThread(SessionState session) {
    void setEnabledSessionInMainThread(SessionState session) {
+4 −0
Original line number Original line Diff line number Diff line
@@ -16,11 +16,14 @@


package com.android.server.wm;
package com.android.server.wm;


import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;

import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_IME;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_IME;
import static com.android.server.wm.ImeInsetsSourceProviderProto.IME_TARGET_FROM_IME;
import static com.android.server.wm.ImeInsetsSourceProviderProto.IME_TARGET_FROM_IME;
import static com.android.server.wm.ImeInsetsSourceProviderProto.INSETS_SOURCE_PROVIDER;
import static com.android.server.wm.ImeInsetsSourceProviderProto.INSETS_SOURCE_PROVIDER;
import static com.android.server.wm.ImeInsetsSourceProviderProto.IS_IME_LAYOUT_DRAWN;
import static com.android.server.wm.ImeInsetsSourceProviderProto.IS_IME_LAYOUT_DRAWN;


import android.os.Trace;
import android.util.proto.ProtoOutputStream;
import android.util.proto.ProtoOutputStream;
import android.view.InsetsSource;
import android.view.InsetsSource;
import android.view.WindowInsets;
import android.view.WindowInsets;
@@ -79,6 +82,7 @@ class ImeInsetsSourceProvider extends InsetsSourceProvider {
                ProtoLog.i(WM_DEBUG_IME, "call showInsets(ime) on %s",
                ProtoLog.i(WM_DEBUG_IME, "call showInsets(ime) on %s",
                        target.getWindow() != null ? target.getWindow().getName() : "");
                        target.getWindow() != null ? target.getWindow().getName() : "");
                target.showInsets(WindowInsets.Type.ime(), true /* fromIme */);
                target.showInsets(WindowInsets.Type.ime(), true /* fromIme */);
                Trace.asyncTraceEnd(TRACE_TAG_WINDOW_MANAGER, "WMS.showImePostLayout", 0);
                if (target != mImeTargetFromIme && mImeTargetFromIme != null) {
                if (target != mImeTargetFromIme && mImeTargetFromIme != null) {
                    ProtoLog.w(WM_DEBUG_IME,
                    ProtoLog.w(WM_DEBUG_IME,
                            "showInsets(ime) was requested by different window: %s ",
                            "showInsets(ime) was requested by different window: %s ",
Loading