From 1bee00878dd36344b39a6cc3841931f2f8ab37b4 Mon Sep 17 00:00:00 2001 From: Joshua Tsuji Date: Tue, 2 Jun 2020 15:46:57 -0400 Subject: [PATCH 1/2] Add a public method to BubbleController to hide the IME. Since the IME focus is given to the virtual display inside the expanded bubble, whatever method Screenshots is using to hide the IME doesn't work. Test: manual Bug: 157756391 Change-Id: Ic052133c29f269c264f4b2e8dbce29414702e634 --- .../android/systemui/bubbles/BubbleController.java | 10 ++++++++++ .../android/systemui/bubbles/BubbleStackView.java | 14 +++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index cf793f021a294..02f17ef2f38c1 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -415,6 +415,16 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mCallbacks.add(callback); } + /** + * Dispatches a back press into the expanded Bubble's ActivityView if its IME is visible, + * causing it to hide. + */ + public void hideImeFromExpandedBubble() { + if (mStackView != null) { + mStackView.hideImeFromExpandedBubble(); + } + } + private void setupNEM() { mNotificationEntryManager.addNotificationEntryListener( new NotificationEntryListener() { diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index 95c8d08841df1..4859c9774bd17 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -1656,6 +1656,14 @@ public class BubbleStackView extends FrameLayout } } + void hideImeFromExpandedBubble() { + if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) { + // Hide the currently expanded bubble's IME if it's visible before switching to a new + // bubble. + mExpandedBubble.getExpandedView().hideImeIfVisible(); + } + } + private void beforeExpandedViewAnimation() { hideFlyoutImmediate(); updateExpandedBubble(); @@ -2238,11 +2246,7 @@ public class BubbleStackView extends FrameLayout Log.d(TAG, "updateExpandedBubble()"); } - if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) { - // Hide the currently expanded bubble's IME if it's visible before switching to a new - // bubble. - mExpandedBubble.getExpandedView().hideImeIfVisible(); - } + hideImeFromExpandedBubble(); mExpandedViewContainer.removeAllViews(); if (mIsExpanded && mExpandedBubble != null From d56eaf68f6524a42594758feb20dc68f9920c33c Mon Sep 17 00:00:00 2001 From: Matt Casey Date: Tue, 9 Jun 2020 15:43:56 -0400 Subject: [PATCH 2/2] Hide bubbles' IME after screenshot is taken. Needed to create a separate receiver to handle this as GlobalScreenshot is in the screenshot process. Bug: 157756391 Test: Open IME in bubble test app, take screenshot, verify that IME goes away and does not interfere with screenshots UI. Change-Id: I93d050340e59c5b45250f53eb943697fa543b706 --- packages/SystemUI/AndroidManifest.xml | 4 ++++ .../systemui/screenshot/GlobalScreenshot.java | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 985269b2bb759..ef3e799a55bfd 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -406,6 +406,10 @@ + + + mBubbleController; + + public ScreenshotTakenReceiver(Lazy bubbleController) { + mBubbleController = bubbleController; + } + + @Override + public void onReceive(Context context, Intent intent) { + mBubbleController.get().hideImeFromExpandedBubble(); + } + } }