Removing predicted apps reset on every onResume
Predicted apps should be pushed by the called whenever they change
instead of Launcher polling them on every UI update.
Bug: 67305604
Change-Id: Ibd3d809b09b7d8fd39036f69367e8580fb90dcef
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 9d31492..030d625 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -867,17 +867,10 @@
if (mOnResumeState == State.WORKSPACE) {
showWorkspace(false);
} else if (mOnResumeState == State.APPS) {
- boolean launchedFromApp = (mWaitingForResume != null);
- // Don't update the predicted apps if the user is returning to launcher in the apps
- // view after launching an app, as they may be depending on the UI to be static to
- // switch to another app, otherwise, if it was
- showAppsView(false /* animated */, !launchedFromApp /* updatePredictedApps */);
+ showAppsView(false /* animated */);
} else if (mOnResumeState == State.WIDGETS) {
showWidgetsView(false, false);
}
- if (mOnResumeState != State.APPS) {
- tryAndUpdatePredictedApps();
- }
mOnResumeState = State.NONE;
mPaused = false;
@@ -2108,7 +2101,7 @@
if (!isAppsViewVisible()) {
getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.ALL_APPS_BUTTON);
- showAppsView(true /* animated */, true /* updatePredictedApps */);
+ showAppsView(true /* animated */);
} else {
showWorkspace(true);
}
@@ -2673,11 +2666,8 @@
/**
* Shows the apps view.
*/
- public void showAppsView(boolean animated, boolean updatePredictedApps) {
+ public void showAppsView(boolean animated) {
markAppsViewShown();
- if (updatePredictedApps) {
- tryAndUpdatePredictedApps();
- }
showAppsOrWidgets(State.APPS, animated);
}
@@ -2797,7 +2787,7 @@
public void exitSpringLoadedDragMode() {
if (mState == State.APPS_SPRING_LOADED) {
- showAppsView(true /* animated */, false /* updatePredictedApps */);
+ showAppsView(true /* animated */);
} else if (mState == State.WIDGETS_SPRING_LOADED) {
showWidgetsView(true, false);
} else if (mState == State.WORKSPACE_SPRING_LOADED) {
@@ -2805,19 +2795,6 @@
}
}
- /**
- * Updates the set of predicted apps if it hasn't been updated since the last time Launcher was
- * resumed.
- */
- public void tryAndUpdatePredictedApps() {
- if (mLauncherCallbacks != null) {
- List<ComponentKeyMapper<AppInfo>> apps = mLauncherCallbacks.getPredictedApps();
- if (apps != null) {
- mAppsView.setPredictedApps(apps);
- }
- }
- }
-
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
final boolean result = super.dispatchPopulateAccessibilityEvent(event);
@@ -3532,7 +3509,6 @@
// Update AllApps
if (mAppsView != null) {
mAppsView.removeApps(appInfos);
- tryAndUpdatePredictedApps();
}
}
@@ -3696,7 +3672,7 @@
switch (keyCode) {
case KeyEvent.KEYCODE_A:
if (mState == State.WORKSPACE) {
- showAppsView(true, true);
+ showAppsView(true);
return true;
}
break;
diff --git a/src/com/android/launcher3/LauncherCallbacks.java b/src/com/android/launcher3/LauncherCallbacks.java
index d1e2b62..2c9a23f 100644
--- a/src/com/android/launcher3/LauncherCallbacks.java
+++ b/src/com/android/launcher3/LauncherCallbacks.java
@@ -19,14 +19,10 @@
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
-import android.view.View;
-
-import com.android.launcher3.util.ComponentKeyMapper;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.List;
/**
* LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks
@@ -87,5 +83,4 @@
*/
boolean shouldMoveToDefaultScreenOnHomeIntent();
boolean hasSettings();
- List<ComponentKeyMapper<AppInfo>> getPredictedApps();
}
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 4eba5c6..246a77a 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -115,13 +115,6 @@
}
/**
- * Sets the current set of predicted apps.
- */
- public void setPredictedApps(List<ComponentKeyMapper<AppInfo>> apps) {
- mApps.setPredictedApps(apps);
- }
-
- /**
* Sets the current set of apps.
*/
public void setApps(List<AppInfo> apps) {
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index f249c90..2cc0781 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -216,7 +216,7 @@
Action.Direction.UP,
containerType);
}
- mLauncher.showAppsView(true /* animated */, false /* updatePredictedApps */);
+ mLauncher.showAppsView(true /* animated */);
if (hasSpringAnimationHandler()) {
mSpringAnimationHandler.add(mSearchSpring, true /* setDefaultValues */);
// The icons are moving upwards, so we go to 0 from 1. (y-axis 1 is below 0.)
@@ -239,7 +239,7 @@
Action.Direction.UP,
containerType);
}
- mLauncher.showAppsView(true, /* animated */ false /* updatePredictedApps */);
+ mLauncher.showAppsView(true /* animated */);
}
}
}
@@ -256,10 +256,7 @@
// Initialize values that should not change until #onDragEnd
mStatusBarHeight = mLauncher.getDragLayer().getInsets().top;
mHotseat.setVisibility(View.VISIBLE);
- if (!mLauncher.isAllAppsVisible()) {
- mLauncher.tryAndUpdatePredictedApps();
- mAppsView.setVisibility(View.VISIBLE);
- }
+ mAppsView.setVisibility(View.VISIBLE);
}
}
diff --git a/src/com/android/launcher3/testing/LauncherExtension.java b/src/com/android/launcher3/testing/LauncherExtension.java
index 355963b..a1a4d75 100644
--- a/src/com/android/launcher3/testing/LauncherExtension.java
+++ b/src/com/android/launcher3/testing/LauncherExtension.java
@@ -7,13 +7,10 @@
import com.android.launcher3.AppInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherCallbacks;
-import com.android.launcher3.util.ComponentKey;
-import com.android.launcher3.util.ComponentKeyMapper;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.List;
/**
* This class represents a very trivial LauncherExtension. It primarily serves as a simple
@@ -150,12 +147,6 @@
}
@Override
- public List<ComponentKeyMapper<AppInfo>> getPredictedApps() {
- // To debug app predictions, enable AlphabeticalAppsList#DEBUG_PREDICTIONS
- return new ArrayList<>();
- }
-
- @Override
public void onAttachedToWindow() {
}