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

Commit a1d46ce3 authored by Kean Mariotti's avatar Kean Mariotti Committed by Android (Google) Code Review
Browse files

Merge "ime tracing: refactoring prior perfetto migration" into main

parents 7948823e 5967006a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.inputmethod;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.app.ActivityThread;
@@ -144,7 +145,7 @@ public abstract class ImeTracing {
     *
     * @param where Place where the trace was triggered.
     */
    public abstract void triggerManagerServiceDump(String where);
    public abstract void triggerManagerServiceDump(String where, @NonNull ServiceDumper dumper);

    /**
     * Being called while taking a bugreport so that tracing files can be included in the bugreport
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ class ImeTracingClientImpl extends ImeTracing {
    }

    @Override
    public void triggerManagerServiceDump(String where) {
    public void triggerManagerServiceDump(String where, @NonNull ServiceDumper dumper) {
        // Intentionally left empty, this is implemented in ImeTracingServerImpl
    }

+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.inputmethod;

import static android.os.Build.IS_USER;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.SystemClock;
import android.util.Log;
@@ -116,7 +117,7 @@ class ImeTracingServerImpl extends ImeTracing {
    }

    @Override
    public void triggerManagerServiceDump(String where) {
    public void triggerManagerServiceDump(String where, @NonNull ServiceDumper dumper) {
        if (!isEnabled() || !isAvailable()) {
            return;
        }
+14 −4
Original line number Diff line number Diff line
@@ -382,6 +382,16 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
    @MultiUserUnawareField
    Future<?> mImeDrawsImeNavBarResLazyInitFuture;

    private final ImeTracing.ServiceDumper mDumper = new ImeTracing.ServiceDumper() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void dumpToProto(ProtoOutputStream proto, @Nullable byte[] icProto) {
            dumpDebug(proto, InputMethodManagerServiceTraceProto.INPUT_METHOD_MANAGER_SERVICE);
        }
    };

    static class SessionState {
        final ClientState mClient;
        final IInputMethodInvoker mMethod;
@@ -3111,7 +3121,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.showSoftInput");
        int uid = Binder.getCallingUid();
        ImeTracing.getInstance().triggerManagerServiceDump(
                "InputMethodManagerService#showSoftInput");
                "InputMethodManagerService#showSoftInput", mDumper);
        synchronized (ImfLock.class) {
            if (!canInteractWithImeLocked(uid, client, "showSoftInput", statsToken)) {
                ImeTracker.forLogging().onFailed(
@@ -3210,7 +3220,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMMS.startStylusHandwriting");
        try {
            ImeTracing.getInstance().triggerManagerServiceDump(
                    "InputMethodManagerService#startStylusHandwriting");
                    "InputMethodManagerService#startStylusHandwriting", mDumper);
            int uid = Binder.getCallingUid();
            synchronized (ImfLock.class) {
                if (!acceptingDelegation) {
@@ -3445,7 +3455,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
        int uid = Binder.getCallingUid();
        ImeTracing.getInstance().triggerManagerServiceDump(
                "InputMethodManagerService#hideSoftInput");
                "InputMethodManagerService#hideSoftInput", mDumper);
        synchronized (ImfLock.class) {
            if (!canInteractWithImeLocked(uid, client, "hideSoftInput", statsToken)) {
                if (isInputShownLocked()) {
@@ -3583,7 +3593,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER,
                    "IMMS.startInputOrWindowGainedFocus");
            ImeTracing.getInstance().triggerManagerServiceDump(
                    "InputMethodManagerService#startInputOrWindowGainedFocus");
                    "InputMethodManagerService#startInputOrWindowGainedFocus", mDumper);
            final InputBindResult result;
            synchronized (ImfLock.class) {
                // If the system is not yet ready, we shouldn't be running third party code.