Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +2 −5 Original line number Diff line number Diff line Loading @@ -461,6 +461,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene } } } unregisterBackCallback(); if (logClose) { mUiEventLogger.logWithInstanceId( Loading Loading @@ -558,11 +559,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene @Override public void onVisibilityAggregated(boolean isVisible) { if (isVisible) { registerBackCallback(); } else { unregisterBackCallback(); } super.onVisibilityAggregated(isVisible); mEditText.setEnabled(isVisible && !mSending); } Loading Loading @@ -623,6 +619,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene setAttachment(mEntry.remoteInputAttachment); updateSendButton(); registerBackCallback(); } public void onNotificationUpdateOrReset() { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java +5 −6 Original line number Diff line number Diff line Loading @@ -269,14 +269,14 @@ public class RemoteInputViewTest extends SysuiTestCase { when(viewRoot.getOnBackInvokedDispatcher()).thenReturn(backInvokedDispatcher); view.setViewRootImpl(viewRoot); /* verify that predictive back callback registered when RemoteInputView becomes visible */ view.onVisibilityAggregated(true); /* verify that predictive back callback registered when RemoteInputView gains focus */ view.focus(); verify(backInvokedDispatcher).registerOnBackInvokedCallback( eq(OnBackInvokedDispatcher.PRIORITY_OVERLAY), onBackInvokedCallbackCaptor.capture()); /* verify that same callback unregistered when RemoteInputView becomes invisible */ view.onVisibilityAggregated(false); /* verify that same callback unregistered when RemoteInputView loses focus */ view.onDefocus(false, false, null); verify(backInvokedDispatcher).unregisterOnBackInvokedCallback( eq(onBackInvokedCallbackCaptor.getValue())); } Loading @@ -299,13 +299,12 @@ public class RemoteInputViewTest extends SysuiTestCase { view.onVisibilityAggregated(true); view.setEditTextReferenceToSelf(); view.focus(); /* capture the callback during registration */ verify(backInvokedDispatcher).registerOnBackInvokedCallback( eq(OnBackInvokedDispatcher.PRIORITY_OVERLAY), onBackInvokedCallbackCaptor.capture()); view.focus(); /* invoke the captured callback */ onBackInvokedCallbackCaptor.getValue().onBackInvoked(); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +2 −5 Original line number Diff line number Diff line Loading @@ -461,6 +461,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene } } } unregisterBackCallback(); if (logClose) { mUiEventLogger.logWithInstanceId( Loading Loading @@ -558,11 +559,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene @Override public void onVisibilityAggregated(boolean isVisible) { if (isVisible) { registerBackCallback(); } else { unregisterBackCallback(); } super.onVisibilityAggregated(isVisible); mEditText.setEnabled(isVisible && !mSending); } Loading Loading @@ -623,6 +619,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene setAttachment(mEntry.remoteInputAttachment); updateSendButton(); registerBackCallback(); } public void onNotificationUpdateOrReset() { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/RemoteInputViewTest.java +5 −6 Original line number Diff line number Diff line Loading @@ -269,14 +269,14 @@ public class RemoteInputViewTest extends SysuiTestCase { when(viewRoot.getOnBackInvokedDispatcher()).thenReturn(backInvokedDispatcher); view.setViewRootImpl(viewRoot); /* verify that predictive back callback registered when RemoteInputView becomes visible */ view.onVisibilityAggregated(true); /* verify that predictive back callback registered when RemoteInputView gains focus */ view.focus(); verify(backInvokedDispatcher).registerOnBackInvokedCallback( eq(OnBackInvokedDispatcher.PRIORITY_OVERLAY), onBackInvokedCallbackCaptor.capture()); /* verify that same callback unregistered when RemoteInputView becomes invisible */ view.onVisibilityAggregated(false); /* verify that same callback unregistered when RemoteInputView loses focus */ view.onDefocus(false, false, null); verify(backInvokedDispatcher).unregisterOnBackInvokedCallback( eq(onBackInvokedCallbackCaptor.getValue())); } Loading @@ -299,13 +299,12 @@ public class RemoteInputViewTest extends SysuiTestCase { view.onVisibilityAggregated(true); view.setEditTextReferenceToSelf(); view.focus(); /* capture the callback during registration */ verify(backInvokedDispatcher).registerOnBackInvokedCallback( eq(OnBackInvokedDispatcher.PRIORITY_OVERLAY), onBackInvokedCallbackCaptor.capture()); view.focus(); /* invoke the captured callback */ onBackInvokedCallbackCaptor.getValue().onBackInvoked(); Loading