Merge "Make Markup fade in from screenshots" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f34c9ede73
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.systemui.screenshot;
|
||||
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.systemui.screenshot.ScreenshotController.ACTION_TYPE_EDIT;
|
||||
import static com.android.systemui.screenshot.ScreenshotController.ACTION_TYPE_SHARE;
|
||||
import static com.android.systemui.screenshot.ScreenshotController.EXTRA_ACTION_INTENT;
|
||||
@@ -30,6 +32,8 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.RemoteAnimationAdapter;
|
||||
import android.view.WindowManagerGlobal;
|
||||
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
@@ -69,6 +73,16 @@ public class ActionProxyReceiver extends BroadcastReceiver {
|
||||
intent.getBooleanExtra(EXTRA_DISALLOW_ENTER_PIP, false));
|
||||
try {
|
||||
actionIntent.send(context, 0, null, null, null, null, opts.toBundle());
|
||||
if (intent.getBooleanExtra(ScreenshotController.EXTRA_OVERRIDE_TRANSITION, false)) {
|
||||
RemoteAnimationAdapter runner = new RemoteAnimationAdapter(
|
||||
ScreenshotController.SCREENSHOT_REMOTE_RUNNER, 0, 0);
|
||||
try {
|
||||
WindowManagerGlobal.getWindowManagerService()
|
||||
.overridePendingAppTransitionRemote(runner, DEFAULT_DISPLAY);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error overriding screenshot app transition", e);
|
||||
}
|
||||
}
|
||||
} catch (PendingIntent.CanceledException e) {
|
||||
Log.e(TAG, "Pending intent canceled", e);
|
||||
}
|
||||
|
||||
@@ -319,6 +319,7 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
|
||||
.putExtra(ScreenshotController.EXTRA_ID, mScreenshotId)
|
||||
.putExtra(ScreenshotController.EXTRA_SMART_ACTIONS_ENABLED,
|
||||
mSmartActionsEnabled)
|
||||
.putExtra(ScreenshotController.EXTRA_OVERRIDE_TRANSITION, true)
|
||||
.setAction(Intent.ACTION_EDIT)
|
||||
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND),
|
||||
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE,
|
||||
|
||||
@@ -53,14 +53,18 @@ import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.Display;
|
||||
import android.view.DisplayAddress;
|
||||
import android.view.IRemoteAnimationFinishedCallback;
|
||||
import android.view.IRemoteAnimationRunner;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
import android.view.ScrollCaptureResponse;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.View;
|
||||
@@ -105,6 +109,31 @@ public class ScreenshotController {
|
||||
private ScrollCaptureResponse mLastScrollCaptureResponse;
|
||||
private ListenableFuture<ScrollCaptureResponse> mLastScrollCaptureRequest;
|
||||
|
||||
/**
|
||||
* This is effectively a no-op, but we need something non-null to pass in, in order to
|
||||
* successfully override the pending activity entrance animation.
|
||||
*/
|
||||
static final IRemoteAnimationRunner.Stub SCREENSHOT_REMOTE_RUNNER =
|
||||
new IRemoteAnimationRunner.Stub() {
|
||||
@Override
|
||||
public void onAnimationStart(
|
||||
@WindowManager.TransitionOldType int transit,
|
||||
RemoteAnimationTarget[] apps,
|
||||
RemoteAnimationTarget[] wallpapers,
|
||||
RemoteAnimationTarget[] nonApps,
|
||||
final IRemoteAnimationFinishedCallback finishedCallback) {
|
||||
try {
|
||||
finishedCallback.onAnimationFinished();
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error finishing screenshot remote animation", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancelled() {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* POD used in the AsyncTask which saves an image in the background.
|
||||
*/
|
||||
@@ -182,6 +211,7 @@ public class ScreenshotController {
|
||||
static final String ACTION_TYPE_SHARE = "Share";
|
||||
static final String ACTION_TYPE_EDIT = "Edit";
|
||||
static final String EXTRA_SMART_ACTIONS_ENABLED = "android:smart_actions_enabled";
|
||||
static final String EXTRA_OVERRIDE_TRANSITION = "android:screenshot_override_transition";
|
||||
static final String EXTRA_ACTION_INTENT = "android:screenshot_action_intent";
|
||||
|
||||
static final String SCREENSHOT_URI_ID = "android:screenshot_uri_id";
|
||||
@@ -542,7 +572,7 @@ public class ScreenshotController {
|
||||
mScreenshotHandler.postDelayed(this::requestScrollCapture, 150);
|
||||
mScreenshotView.updateDisplayCutoutMargins(
|
||||
mWindowManager.getCurrentWindowMetrics().getWindowInsets()
|
||||
.getDisplayCutout());
|
||||
.getDisplayCutout());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user