Merge "Close screenshot UI on CLOSE_SYSTEM_DIALOGS intent" into rvc-dev am: 703aaba6c6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11908617 Change-Id: I00125bc08fef4a5f1da08b8ce8d16157dd538cce
This commit is contained in:
@@ -622,7 +622,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
|
||||
/**
|
||||
* Clears current screenshot
|
||||
*/
|
||||
private void dismissScreenshot(String reason, boolean immediate) {
|
||||
void dismissScreenshot(String reason, boolean immediate) {
|
||||
Log.v(TAG, "clearing screenshot: " + reason);
|
||||
mScreenshotHandler.removeMessages(MESSAGE_CORNER_TIMEOUT);
|
||||
mScreenshotLayout.getViewTreeObserver().removeOnComputeInternalInsetsListener(this);
|
||||
|
||||
@@ -16,12 +16,17 @@
|
||||
|
||||
package com.android.systemui.screenshot;
|
||||
|
||||
import static android.content.Intent.ACTION_CLOSE_SYSTEM_DIALOGS;
|
||||
|
||||
import static com.android.internal.util.ScreenshotHelper.SCREENSHOT_MSG_PROCESS_COMPLETE;
|
||||
import static com.android.internal.util.ScreenshotHelper.SCREENSHOT_MSG_URI;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Rect;
|
||||
@@ -51,6 +56,16 @@ public class TakeScreenshotService extends Service {
|
||||
private final UserManager mUserManager;
|
||||
private final UiEventLogger mUiEventLogger;
|
||||
|
||||
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (ACTION_CLOSE_SYSTEM_DIALOGS.equals(intent.getAction()) && mScreenshot != null) {
|
||||
mScreenshot.dismissScreenshot("close system dialogs", true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private Handler mHandler = new Handler(Looper.myLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
@@ -119,12 +134,18 @@ public class TakeScreenshotService extends Service {
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
// register broadcast receiver
|
||||
IntentFilter filter = new IntentFilter(ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||
registerReceiver(mBroadcastReceiver, filter);
|
||||
|
||||
return new Messenger(mHandler).getBinder();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUnbind(Intent intent) {
|
||||
if (mScreenshot != null) mScreenshot.stopScreenshot();
|
||||
unregisterReceiver(mBroadcastReceiver);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user