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

Commit f065fdf3 authored by thiruram's avatar thiruram Committed by Thiru Ramasamy
Browse files

Updates folder creation logging.

After ag/11020901, folder creation process will not open gboard and hence drag and drop events resulting in folder creation should send additional folder creation event.

Fixes NPE with ItemInfo.java.

Bug: 153768241

Change-Id: I52c996a62dee52bf07feef4252aadc2a28c79752
(cherry picked from commit 9a3671e8)
parent d8cec211
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -332,7 +332,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
                        .map(info -> info.suggestedFolderNames)
                        .map(folderNames -> (FolderNameInfo[]) folderNames
                                .getParcelableArrayExtra(FolderInfo.EXTRA_FOLDER_SUGGESTIONS))
                        .ifPresent(nameInfos -> showLabelSuggestions(nameInfos));
                        .ifPresent(this::showLabelSuggestions);
            }
            mFolderName.setHint("");
            mIsEditingName = true;
@@ -1450,7 +1450,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
            if (hasFocus) {
                startEditingFolderName();
            } else {
                logEditFolderLabel();
                logCurrentFolderLabelState();
                mFolderName.dispatchBackKey();
            }
        }
@@ -1649,7 +1649,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        return mContent;
    }

    private void logEditFolderLabel() {
    protected void logCurrentFolderLabelState() {
        LauncherEvent launcherEvent = LauncherEvent.newBuilder()
                .setAction(Action.newBuilder().setType(Action.Type.SOFT_KEYBOARD))
                .addSrcTarget(newEditTextTargetBuilder()
+1 −1
Original line number Diff line number Diff line
@@ -416,6 +416,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
            mPreviewItemManager.hidePreviewItem(finalIndex, false);
            mFolder.showItem(item);
            setLabelSuggestion(nameInfos);
            mFolder.logCurrentFolderLabelState();
            invalidate();
        }, DROP_IN_ANIMATION_DURATION);
    }
@@ -438,7 +439,6 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
        onTitleChanged(mInfo.title);
        mFolder.mFolderName.setText(mInfo.title);
        mFolder.mLauncher.getModelWriter().updateItemInDatabase(mInfo);
        // TODO: Add logging while folder creation.
    }


+14 −7
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ import com.android.launcher3.Workspace;
import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.util.ContentWriter;

import java.util.Optional;

/**
 * Represents an item in the launcher.
 */
@@ -248,24 +250,29 @@ public class ItemInfo {

        LauncherAtom.ItemInfo.Builder itemBuilder = LauncherAtom.ItemInfo.newBuilder();
        itemBuilder.setIsWork(user != Process.myUserHandle());
        ComponentName cn = getTargetComponent();
        Optional<ComponentName> nullableComponent = Optional.ofNullable(getTargetComponent());
        switch (itemType) {
            case ITEM_TYPE_APPLICATION:
                itemBuilder.setApplication(LauncherAtom.Application.newBuilder()
                        .setComponentName(cn.flattenToShortString())
                        .setPackageName(cn.getPackageName()));
                itemBuilder
                        .setApplication(nullableComponent
                                .map(component -> LauncherAtom.Application.newBuilder()
                                        .setComponentName(component.flattenToShortString())
                                        .setPackageName(component.getPackageName()))
                                .orElse(LauncherAtom.Application.newBuilder()));
                break;
            case ITEM_TYPE_DEEP_SHORTCUT:
            case ITEM_TYPE_SHORTCUT:
                itemBuilder.setShortcut(LauncherAtom.Shortcut.newBuilder()
                        .setShortcutName(cn.flattenToShortString()));
                itemBuilder
                        .setShortcut(nullableComponent
                                .map(component -> LauncherAtom.Shortcut.newBuilder()
                                        .setShortcutName(component.flattenToShortString()))
                                .orElse(LauncherAtom.Shortcut.newBuilder()));
                break;
            case ITEM_TYPE_APPWIDGET:
                setItemBuilder(itemBuilder);
                break;
            default:
                break;

        }
        if (fInfo != null) {
            LauncherAtom.FolderContainer.Builder folderBuilder =