summaryrefslogtreecommitdiffstats
path: root/quickstep
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2019-05-23 16:54:59 -0700
committerSunny Goyal <sunnygoyal@google.com>2019-05-23 17:01:19 -0700
commit9820c05f2bb091762f334269f11061467b4ba6ba (patch)
treeee9b2f5be0ae9efb98a83be9acb8a4d893da48ed /quickstep
parent571e51161cb1e4ab7685aca5b370fba73c5727e6 (diff)
downloadandroid_packages_apps_Trebuchet-9820c05f2bb091762f334269f11061467b4ba6ba.tar.gz
android_packages_apps_Trebuchet-9820c05f2bb091762f334269f11061467b4ba6ba.tar.bz2
android_packages_apps_Trebuchet-9820c05f2bb091762f334269f11061467b4ba6ba.zip
Removing prediciton loading state
Also fixing test flakyness due to delayed prediction loading Bug: 132993129 Bug: 131854153 Change-Id: I85f7afff0e3ee0ca9e40e92e91681f797a0bc2de
Diffstat (limited to 'quickstep')
-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
4 files changed, 4 insertions, 50 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);