Merge "Get rid of setInteractionHandler call to the host in launcher" into tm-qpr-dev am: 4421353ce8 am: 82eba8a3bf

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20274922

Change-Id: I1c6327a673d0444d317d5983255c80d2b823d596
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Sihua Ma authored and Automerger Merge Worker committed 2022-10-25 04:01:22 +00:00
commit af210f70fd
5 files changed
+63 -4

No files matched your search

@@ -17,10 +17,18 @@
package com.android.launcher3.uioverrides;
import android.app.Person;
import android.appwidget.AppWidgetHost;
import android.content.pm.ShortcutInfo;
import com.android.launcher3.Utilities;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.launcher3.Utilities;
import com.android.launcher3.widget.LauncherAppWidgetHost;
/**
* A wrapper for the hidden API calls
*/
public class ApiWrapper {
public static final boolean TASKBAR_DRAWN_IN_PROCESS = true;
@@ -29,4 +37,14 @@ public class ApiWrapper {
Person[] persons = si.getPersons();
return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons;
}
/**
* Set the interaction handler for the host
* @param host AppWidgetHost that needs the interaction handler
* @param handler InteractionHandler for the views in the host
*/
public static void setHostInteractionHandler(@NonNull AppWidgetHost host,
@Nullable LauncherAppWidgetHost.LauncherWidgetInteractionHandler handler) {
host.setInteractionHandler(handler::onInteraction);
}
}
@@ -33,10 +33,12 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.util.ActivityOptionsWrapper;
import com.android.launcher3.widget.LauncherAppWidgetHost;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
/** Provides a Quickstep specific animation when launching an activity from an app widget. */
class QuickstepInteractionHandler implements RemoteViews.InteractionHandler {
class QuickstepInteractionHandler implements
LauncherAppWidgetHost.LauncherWidgetInteractionHandler {
private static final String TAG = "QuickstepInteractionHandler";
@@ -490,7 +490,8 @@ public class QuickstepLauncher extends Launcher {
protected LauncherAppWidgetHost createAppWidgetHost() {
LauncherAppWidgetHost appWidgetHost = super.createAppWidgetHost();
appWidgetHost.setInteractionHandler(new QuickstepInteractionHandler(this));
ApiWrapper.setHostInteractionHandler(appWidgetHost,
new QuickstepInteractionHandler(this));
return appWidgetHost;
}