Merge "Add undo snackbar for deleting items" into ub-launcher3-master
diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java
index 196f0cc..517f759 100644
--- a/quickstep/src/com/android/quickstep/RecentsModel.java
+++ b/quickstep/src/com/android/quickstep/RecentsModel.java
@@ -27,6 +27,7 @@
 import android.graphics.drawable.Drawable;
 import android.os.Build;
 import android.os.Bundle;
+import android.os.Handler;
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.util.Log;
@@ -38,6 +39,7 @@
 import com.android.launcher3.R;
 import com.android.launcher3.util.MainThreadInitializedObject;
 import com.android.launcher3.util.Preconditions;
+import com.android.launcher3.util.UiThreadHelper;
 import com.android.systemui.shared.recents.ISystemUiProxy;
 import com.android.systemui.shared.recents.model.IconLoader;
 import com.android.systemui.shared.recents.model.RecentsTaskLoadPlan;
@@ -68,6 +70,7 @@
     private final Context mContext;
     private final RecentsTaskLoader mRecentsTaskLoader;
     private final MainThreadExecutor mMainThreadExecutor;
+    private final Handler mBgHandler;
 
     private RecentsTaskLoadPlan mLastLoadPlan;
     private int mLastLoadPlanId;
@@ -85,6 +88,7 @@
                 (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
         mIsLowRamDevice = activityManager.isLowRamDevice();
         mMainThreadExecutor = new MainThreadExecutor();
+        mBgHandler = new Handler(UiThreadHelper.getBackgroundLooper());
 
         Resources res = context.getResources();
         mRecentsTaskLoader = new RecentsTaskLoader(mContext,
@@ -226,7 +230,7 @@
             // We already stop the loader in UI_HIDDEN, so stop the high res loader as well
             mRecentsTaskLoader.getHighResThumbnailLoader().setVisible(false);
         }
-        mRecentsTaskLoader.onTrimMemory(level);
+        mBgHandler.post(() -> mRecentsTaskLoader.onTrimMemory(level));
     }
 
     public void onOverviewShown(boolean fromHome, String tag) {
diff --git a/tests/Android.mk b/tests/Android.mk
index 8e1f293..80b690f 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -21,7 +21,7 @@
 	androidx-test \
 	androidx.test.uiautomator_uiautomator \
 	mockito-target-minus-junit4 \
-	ub-launcher-aosp-tapl
+	launcher-aosp-tapl
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_FULL_LIBS_MANIFEST_FILES := $(LOCAL_PATH)/AndroidManifest-common.xml
@@ -50,6 +50,6 @@
   ../src/com/android/launcher3/TestProtocol.java
 
 LOCAL_SDK_VERSION := current
-LOCAL_MODULE := ub-launcher-aosp-tapl
+LOCAL_MODULE := launcher-aosp-tapl
 
 include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index c1eba20..d5b2c87 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -18,12 +18,11 @@
 
 import static org.junit.Assert.assertTrue;
 
+import androidx.annotation.NonNull;
 import androidx.test.uiautomator.BySelector;
 import androidx.test.uiautomator.Direction;
 import androidx.test.uiautomator.UiObject2;
 
-import androidx.annotation.NonNull;
-
 import com.android.launcher3.TestProtocol;
 
 /**
@@ -135,16 +134,4 @@
         allAppsContainer.fling(Direction.UP, FLING_SPEED);
         verifyActiveContainer();
     }
-
-    /**
-     * Gets the UI object for AllApps.
-     * Used by NexusLauncherStrategy.openAllApps(). No one else should use it.
-     *
-     * @return container object.
-     */
-    @Deprecated
-    @NonNull
-    public UiObject2 getObjectDeprecated() {
-        return verifyActiveContainer();
-    }
 }
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 09bf403..1066476 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -26,6 +26,7 @@
 import android.app.Instrumentation;
 import android.app.UiAutomation;
 import android.os.Bundle;
+import android.os.Parcelable;
 import android.provider.Settings;
 import android.view.accessibility.AccessibilityEvent;
 
@@ -160,14 +161,14 @@
         }
     }
 
-    private Bundle executeAndWaitForEvent(Runnable command,
+    private Parcelable executeAndWaitForEvent(Runnable command,
             UiAutomation.AccessibilityEventFilter eventFilter, String message) {
         try {
             final AccessibilityEvent event =
                     mInstrumentation.getUiAutomation().executeAndWaitForEvent(
                             command, eventFilter, WAIT_TIME_MS);
             assertNotNull("executeAndWaitForEvent returned null (this can't happen)", event);
-            return (Bundle) event.getParcelableData();
+            return event.getParcelableData();
         } catch (TimeoutException e) {
             fail(message);
             return null;
@@ -177,7 +178,7 @@
     Bundle getAnswerFromLauncher(UiObject2 view, String requestTag) {
         // Send a fake set-text request to Launcher to initiate a response with requested data.
         final String responseTag = requestTag + TestProtocol.RESPONSE_MESSAGE_POSTFIX;
-        return executeAndWaitForEvent(
+        return (Bundle) executeAndWaitForEvent(
                 () -> view.setText(requestTag),
                 event -> responseTag.equals(event.getClassName()),
                 "Launcher didn't respond to request: " + requestTag);