Merge "Add overview button handling to Go recents." into ub-launcher3-master
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java
index 19e9cb4..446fb39 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/DigitalWellBeingToast.java
@@ -24,7 +24,6 @@
import android.content.Intent;
import android.content.pm.LauncherApps;
import android.content.pm.LauncherApps.AppUsageLimit;
-import android.content.res.Resources;
import android.icu.text.MeasureFormat;
import android.icu.text.MeasureFormat.FormatWidth;
import android.icu.util.Measure;
@@ -54,7 +53,7 @@
private final LauncherApps mLauncherApps;
public interface InitializeCallback {
- void call(float saturation, String contentDescription);
+ void call(String contentDescription);
}
private static final String TAG = DigitalWellBeingToast.class.getSimpleName();
@@ -84,7 +83,7 @@
if (task.key.userId != UserHandle.myUserId()) {
setVisibility(GONE);
- callback.call(1, task.titleDescription);
+ callback.call(task.titleDescription);
return;
}
@@ -99,7 +98,7 @@
usageLimit != null ? usageLimit.getUsageRemaining() : -1;
post(() -> {
- if (appUsageLimitTimeMs < 0) {
+ if (appUsageLimitTimeMs < 0 || appRemainingTimeMs < 0) {
setVisibility(GONE);
} else {
setVisibility(VISIBLE);
@@ -108,10 +107,8 @@
R.drawable.hourglass_top : R.drawable.hourglass_bottom);
}
- callback.call(
- appUsageLimitTimeMs >= 0 && appRemainingTimeMs <= 0 ? 0 : 1,
- getContentDescriptionForTask(
- task, appUsageLimitTimeMs, appRemainingTimeMs));
+ callback.call(getContentDescriptionForTask(
+ task, appUsageLimitTimeMs, appRemainingTimeMs));
});
});
}
@@ -180,12 +177,9 @@
}
private String getText(long remainingTime) {
- final Resources resources = getResources();
- return (remainingTime <= 0) ?
- resources.getString(R.string.app_in_grayscale) :
- resources.getString(
- R.string.time_left_for_app,
- getRoundedUpToMinuteReadableDuration(remainingTime));
+ return getResources().getString(
+ R.string.time_left_for_app,
+ getRoundedUpToMinuteReadableDuration(remainingTime));
}
public void openAppUsageSettings() {
@@ -209,7 +203,7 @@
private String getContentDescriptionForTask(
Task task, long appUsageLimitTimeMs, long appRemainingTimeMs) {
- return appUsageLimitTimeMs >= 0 ?
+ return appUsageLimitTimeMs >= 0 && appRemainingTimeMs >= 0 ?
getResources().getString(
R.string.task_contents_description_with_remaining_time,
task.titleDescription,
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index 38aaac5..eb17e3e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -322,9 +322,8 @@
}
mDigitalWellBeingToast.initialize(
mTask,
- (saturation, contentDescription) -> {
+ contentDescription -> {
setContentDescription(contentDescription);
- mSnapshotView.setSaturation(saturation);
if (mDigitalWellBeingToast.getVisibility() == VISIBLE) {
getRecentsView().onDigitalWellbeingToastShown();
}
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index f5e8fa8..81565a5 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -55,10 +55,6 @@
escaped form of '<'). [CHAR LIMIT=15] -->
<string name="shorter_duration_less_than_one_minute">< 1 minute</string>
- <!-- Annotation shown on an app card in Recents, telling that the app was switched to a
- grayscale because it ran over its time limit [CHAR LIMIT=25] -->
- <string name="app_in_grayscale">App in grayscale</string>
-
<!-- Annotation shown on an app card in Recents, telling that the app has a usage limit set by
the user, and a given time is left for it today [CHAR LIMIT=22] -->
<string name="time_left_for_app"><xliff:g id="time" example="7 minutes">%1$s</xliff:g> left today</string>
diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
index 8cf1262..234c3bf 100644
--- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
+++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java
@@ -29,7 +29,7 @@
*/
public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
private static final int FLING_SPEED = 1500;
- private static final int FLINGS_FOR_DISMISS_LIMIT = 5;
+ private static final int FLINGS_FOR_DISMISS_LIMIT = 40;
BaseOverview(LauncherInstrumentation launcher) {
super(launcher);
@@ -60,7 +60,7 @@
final BySelector clearAllSelector = mLauncher.getLauncherObjectSelector("clear_all");
for (int i = 0;
i < FLINGS_FOR_DISMISS_LIMIT
- && verifyActiveContainer().findObject(clearAllSelector) == null;
+ && !verifyActiveContainer().hasObject(clearAllSelector);
++i) {
flingForward();
}