Merge changes I93d05034,Ic052133c into rvc-dev

* changes:
  Hide bubbles' IME after screenshot is taken.
  Add a public method to BubbleController to hide the IME.
This commit is contained in:
Matt Casey
2020-06-10 20:49:10 +00:00
committed by Android (Google) Code Review
4 changed files with 42 additions and 5 deletions

View File

@@ -406,6 +406,10 @@
<receiver android:name=".screenshot.GlobalScreenshot$SmartActionsReceiver"
android:exported="false"/>
<!-- Callback for performing sysui cleanup after screenshot has been taken. -->
<receiver android:name=".screenshot.GlobalScreenshot$ScreenshotTakenReceiver"
android:exported="false"/>
<!-- started from UsbDeviceSettingsManager -->
<activity android:name=".usb.UsbConfirmActivity"
android:exported="true"

View File

@@ -419,6 +419,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() {

View File

@@ -1690,6 +1690,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() {
mIsExpansionAnimating = true;
hideFlyoutImmediate();
@@ -2405,11 +2413,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

View File

@@ -83,6 +83,7 @@ import android.widget.Toast;
import com.android.internal.logging.UiEventLogger;
import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.statusbar.phone.StatusBar;
@@ -483,6 +484,8 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
return;
}
mContext.sendBroadcast(new Intent(mContext, ScreenshotTakenReceiver.class));
// Optimizations
mScreenBitmap.setHasAlpha(false);
mScreenBitmap.prepareToDraw();
@@ -1089,4 +1092,20 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
context, intent.getStringExtra(EXTRA_ID), actionType, true);
}
}
/**
* Called when a screenshot has been taken and animation / screenshot UI is about to begin.
*/
public static class ScreenshotTakenReceiver extends BroadcastReceiver {
private final Lazy<BubbleController> mBubbleController;
public ScreenshotTakenReceiver(Lazy<BubbleController> bubbleController) {
mBubbleController = bubbleController;
}
@Override
public void onReceive(Context context, Intent intent) {
mBubbleController.get().hideImeFromExpandedBubble();
}
}
}