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

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

Add Reason to removeRemoteInput Logs

This CL adds removingRemoteInput reason to the logs to surface healthy and unhealthy removeRemoteInputFlows.
Healthy Flow:
1. RemoteInputViewController#sendRemoteInput
2. RemoteInputView#onDefocus#onDefocus
3. RemoteInputView$WindowInsetAnimation#onEnd
4. RemoteInputView#onDetachedFromWindow
Unhealthy Flow would be:
1. RemoteInputViewController#sendRemoteInput
2. RemoteInputView#onDefocus
3. RemoteInputView#onDetachedFromWindow
4. RemoteInputView$WindowInsetAnimation#onEnd

Bug: 290068526
Test: RemoteInputLogger removeRemoteInput logs in BR.
Change-Id: I7240925397c3f780dbbd3a0cb11008de442ef832
parent 5c205325
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.systemui.statusbar;


import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.KeyguardManager;
@@ -48,10 +49,10 @@ import androidx.annotation.Nullable;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.Dumpable;
import com.android.systemui.res.R;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.power.domain.interactor.PowerInteractor;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.dagger.CentralSurfacesDependenciesModule;
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
import com.android.systemui.statusbar.notification.RemoteInputControllerLogger;
@@ -535,7 +536,8 @@ public class NotificationRemoteInputManager implements Dumpable {
    public void cleanUpRemoteInputForUserRemoval(NotificationEntry entry) {
        if (isRemoteInputActive(entry)) {
            entry.mRemoteEditImeVisible = false;
            mRemoteInputController.removeRemoteInput(entry, null);
            mRemoteInputController.removeRemoteInput(entry, null,
                    /* reason= */"RemoteInputManager#cleanUpRemoteInputForUserRemoval");
        }
    }

+11 −3
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import com.android.systemui.statusbar.policy.RemoteInputUriController;
import com.android.systemui.statusbar.policy.RemoteInputView;
import com.android.systemui.util.DumpUtilsKt;

import com.google.errorprone.annotations.CompileTimeConstant;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Objects;
@@ -96,7 +98,8 @@ public class RemoteInputController {
     *              the entry is only removed if the token matches the last added token for this
     *              entry. If null, the entry is removed regardless.
     */
    public void removeRemoteInput(NotificationEntry entry, Object token) {
    public void removeRemoteInput(NotificationEntry entry, Object token,
            @CompileTimeConstant String reason) {
        Objects.requireNonNull(entry);
        if (entry.mRemoteEditImeVisible && entry.mRemoteEditImeAnimatingAway) {
            mLogger.logRemoveRemoteInput(
@@ -104,9 +107,12 @@ public class RemoteInputController {
                    true /* remoteEditImeVisible */,
                    true /* remoteEditImeAnimatingAway */,
                    isRemoteInputActive(entry) /* isRemoteInputActiveForEntry */,
                    isRemoteInputActive() /* isRemoteInputActive */);
                    isRemoteInputActive() /* isRemoteInputActive */,
                    reason /* reason */,
                    entry.getNotificationStyle()/* notificationStyle */);
            return;
        }

        // If the view is being removed, this may be called even though we're not active
        boolean remoteInputActiveForEntry = isRemoteInputActive(entry);
        mLogger.logRemoveRemoteInput(
@@ -114,7 +120,9 @@ public class RemoteInputController {
                entry.mRemoteEditImeVisible /* remoteEditImeVisible */,
                entry.mRemoteEditImeAnimatingAway /* remoteEditImeAnimatingAway */,
                remoteInputActiveForEntry /* isRemoteInputActiveForEntry */,
                isRemoteInputActive()/* isRemoteInputActive */);
                isRemoteInputActive()/* isRemoteInputActive */,
                reason/* reason */,
                entry.getNotificationStyle()/* notificationStyle */);

        if (!remoteInputActiveForEntry) return;

+7 −2
Original line number Diff line number Diff line
@@ -52,20 +52,25 @@ constructor(@NotificationRemoteInputLog private val logBuffer: LogBuffer) {
        remoteEditImeVisible: Boolean,
        remoteEditImeAnimatingAway: Boolean,
        isRemoteInputActiveForEntry: Boolean,
        isRemoteInputActive: Boolean
        isRemoteInputActive: Boolean,
        reason: String,
        notificationStyle: String
    ) =
        logBuffer.log(
            TAG,
            DEBUG,
            {
                str1 = entryKey
                str2 = reason
                str3 = notificationStyle
                bool1 = remoteEditImeVisible
                bool2 = remoteEditImeAnimatingAway
                bool3 = isRemoteInputActiveForEntry
                bool4 = isRemoteInputActive
            },
            {
                "removeRemoteInput entry: $str1, remoteEditImeVisible: $bool1" +
                "removeRemoteInput reason: $str2 entry: $str1" +
                    ", style: $str3, remoteEditImeVisible: $bool1" +
                    ", remoteEditImeAnimatingAway: $bool2, isRemoteInputActiveForEntry: $bool3" +
                    ", isRemoteInputActive: $bool4"
            }
+13 −0
Original line number Diff line number Diff line
@@ -979,6 +979,19 @@ public final class NotificationEntry extends ListEntry {
        return mExpandAnimationRunning;
    }

    /**
     * @return NotificationStyle
     */
    public String getNotificationStyle() {
        if (isSummaryWithChildren()) {
            return "summary";
        }

        final Class<? extends Notification.Style> style =
                getSbn().getNotification().getNotificationStyle();
        return style == null ? "nostyle" : style.getSimpleName();
    }

    /** Information about a suggestion that is being edited. */
    public static class EditedSuggestionInfo {

+1 −10
Original line number Diff line number Diff line
@@ -1901,16 +1901,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            return traceTag;
        }

        if (isSummaryWithChildren()) {
            return traceTag + "(summary)";
        }
        Class<? extends Notification.Style> style =
                getEntry().getSbn().getNotification().getNotificationStyle();
        if (style == null) {
            return traceTag + "(nostyle)";
        } else {
            return traceTag + "(" + style.getSimpleName() + ")";
        }
        return  traceTag + "(" + getEntry().getNotificationStyle() + ")";
    }

    @Override
Loading