summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quickstep/recents_ui_overrides/res/layout/prediction_load_progress.xml11
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java25
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java14
-rw-r--r--quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java4
-rw-r--r--src/com/android/launcher3/Launcher.java4
-rw-r--r--tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java4
-rw-r--r--tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java2
7 files changed, 8 insertions, 56 deletions
diff --git a/quickstep/recents_ui_overrides/res/layout/prediction_load_progress.xml b/quickstep/recents_ui_overrides/res/layout/prediction_load_progress.xml
deleted file mode 100644
index 20c400441..000000000
--- a/quickstep/recents_ui_overrides/res/layout/prediction_load_progress.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
- style="?android:attr/progressBarStyleHorizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginLeft="20dp"
- android:layout_marginRight="20dp"
- android:indeterminate="true"
- android:indeterminateOnly="true"
- android:indeterminateTint="?workspaceTextColor" />
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java
index 55f4c98e9..4a486f8e5 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java
@@ -28,7 +28,6 @@ import android.os.Build;
import android.util.AttributeSet;
import android.util.IntProperty;
import android.util.Log;
-import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Interpolator;
import android.widget.LinearLayout;
@@ -115,8 +114,6 @@ public class PredictionRowView extends LinearLayout implements
private final AnimatedFloat mOverviewScrollFactor =
new AnimatedFloat(this::updateTranslationAndAlpha);
- private View mLoadingProgress;
-
private boolean mPredictionsEnabled = false;
public PredictionRowView(@NonNull Context context) {
@@ -165,7 +162,6 @@ public class PredictionRowView extends LinearLayout implements
public void setup(FloatingHeaderView parent, FloatingHeaderRow[] rows, boolean tabsHidden) {
mParent = parent;
- setPredictionsEnabled(mPredictionUiStateManager.arePredictionsEnabled());
}
private void setPredictionsEnabled(boolean predictionsEnabled) {
@@ -205,7 +201,7 @@ public class PredictionRowView extends LinearLayout implements
@Override
public boolean hasVisibleContent() {
- return mPredictionUiStateManager.arePredictionsEnabled();
+ return mPredictionsEnabled;
}
/**
@@ -241,9 +237,6 @@ public class PredictionRowView extends LinearLayout implements
}
private void applyPredictionApps() {
- if (mLoadingProgress != null) {
- removeView(mLoadingProgress);
- }
if (!mPredictionsEnabled) {
mParent.onHeightUpdated();
return;
@@ -290,15 +283,8 @@ public class PredictionRowView extends LinearLayout implements
}
if (predictionCount == 0) {
- if (mLoadingProgress == null) {
- mLoadingProgress = LayoutInflater.from(getContext())
- .inflate(R.layout.prediction_load_progress, this, false);
- }
- addView(mLoadingProgress);
- } else {
- mLoadingProgress = null;
+ setPredictionsEnabled(false);
}
-
mParent.onHeightUpdated();
}
@@ -342,11 +328,8 @@ public class PredictionRowView extends LinearLayout implements
public void setTextAlpha(int alpha) {
mIconCurrentTextAlpha = alpha;
int iconColor = setColorAlphaBound(mIconTextColor, mIconCurrentTextAlpha);
-
- if (mLoadingProgress == null) {
- for (int i = 0; i < getChildCount(); i++) {
- ((BubbleTextView) getChildAt(i)).setTextColor(iconColor);
- }
+ for (int i = 0; i < getChildCount(); i++) {
+ ((BubbleTextView) getChildAt(i)).setTextColor(iconColor);
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java
index 28ecce07e..64cb4b465 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionUiStateManager.java
@@ -24,7 +24,6 @@ import android.app.prediction.AppPredictor;
import android.app.prediction.AppTarget;
import android.content.ComponentName;
import android.content.Context;
-import android.os.Handler;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import com.android.launcher3.AppInfo;
@@ -63,7 +62,6 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf
OnIDPChangeListener, OnUpdateListener {
public static final String LAST_PREDICTION_ENABLED_STATE = "last_prediction_enabled_state";
- private static final long INITIAL_CALLBACK_WAIT_TIMEOUT_MS = 5000;
// TODO (b/129421797): Update the client constants
public enum Client {
@@ -110,13 +108,8 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf
for (int i = 0; i < mPredictionServicePredictions.length; i++) {
mPredictionServicePredictions[i] = Collections.emptyList();
}
-
mGettingValidPredictionResults = Utilities.getDevicePrefs(context)
.getBoolean(LAST_PREDICTION_ENABLED_STATE, true);
- if (mGettingValidPredictionResults) {
- new Handler().postDelayed(
- this::updatePredictionStateAfterCallback, INITIAL_CALLBACK_WAIT_TIMEOUT_MS);
- }
// Call this last
mCurrentState = parseLastState();
@@ -197,10 +190,7 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf
}
}
- public boolean mDebugHadStateUpdate;
-
private void updatePredictionStateAfterCallback() {
- mDebugHadStateUpdate = true;
boolean validResults = false;
for (List l : mPredictionServicePredictions) {
validResults |= l != null && !l.isEmpty();
@@ -296,10 +286,6 @@ public class PredictionUiStateManager implements OnGlobalLayoutListener, ItemInf
dispatchOnChange(false);
}
- public boolean arePredictionsEnabled() {
- return mCurrentState.isEnabled;
- }
-
private boolean canApplyPredictions(PredictionState newState) {
if (mAppsView == null) {
// If there is no apps view, no need to schedule.
diff --git a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
index c6f7544fe..d9fcf4d97 100644
--- a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
+++ b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
@@ -68,11 +68,7 @@ public class AppPredictionsUITests extends AbstractQuickStepTest {
// Disable app tracker
AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker());
-
PredictionUiStateManager.INSTANCE.initializeForTesting(null);
- waitForLauncherCondition("Prediction never had state update",
- launcher -> PredictionUiStateManager.INSTANCE.get(
- mTargetContext).mDebugHadStateUpdate);
mCallback = PredictionUiStateManager.INSTANCE.get(mTargetContext).appPredictorCallback(
Client.HOME);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 35113d213..a59189bea 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2553,8 +2553,4 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
void onLauncherResume();
}
-
- public boolean debugIsPredictionInitialized() {
- return true;
- }
}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index a19857c78..44401c73c 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -54,6 +54,7 @@ import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.ResourceUtils;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.LauncherAppsCompat;
+import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.tapl.LauncherInstrumentation;
import com.android.launcher3.tapl.TestHelpers;
import com.android.launcher3.util.Wait;
@@ -197,6 +198,9 @@ public abstract class AbstractLauncherUiTest {
@Before
public void setUp() throws Exception {
+ // Disable app tracker
+ AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker());
+
mTargetContext = InstrumentationRegistry.getTargetContext();
mTargetPackage = mTargetContext.getPackageName();
// Unlock the phone
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index d0ea14268..d4cfe3aa2 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -64,8 +64,6 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
test.mDevice.pressHome();
}
test.waitForLauncherCondition("Launcher didn't start", launcher -> launcher != null);
- test.waitForLauncherCondition("Prediction never had state update",
- launcher -> launcher.debugIsPredictionInitialized());
test.waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL);
test.waitForResumed("Launcher internal state is still Background");
// Check that we switched to home.