Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85d15e78 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Adding support for customizing shortcut pinning logic" into tm-qpr-dev

parents 192e7afc 239d6e9b
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="#909090"
      android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>
+1 −1
Original line number Diff line number Diff line
@@ -1947,7 +1947,7 @@ public class Launcher extends StatefulActivity<LauncherState>
        Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT).setComponent(info.componentName);
        setWaitingForResult(PendingRequestArgs.forIntent(REQUEST_CREATE_SHORTCUT, intent, info));
        TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "start: processShortcutFromDrop");
        if (!info.activityInfo.startConfigActivity(this, REQUEST_CREATE_SHORTCUT)) {
        if (!info.getActivityInfo(this).startConfigActivity(this, REQUEST_CREATE_SHORTCUT)) {
            handleActivityResult(REQUEST_CREATE_SHORTCUT, RESULT_CANCELED, null);
        }
    }
+15 −3
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import android.content.ComponentName;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;

import java.util.Optional;

@@ -29,13 +29,20 @@ import java.util.Optional;
 * Meta data that is used for deferred binding. e.g., this object is used to pass information on
 * draggable targets when they are dropped onto the workspace from another container.
 */
public class PendingAddItemInfo extends ItemInfo {
public class PendingAddItemInfo extends ItemInfoWithIcon {

    /**
     * The component that will be created.
     */
    public ComponentName componentName;

    public PendingAddItemInfo() { }

    public PendingAddItemInfo(PendingAddItemInfo info) {
        super(info);
        componentName = info.componentName;
    }

    @Override
    protected String dumpProperties() {
        return super.dumpProperties() + " componentName=" + componentName;
@@ -46,13 +53,18 @@ public class PendingAddItemInfo extends ItemInfo {
     */
    @NonNull
    @Override
    public ItemInfo makeShallowCopy() {
    public PendingAddItemInfo makeShallowCopy() {
        PendingAddItemInfo itemInfo = new PendingAddItemInfo();
        itemInfo.copyFrom(this);
        itemInfo.componentName = this.componentName;
        return itemInfo;
    }

    @Override
    public PendingAddItemInfo clone() {
        return makeShallowCopy();
    }

    @Nullable
    @Override
    public ComponentName getTargetComponent() {
+6 −6
Original line number Diff line number Diff line
@@ -557,6 +557,12 @@ public final class Utilities {
            int width, int height, Object[] outObj) {
        ActivityContext activity = ActivityContext.lookupContext(context);
        LauncherAppState appState = LauncherAppState.getInstance(context);
        if (info instanceof PendingAddShortcutInfo) {
            ShortcutConfigActivityInfo activityInfo =
                    ((PendingAddShortcutInfo) info).getActivityInfo(context);
            outObj[0] = activityInfo;
            return activityInfo.getFullResIcon(appState.getIconCache());
        }
        if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
            LauncherActivityInfo activityInfo = context.getSystemService(LauncherApps.class)
                    .resolveActivity(info.getIntent(), info.user);
@@ -565,12 +571,6 @@ public final class Utilities {
                    .getIconProvider().getIcon(
                            activityInfo, activity.getDeviceProfile().inv.fillResIconDpi);
        } else if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
            if (info instanceof PendingAddShortcutInfo) {
                ShortcutConfigActivityInfo activityInfo =
                        ((PendingAddShortcutInfo) info).activityInfo;
                outObj[0] = activityInfo;
                return activityInfo.getFullResIcon(appState.getIconCache());
            }
            List<ShortcutInfo> si = ShortcutKey.fromItemInfo(info)
                    .buildRequest(context)
                    .query(ShortcutRequest.ALL);
+1 −1
Original line number Diff line number Diff line
@@ -2690,7 +2690,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
    private void onDropExternal(final int[] touchXY, final CellLayout cellLayout, DragObject d) {
        if (d.dragInfo instanceof PendingAddShortcutInfo) {
            WorkspaceItemInfo si = ((PendingAddShortcutInfo) d.dragInfo)
                    .activityInfo.createWorkspaceItemInfo();
                    .getActivityInfo(mLauncher).createWorkspaceItemInfo();
            if (si != null) {
                d.dragInfo = si;
            }
Loading