Merge "Start saving screenshot in background earlier"
This commit is contained in:
committed by
Android (Google) Code Review
commit
998081581e
@@ -442,27 +442,35 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
|
||||
|
||||
ValueAnimator screenshotDropInAnim = screenRect != null ? createRectAnimation(screenRect)
|
||||
: createScreenshotDropInAnimation();
|
||||
ValueAnimator screenshotFadeOutAnim = createScreenshotToCornerAnimation(w, h);
|
||||
ValueAnimator screenshotToCornerAnimation = createScreenshotToCornerAnimation(w, h);
|
||||
mScreenshotAnimation = new AnimatorSet();
|
||||
mScreenshotAnimation.playSequentially(screenshotDropInAnim, screenshotFadeOutAnim);
|
||||
mScreenshotAnimation.addListener(new AnimatorListenerAdapter() {
|
||||
mScreenshotAnimation.playSequentially(screenshotDropInAnim, screenshotToCornerAnimation);
|
||||
|
||||
saveScreenshotInWorkerThread(finisher, new ActionsReadyListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
// Save the screenshot once we have a bit of time now
|
||||
saveScreenshotInWorkerThread(finisher, new ActionsReadyListener() {
|
||||
@Override
|
||||
void onActionsReady(Uri uri, List<Notification.Action> smartActions,
|
||||
List<Notification.Action> actions) {
|
||||
if (uri == null) {
|
||||
mNotificationsController.notifyScreenshotError(
|
||||
R.string.screenshot_failed_to_capture_text);
|
||||
void onActionsReady(Uri uri, List<Notification.Action> smartActions,
|
||||
List<Notification.Action> actions) {
|
||||
if (uri == null) {
|
||||
mNotificationsController.notifyScreenshotError(
|
||||
R.string.screenshot_failed_to_capture_text);
|
||||
} else {
|
||||
mScreenshotHandler.post(() -> {
|
||||
if (mScreenshotAnimation != null && mScreenshotAnimation.isRunning()) {
|
||||
mScreenshotAnimation.addListener(
|
||||
new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
super.onAnimationEnd(animation);
|
||||
createScreenshotActionsShadeAnimation(
|
||||
smartActions, actions).start();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mScreenshotHandler.post(() ->
|
||||
createScreenshotActionsShadeAnimation(smartActions,
|
||||
actions).start());
|
||||
createScreenshotActionsShadeAnimation(smartActions,
|
||||
actions).start();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
mScreenshotHandler.removeMessages(MESSAGE_CORNER_TIMEOUT);
|
||||
mScreenshotHandler.sendMessageDelayed(
|
||||
mScreenshotHandler.obtainMessage(MESSAGE_CORNER_TIMEOUT),
|
||||
|
||||
@@ -38,7 +38,6 @@ import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
@@ -124,10 +123,6 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
|
||||
return null;
|
||||
}
|
||||
|
||||
// By default, AsyncTask sets the worker thread to have background thread priority,
|
||||
// so bump it back up so that we save a little quicker.
|
||||
Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND);
|
||||
|
||||
ContentResolver resolver = mContext.getContentResolver();
|
||||
Bitmap image = mParams.image;
|
||||
Resources r = mContext.getResources();
|
||||
|
||||
Reference in New Issue
Block a user