Remove remote input after ime insets animation end
As RemoteInputController#removeRemoteInput will end up to set the
notification shade to not be IME focusable and IME layering target,
If invoking this method too early before IME hide animation finished,
it will cause IME layer can't be on top of notification shade, and
should wait until that happen to fix this IME layer issue.
Fix: 174222049
Test: manual as below steps
1) Make and install EditTextVariations
2) Select menu -> Direct Reply to popup remote input notification.
3) In remote input notification, press "Direct Reply Test" to input
text and press enter button.
4) verify if the soft-keyboard hide animation happens on top of
the notification.
Test: atest NotificationRemoteInputManagerTest
Change-Id: I7dbc8e656505f79b1bfb198c458d3b95a645c1cb
This commit is contained in:
@@ -131,6 +131,7 @@ public class RemoteInputController {
|
||||
*/
|
||||
public void removeRemoteInput(NotificationEntry entry, Object token) {
|
||||
Objects.requireNonNull(entry);
|
||||
if (entry.mRemoteEditImeVisible) return;
|
||||
|
||||
pruneWeakThenRemoveAndContains(null /* contains */, entry /* remove */, token);
|
||||
|
||||
|
||||
@@ -179,6 +179,8 @@ public final class NotificationEntry extends ListEntry {
|
||||
private boolean mShelfIconVisible;
|
||||
private boolean mIsAlerting;
|
||||
|
||||
public boolean mRemoteEditImeVisible;
|
||||
|
||||
/**
|
||||
* @param sbn the StatusBarNotification from system server
|
||||
* @param ranking also from system server
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.systemui.statusbar.policy;
|
||||
|
||||
import static android.view.WindowInsetsAnimation.Callback.DISPATCH_MODE_STOP;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.Nullable;
|
||||
@@ -50,6 +52,8 @@ import android.view.OnReceiveContentListener;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowInsetsAnimation;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.inputmethod.CompletionInfo;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
@@ -61,6 +65,8 @@ import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.internal.statusbar.IStatusBarService;
|
||||
@@ -76,6 +82,7 @@ import com.android.systemui.statusbar.phone.LightBarController;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
@@ -135,6 +142,27 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
|
||||
|
||||
mEditText = (RemoteEditText) getChildAt(0);
|
||||
mEditText.setInnerFocusable(false);
|
||||
mEditText.setWindowInsetsAnimationCallback(
|
||||
new WindowInsetsAnimation.Callback(DISPATCH_MODE_STOP) {
|
||||
@NonNull
|
||||
@Override
|
||||
public WindowInsets onProgress(@NonNull WindowInsets insets,
|
||||
@NonNull List<WindowInsetsAnimation> runningAnimations) {
|
||||
return insets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnd(@NonNull WindowInsetsAnimation animation) {
|
||||
super.onEnd(animation);
|
||||
if (animation.getTypeMask() == WindowInsets.Type.ime()) {
|
||||
mEntry.mRemoteEditImeVisible =
|
||||
mEditText.getRootWindowInsets().isVisible(WindowInsets.Type.ime());
|
||||
if (!mEntry.mRemoteEditImeVisible && !mEditText.mShowImeOnInputConnection) {
|
||||
mController.removeRemoteInput(mEntry, mToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected Intent prepareRemoteInputFromText() {
|
||||
|
||||
Reference in New Issue
Block a user