Removing graying apps in Overview
The reason is that there is no API that reports that an app is grayed.
Not showing DWB toast for apps that ran over their limit because they
shouldn't be in Overview.
Bug: 129067053
Change-Id: Ia04e17aa85ca015b7932496ad5e730fe61b4be69
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 98495db..6eade49 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
@@ -323,9 +323,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>