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

Commit 6bf68489 authored by thiruram's avatar thiruram
Browse files

Introduces CONTAINER_WIDGETS_TRAY to LauncherSettings.Favorites.

This would log LAUNCHER_ITEM_DRAG_STARTED event when an item is dragged from widgets tray. This also fixes empty component with widget logs.

Sample Log: https://docs.google.com/document/d/1CBP2yTcXdFhPdNG5ZmWFKSgd8mDbMevY-akVlUXPLDo/edit#bookmark=id.bk5w3n8uwhcl

Bug: 152978018
Change-Id: I51d16edae13973d5e62adda0e4efa861fa10dc1b
parent 4ae95beb
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -48,12 +48,16 @@ message ContainerInfo {
    HotseatContainer hotseat = 2;
    FolderContainer folder = 3;
    AllAppsContainer all_apps_container = 4;
    WidgetsContainer widgets_container = 5;
  }
}

message AllAppsContainer {
}

message WidgetsContainer {
}

enum Origin {
  UNKNOWN = 0;
  DEFAULT_LAYOUT = 1;       // icon automatically placed in workspace, folder, hotseat
+4 −0
Original line number Diff line number Diff line
@@ -153,12 +153,16 @@ public class LauncherSettings {
        public static final int CONTAINER_PREDICTION = -102;
        public static final int CONTAINER_HOTSEAT_PREDICTION = -103;
        public static final int CONTAINER_ALL_APPS = -104;
        public static final int CONTAINER_WIDGETS_TRAY = -105;


        public static final String containerToString(int container) {
            switch (container) {
                case CONTAINER_DESKTOP: return "desktop";
                case CONTAINER_HOTSEAT: return "hotseat";
                case CONTAINER_PREDICTION: return "prediction";
                case CONTAINER_ALL_APPS: return "all_apps";
                case CONTAINER_WIDGETS_TRAY: return "widgets_tray";
                default: return String.valueOf(container);
            }
        }
+24 −3
Original line number Diff line number Diff line
@@ -18,12 +18,15 @@ package com.android.launcher3;

import android.content.ComponentName;

import androidx.annotation.Nullable;

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

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.
 * 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 {

@@ -36,4 +39,22 @@ public class PendingAddItemInfo extends ItemInfo {
    protected String dumpProperties() {
        return super.dumpProperties() + " componentName=" + componentName;
    }

    /**
     * Returns shallow copy of the object.
     */
    @Override
    public ItemInfo makeShallowCopy() {
        PendingAddItemInfo itemInfo = new PendingAddItemInfo();
        itemInfo.copyFrom(this);
        itemInfo.componentName = this.componentName;
        return itemInfo;
    }

    @Nullable
    @Override
    public ComponentName getTargetComponent() {
        return Optional.ofNullable(super.getTargetComponent()).orElse(componentName);
    }

}
+9 −4
Original line number Diff line number Diff line
@@ -2438,6 +2438,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
                    // widgets/shortcuts/folders in a slightly different way
                    mLauncher.addPendingItem(pendingInfo, container, screenId, mTargetCell,
                            item.spanX, item.spanY);
                    mStatsLogManager.log(
                            LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
                            d.logInstanceId,
                            d.dragInfo.buildProto(null));
                }
            };
            boolean isWidget = pendingInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET
@@ -2526,13 +2530,14 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
                mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, view, this);
                resetTransitionTransform();
            }
        }
            mStatsLogManager.log(
                    LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
                    d.logInstanceId,
                    d.dragInfo.buildProto(null));
        }

    }

    public Bitmap createWidgetBitmap(ItemInfo widgetInfo, View layout) {
        int[] unScaledSize = estimateItemSize(widgetInfo);
        int visibility = layout.getVisibility();
+6 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APP
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
@@ -342,6 +343,11 @@ public class ItemInfo {
                        .setAllAppsContainer(
                                AllAppsContainer.getDefaultInstance())
                        .build();
            case CONTAINER_WIDGETS_TRAY:
                return ContainerInfo.newBuilder()
                        .setWidgetsContainer(
                                LauncherAtom.WidgetsContainer.getDefaultInstance())
                        .build();
        }
        return ContainerInfo.getDefaultInstance();
    }
Loading