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

Commit d717b835 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

Log/Dump data about RemoteInputActive

We need to investigate the impact of the RemoteInput on Keyboard opening issue to determine why the issue is happening and how to resolve it.

In order to do it:

1. We extend `NotificationContentView`'s dump to surface any issue happening in `stealFocusFrom`.
2. We log addRemoteInput and removeRemoteInput with `RemoteInputControllerLogger` to understand state changes in `mRemoteInputActive`.

Bug: 263785115
Test: Presubmit
Change-Id: I8d6472963b7b8c8c7b969c601b357d8e3d2acdc1
parent a8ea1593
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -136,6 +136,14 @@ public class LogModule {
        return factory.create("NotifSectionLog", 1000 /* maxSize */, false /* systrace */);
    }

    /** Provides a logging buffer for all logs related to remote input controller. */
    @Provides
    @SysUISingleton
    @NotificationRemoteInputLog
    public static LogBuffer provideNotificationRemoteInputLogBuffer(LogBufferFactory factory) {
        return factory.create("NotifRemoteInputLog", 50 /* maxSize */, false /* systrace */);
    }

    /** Provides a logging buffer for all logs related to the data layer of notifications. */
    @Provides
    @SysUISingleton
+25 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.log.dagger

import javax.inject.Qualifier

/** A [com.android.systemui.log.LogBuffer] for NotificationRemoteInput. */
@Qualifier
@MustBeDocumented
@Retention(AnnotationRetention.RUNTIME)
annotation class NotificationRemoteInputLog
+9 −3
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import com.android.systemui.dump.DumpManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.dagger.CentralSurfacesDependenciesModule;
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
import com.android.systemui.statusbar.notification.RemoteInputControllerLogger;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntry.EditedSuggestionInfo;
import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider;
@@ -65,6 +66,8 @@ import com.android.systemui.statusbar.policy.RemoteInputView;
import com.android.systemui.util.DumpUtilsKt;
import com.android.systemui.util.ListenerSet;

import dagger.Lazy;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
@@ -72,8 +75,6 @@ import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;

import dagger.Lazy;

/**
 * Class for handling remote input state over a set of notifications. This class handles things
 * like keeping notifications temporarily that were cancelled as a response to a remote input
@@ -104,6 +105,8 @@ public class NotificationRemoteInputManager implements Dumpable {
    private final KeyguardManager mKeyguardManager;
    private final StatusBarStateController mStatusBarStateController;
    private final RemoteInputUriController mRemoteInputUriController;

    private final RemoteInputControllerLogger mRemoteInputControllerLogger;
    private final NotificationClickNotifier mClickNotifier;

    protected RemoteInputController mRemoteInputController;
@@ -259,6 +262,7 @@ public class NotificationRemoteInputManager implements Dumpable {
            Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
            StatusBarStateController statusBarStateController,
            RemoteInputUriController remoteInputUriController,
            RemoteInputControllerLogger remoteInputControllerLogger,
            NotificationClickNotifier clickNotifier,
            ActionClickLogger logger,
            DumpManager dumpManager) {
@@ -275,6 +279,7 @@ public class NotificationRemoteInputManager implements Dumpable {
        mKeyguardManager = context.getSystemService(KeyguardManager.class);
        mStatusBarStateController = statusBarStateController;
        mRemoteInputUriController = remoteInputUriController;
        mRemoteInputControllerLogger = remoteInputControllerLogger;
        mClickNotifier = clickNotifier;

        dumpManager.registerDumpable(this);
@@ -294,7 +299,8 @@ public class NotificationRemoteInputManager implements Dumpable {
    /** Initializes this component with the provided dependencies. */
    public void setUpWithCallback(Callback callback, RemoteInputController.Delegate delegate) {
        mCallback = callback;
        mRemoteInputController = new RemoteInputController(delegate, mRemoteInputUriController);
        mRemoteInputController = new RemoteInputController(delegate,
                mRemoteInputUriController, mRemoteInputControllerLogger);
        if (mRemoteInputListener != null) {
            mRemoteInputListener.setRemoteInputController(mRemoteInputController);
        }
+24 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.util.Pair;

import androidx.annotation.NonNull;

import com.android.systemui.statusbar.notification.RemoteInputControllerLogger;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.policy.RemoteInputUriController;
import com.android.systemui.statusbar.policy.RemoteInputView;
@@ -52,10 +53,14 @@ public class RemoteInputController {
    private final Delegate mDelegate;
    private final RemoteInputUriController mRemoteInputUriController;

    private final RemoteInputControllerLogger mLogger;

    public RemoteInputController(Delegate delegate,
            RemoteInputUriController remoteInputUriController) {
            RemoteInputUriController remoteInputUriController,
            RemoteInputControllerLogger logger) {
        mDelegate = delegate;
        mRemoteInputUriController = remoteInputUriController;
        mLogger = logger;
    }

    /**
@@ -117,6 +122,9 @@ public class RemoteInputController {
        boolean isActive = isRemoteInputActive(entry);
        boolean found = pruneWeakThenRemoveAndContains(
                entry /* contains */, null /* remove */, token /* removeToken */);
        mLogger.logAddRemoteInput(entry.getKey()/* entryKey */,
                isActive /* isRemoteInputAlreadyActive */,
                found /* isRemoteInputFound */);
        if (!found) {
            mOpen.add(new Pair<>(new WeakReference<>(entry), token));
        }
@@ -137,9 +145,22 @@ public class RemoteInputController {
     */
    public void removeRemoteInput(NotificationEntry entry, Object token) {
        Objects.requireNonNull(entry);
        if (entry.mRemoteEditImeVisible && entry.mRemoteEditImeAnimatingAway) return;
        if (entry.mRemoteEditImeVisible && entry.mRemoteEditImeAnimatingAway) {
            mLogger.logRemoveRemoteInput(
                    entry.getKey() /* entryKey*/,
                    true /* remoteEditImeVisible */,
                    true /* remoteEditImeAnimatingAway */);
            return;
        }
        // If the view is being removed, this may be called even though we're not active
        if (!isRemoteInputActive(entry)) return;
        boolean remoteInputActive = isRemoteInputActive(entry);
        mLogger.logRemoveRemoteInput(
                entry.getKey() /* entryKey*/,
                entry.mRemoteEditImeVisible /* remoteEditImeVisible */,
                entry.mRemoteEditImeAnimatingAway /* remoteEditImeAnimatingAway */,
                remoteInputActive /* isRemoteInputActive */);

        if (!remoteInputActive) return;

        pruneWeakThenRemoveAndContains(null /* contains */, entry /* remove */, token);

+6 −3
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.commandline.CommandRegistry;
import com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureHandler;
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
import com.android.systemui.statusbar.notification.RemoteInputControllerLogger;
import com.android.systemui.statusbar.notification.collection.NotifCollection;
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection;
@@ -77,14 +78,14 @@ import com.android.systemui.tracing.ProtoTracer;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.time.SystemClock;

import java.util.Optional;
import java.util.concurrent.Executor;

import dagger.Binds;
import dagger.Lazy;
import dagger.Module;
import dagger.Provides;

import java.util.Optional;
import java.util.concurrent.Executor;

/**
 * This module provides instances needed to construct {@link CentralSurfacesImpl}. These are moved to
 * this separate from {@link CentralSurfacesModule} module so that components that wish to build
@@ -105,6 +106,7 @@ public interface CentralSurfacesDependenciesModule {
            Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
            StatusBarStateController statusBarStateController,
            RemoteInputUriController remoteInputUriController,
            RemoteInputControllerLogger remoteInputControllerLogger,
            NotificationClickNotifier clickNotifier,
            ActionClickLogger actionClickLogger,
            DumpManager dumpManager) {
@@ -117,6 +119,7 @@ public interface CentralSurfacesDependenciesModule {
                centralSurfacesOptionalLazy,
                statusBarStateController,
                remoteInputUriController,
                remoteInputControllerLogger,
                clickNotifier,
                actionClickLogger,
                dumpManager);
Loading