Add a bubble option to launcher long press menus

- Add a launcher "system shortcut" to bubble deep shortcuts or apps
- For shortcuts, save the shortcut info to use to produce the bubble
- Add an interface so that the system shortcut can call through to
  sysui proxy

Flag: com.android.wm.shell.enable_bubble_anything
Test: manual - enable the flag and try to bubble a shortcut via the
               longpress menu on launcher
             - try bubbling an app on launcher
             - try bubbling an app from the taskbar
Bug: 342245211
Change-Id: I1ef49e1628ba0be9cea05073ecd9cd66bf67f88f
This commit is contained in:
Mady Mellor
2024-02-05 09:30:03 -08:00
parent a5fa9bc911
commit 1cc100844c
8 changed files with 179 additions and 8 deletions
@@ -16,19 +16,24 @@
package com.android.launcher3.taskbar;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ShortcutInfo;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
import com.android.quickstep.SystemUiProxy;
import java.util.ArrayList;
import java.util.List;
// TODO(b/218912746): Share more behavior to avoid all apps context depending directly on taskbar.
/** Base for common behavior between taskbar window contexts. */
public abstract class BaseTaskbarContext extends ContextThemeWrapper implements ActivityContext {
public abstract class BaseTaskbarContext extends ContextThemeWrapper implements ActivityContext,
SystemShortcut.BubbleActivityStarter {
protected final LayoutInflater mLayoutInflater;
private final List<OnDeviceProfileChangeListener> mDPChangeListeners = new ArrayList<>();
@@ -48,6 +53,18 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements
return mDPChangeListeners;
}
@Override
public void showShortcutBubble(ShortcutInfo info) {
if (info == null) return;
SystemUiProxy.INSTANCE.get(this).showShortcutBubble(info);
}
@Override
public void showAppBubble(Intent intent) {
if (intent == null || intent.getPackage() == null) return;
SystemUiProxy.INSTANCE.get(this).showAppBubble(intent);
}
/** Callback invoked when a drag is initiated within this context. */
public abstract void onDragStart();