summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Johannes Gallmann <gallmann@google.com> 2024-03-27 11:53:43 +0100
committer Johannes Gallmann <gallmann@google.com> 2024-03-27 11:56:09 +0100
commit150e981c20d8b9a58df0fe8c1f993afe0246bd35 (patch)
tree8323ac0cf623348697204fe17a148521338ed3d0
parent69a62d57ba45b1528a72fdaff9f24375c77ad0d7 (diff)
Fix RemoteInputView not visible when Reply tapped from AOD
Bug: 325118951 Flag: NONE Test: atest RemoteInputViewTest Test: Manual, i.e. verifying that RIV is visible after the following sequence of events: tap reply from AOD, post notification update, tap reply again from AOD Change-Id: I7b478bf3071c0fbcebcfdaa1c2b902e0091387b3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java1
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java30
2 files changed, 30 insertions, 1 deletions
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 9633cb085afa..579d43b5fd05 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
@@ -453,6 +453,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
setTopMargin(0);
if (grandParent != null) grandParent.setClipChildren(true);
setVisibility(GONE);
+ setAlpha(1f);
if (mWrapper != null) {
mWrapper.setRemoteInputVisible(false);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java
index c25978271b17..70afbd82df11 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java
@@ -67,10 +67,10 @@ import androidx.test.filters.SmallTest;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.testing.UiEventLoggerFake;
import com.android.systemui.Dependency;
-import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.animation.AnimatorTestRule;
import com.android.systemui.flags.FakeFeatureFlags;
+import com.android.systemui.res.R;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -448,6 +448,34 @@ public class RemoteInputViewTest extends SysuiTestCase {
assertEquals(1f, fadeInView.getAlpha());
}
+ @Test
+ public void testUnanimatedFocusAfterDefocusAnimation() throws Exception {
+ NotificationTestHelper helper = new NotificationTestHelper(
+ mContext,
+ mDependency,
+ TestableLooper.get(this));
+ ExpandableNotificationRow row = helper.createRow();
+ RemoteInputView view = RemoteInputView.inflate(mContext, null, row.getEntry(), mController);
+ bindController(view, row.getEntry());
+
+ FrameLayout parent = new FrameLayout(mContext);
+ parent.addView(view);
+
+ // Play defocus animation
+ view.onDefocus(true /* animate */, false /* logClose */, null /* doAfterDefocus */);
+ mAnimatorTestRule.advanceTimeBy(ANIMATION_DURATION_STANDARD);
+
+ // assert that RemoteInputView is no longer visible, but alpha is reset to 1f
+ assertEquals(View.GONE, view.getVisibility());
+ assertEquals(1f, view.getAlpha());
+
+ // focus RemoteInputView without an animation
+ view.focus();
+ // assert that RemoteInputView is visible, and alpha is 1f
+ assertEquals(View.VISIBLE, view.getVisibility());
+ assertEquals(1f, view.getAlpha());
+ }
+
// NOTE: because we're refactoring the RemoteInputView and moving logic into the
// RemoteInputViewController, it's easiest to just test the system of the two classes together.
@NonNull