diff options
7 files changed, 43 insertions, 21 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java index d4b6dfb9b625..61ebcc0c99d1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java @@ -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"); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java b/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java index d5e4902366e7..63282d2904e8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java @@ -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; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/RemoteInputControllerLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/RemoteInputControllerLogger.kt index 39b999cb4f35..97770316442c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/RemoteInputControllerLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/RemoteInputControllerLogger.kt @@ -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" } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java index affd2d186774..4573d5989faa 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java @@ -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 { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index 9340b85a743d..11c65e542bcd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -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 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java index 53fed3d2438f..7c96029cfe15 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java @@ -305,7 +305,8 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene && editTextRootWindowInsets.isVisible(WindowInsets.Type.ime()); if (!mEntry.mRemoteEditImeVisible && !mEditText.mShowImeOnInputConnection) { // Pass null to ensure all inputs are cleared for this entry b/227115380 - mController.removeRemoteInput(mEntry, null); + mController.removeRemoteInput(mEntry, null, + /* reason= */"RemoteInputView$WindowInsetAnimation#onEnd"); } } } @@ -426,7 +427,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene @VisibleForTesting void onDefocus(boolean animate, boolean logClose, @Nullable Runnable doAfterDefocus) { - mController.removeRemoteInput(mEntry, mToken); + mController.removeRemoteInput(mEntry, mToken, /* reason= */"RemoteInputView#onDefocus"); mEntry.remoteInputText = mEditText.getText(); // During removal, we get reattached and lose focus. Not hiding in that @@ -536,7 +537,8 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene if (mEntry.getRow().isChangingPosition() || isTemporarilyDetached()) { return; } - mController.removeRemoteInput(mEntry, mToken); + mController.removeRemoteInput(mEntry, mToken, + /* reason= */"RemoteInputView#onDetachedFromWindow"); mController.removeSpinning(mEntry.getKey(), mToken); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputViewController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputViewController.kt index a50fd6f86e09..6c0d43394074 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputViewController.kt @@ -255,7 +255,8 @@ class RemoteInputViewControllerImpl @Inject constructor( entry.lastRemoteInputSent = SystemClock.elapsedRealtime() entry.mRemoteEditImeAnimatingAway = true remoteInputController.addSpinning(entry.key, view.mToken) - remoteInputController.removeRemoteInput(entry, view.mToken) + remoteInputController.removeRemoteInput(entry, view.mToken, + /* reason= */ "RemoteInputViewController#sendRemoteInput") remoteInputController.remoteInputSent(entry) entry.setHasSentReply() |