Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-dev
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 883b029..ecaac94 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -1423,23 +1423,17 @@
}
protected void switchToScreenshot() {
- final int runningTaskId = mGestureState.getRunningTaskId();
- if (LIVE_TILE.get()) {
- if (mRecentsAnimationController != null) {
- mRecentsAnimationController.getController().setWillFinishToHome(true);
- // Update the screenshot of the task
- if (mTaskSnapshot == null) {
- mTaskSnapshot = mRecentsAnimationController.screenshotTask(runningTaskId);
- }
- mRecentsView.updateThumbnail(runningTaskId, mTaskSnapshot, false /* refreshNow */);
- }
- mStateCallback.setStateOnUiThread(STATE_SCREENSHOT_CAPTURED);
- } else if (!hasTargets()) {
+ if (!hasTargets()) {
// If there are no targets, then we don't need to capture anything
mStateCallback.setStateOnUiThread(STATE_SCREENSHOT_CAPTURED);
} else {
+ final int runningTaskId = mGestureState.getRunningTaskId();
+ final boolean refreshView = !LIVE_TILE.get() /* refreshView */;
boolean finishTransitionPosted = false;
if (mRecentsAnimationController != null) {
+ if (LIVE_TILE.get()) {
+ mRecentsAnimationController.getController().setWillFinishToHome(true);
+ }
// Update the screenshot of the task
if (mTaskSnapshot == null) {
UI_HELPER_EXECUTOR.execute(() -> {
@@ -1448,14 +1442,14 @@
mRecentsAnimationController.screenshotTask(runningTaskId);
MAIN_EXECUTOR.execute(() -> {
mTaskSnapshot = taskSnapshot;
- if (!updateThumbnail(runningTaskId)) {
+ if (!updateThumbnail(runningTaskId, refreshView)) {
setScreenshotCapturedState();
}
});
});
return;
}
- finishTransitionPosted = updateThumbnail(runningTaskId);
+ finishTransitionPosted = updateThumbnail(runningTaskId, refreshView);
}
if (!finishTransitionPosted) {
setScreenshotCapturedState();
@@ -1464,17 +1458,17 @@
}
// Returns whether finish transition was posted.
- private boolean updateThumbnail(int runningTaskId) {
+ private boolean updateThumbnail(int runningTaskId, boolean refreshView) {
boolean finishTransitionPosted = false;
final TaskView taskView;
- if (mGestureState.getEndTarget() == HOME) {
- // Capture the screenshot before finishing the transition to home to ensure it's
- // taken in the correct orientation, but no need to update the thumbnail.
+ if (mGestureState.getEndTarget() == HOME || mGestureState.getEndTarget() == NEW_TASK) {
+ // Capture the screenshot before finishing the transition to home or quickswitching to
+ // ensure it's taken in the correct orientation, but no need to update the thumbnail.
taskView = null;
} else {
- taskView = mRecentsView.updateThumbnail(runningTaskId, mTaskSnapshot);
+ taskView = mRecentsView.updateThumbnail(runningTaskId, mTaskSnapshot, refreshView);
}
- if (taskView != null && !mCanceled) {
+ if (taskView != null && refreshView && !mCanceled) {
// Defer finishing the animation until the next launcher frame with the
// new thumbnail
finishTransitionPosted = ViewUtils.postFrameDrawn(taskView,
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index e5ce950..c9e7a73 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -699,11 +699,6 @@
return taskView;
}
- /** See {@link #updateThumbnail(int, ThumbnailData, boolean)} */
- public TaskView updateThumbnail(int taskId, ThumbnailData thumbnailData) {
- return updateThumbnail(taskId, thumbnailData, true /* refreshNow */);
- }
-
@Override
protected void onWindowVisibilityChanged(int visibility) {
super.onWindowVisibilityChanged(visibility);
diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java
index c79dabe..4312939 100644
--- a/src/com/android/launcher3/ExtendedEditText.java
+++ b/src/com/android/launcher3/ExtendedEditText.java
@@ -99,7 +99,7 @@
}
public void hideKeyboard() {
- UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken());
+ UiThreadHelper.hideKeyboardAsync(Launcher.getLauncher(getContext()), getWindowToken());
}
private boolean showSoftInput() {
diff --git a/src/com/android/launcher3/util/UiThreadHelper.java b/src/com/android/launcher3/util/UiThreadHelper.java
index 0498052..be14e01 100644
--- a/src/com/android/launcher3/util/UiThreadHelper.java
+++ b/src/com/android/launcher3/util/UiThreadHelper.java
@@ -17,13 +17,18 @@
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
+import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
+import android.view.WindowInsets;
import android.view.inputmethod.InputMethodManager;
+import com.android.launcher3.Launcher;
+import com.android.launcher3.Utilities;
+
/**
* Utility class for offloading some class from UI thread
*/
@@ -37,8 +42,16 @@
private static final int MSG_SET_ORIENTATION = 2;
private static final int MSG_RUN_COMMAND = 3;
- public static void hideKeyboardAsync(Context context, IBinder token) {
- Message.obtain(HANDLER.get(context), MSG_HIDE_KEYBOARD, token).sendToTarget();
+ @SuppressLint("NewApi")
+ public static void hideKeyboardAsync(Launcher launcher, IBinder token) {
+ if (Utilities.ATLEAST_R) {
+ WindowInsets rootInsets = launcher.getRootView().getRootWindowInsets();
+ boolean isImeShown = rootInsets != null && rootInsets.isVisible(
+ WindowInsets.Type.ime());
+ if (!isImeShown) return;
+ }
+
+ Message.obtain(HANDLER.get(launcher), MSG_HIDE_KEYBOARD, token).sendToTarget();
}
public static void setOrientationAsync(Activity activity, int orientation) {