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
This commit is contained in:
Matt Casey
2020-06-09 15:43:56 -04:00
parent 1bee00878d
commit d56eaf68f6
2 changed files with 23 additions and 0 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

@@ -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;
@@ -472,6 +473,8 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
return;
}
mContext.sendBroadcast(new Intent(mContext, ScreenshotTakenReceiver.class));
// Optimizations
mScreenBitmap.setHasAlpha(false);
mScreenBitmap.prepareToDraw();
@@ -1077,4 +1080,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();
}
}
}