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

Commit 00002d02 authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Add logging for notifications." into ub-launcher3-master

parents d097f475 c6b79e30
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ enum ItemType {
  DEEPSHORTCUT = 5;
  SEARCHBOX = 6;
  EDITTEXT = 7;
  NOTIFICATION = 8;
}

// Used to define what type of container a Target would represent.
+1 −1
Original line number Diff line number Diff line
@@ -582,8 +582,8 @@ public class DragController implements DragDriver.EventListener, TouchController
            }
        }
        final View dropTargetAsView = dropTarget instanceof View ? (View) dropTarget : null;
        mLauncher.getUserEventDispatcher().logDragNDrop(mDragObject, dropTargetAsView);
        if (!mIsInPreDrag) {
            mLauncher.getUserEventDispatcher().logDragNDrop(mDragObject, dropTargetAsView);
            mDragObject.dragSource.onDropCompleted(
                    dropTargetAsView, mDragObject, flingAnimation != null, accepted);
        }
+22 −5
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.launcher3.logging;

import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Intent;
import android.os.SystemClock;
@@ -112,7 +113,7 @@ public class UserEventDispatcher {
    // intentHash                       required
    // --------------------------------------------------------------

    protected LauncherEvent createLauncherEvent(View v, Intent intent) {
    protected LauncherEvent createLauncherEvent(View v, int intentHashCode, ComponentName cn) {
        LauncherEvent event = newLauncherEvent(newTouchAction(Action.Touch.TAP),
                newItemTarget(v), newTarget(Target.Type.CONTAINER));

@@ -120,8 +121,7 @@ public class UserEventDispatcher {
        int idx = 0;
        if (fillInLogContainerData(event, v)) {
            ItemInfo itemInfo = (ItemInfo) v.getTag();
            event.srcTarget[idx].intentHash = intent.hashCode();
            ComponentName cn = intent.getComponent();
            event.srcTarget[idx].intentHash = intentHashCode;
            if (cn != null) {
                event.srcTarget[idx].packageNameHash = cn.getPackageName().hashCode();
                event.srcTarget[idx].componentHash = cn.hashCode();
@@ -146,13 +146,22 @@ public class UserEventDispatcher {
    }

    public void logAppLaunch(View v, Intent intent) {
        LauncherEvent ev = createLauncherEvent(v, intent);
        LauncherEvent ev = createLauncherEvent(v, intent.hashCode(), intent.getComponent());
        if (ev == null) {
            return;
        }
        dispatchUserEvent(ev, intent);
    }

    public void logNotificationLaunch(View v, PendingIntent intent) {
        ComponentName dummyComponent = new ComponentName(intent.getCreatorPackage(), "--dummy--");
        LauncherEvent ev = createLauncherEvent(v, intent.hashCode(), dummyComponent);
        if (ev == null) {
            return;
        }
        dispatchUserEvent(ev, null);
    }

    public void logActionCommand(int command, int containerType) {
        logActionCommand(command, containerType, 0);
    }
@@ -199,9 +208,17 @@ public class UserEventDispatcher {
        dispatchUserEvent(event, null);
    }

    public void logActionOnItem(int action, int dir, int itemType) {
        Target itemTarget = newTarget(Target.Type.ITEM);
        itemTarget.itemType = itemType;
        LauncherEvent event = newLauncherEvent(newTouchAction(action), itemTarget);
        event.action.dir = dir;
        dispatchUserEvent(event, null);
    }

    public void logDeepShortcutsOpen(View icon) {
        LogContainerProvider provider = getLaunchProviderRecursive(icon);
        if (icon == null && !(icon.getTag() instanceof ItemInfo)) {
        if (icon == null || !(icon.getTag() instanceof ItemInfo)) {
            return;
        }
        ItemInfo info = (ItemInfo) icon.getTag();
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public class NotificationInfo implements View.OnClickListener {
                view, 0, 0, view.getWidth(), view.getHeight()).toBundle();
        try {
            intent.send(null, 0, null, null, null, null, activityOptions);
            launcher.getUserEventDispatcher().logNotificationLaunch(view, intent);
        } catch (PendingIntent.CanceledException e) {
            e.printStackTrace();
        }
+11 −5
Original line number Diff line number Diff line
@@ -29,15 +29,16 @@ import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.R;
import com.android.launcher3.graphics.IconPalette;
import com.android.launcher3.logging.UserEventDispatcher.LogContainerProvider;
import com.android.launcher3.popup.PopupItemView;
import com.android.launcher3.userevent.nano.LauncherLogProto;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static com.android.launcher3.LauncherAnimUtils.animateViewHeight;

@@ -47,7 +48,7 @@ import static com.android.launcher3.LauncherAnimUtils.animateViewHeight;
 * The footer contains: A list of just the icons of all the notifications past the first one.
 * @see NotificationFooterLayout
 */
public class NotificationItemView extends PopupItemView {
public class NotificationItemView extends PopupItemView implements LogContainerProvider {

    private static final Rect sTempRect = new Rect();

@@ -57,7 +58,6 @@ public class NotificationItemView extends PopupItemView {
    private NotificationFooterLayout mFooter;
    private SwipeHelper mSwipeHelper;
    private boolean mAnimatingNextIcon;
    private IconPalette mIconPalette;

    public NotificationItemView(Context context) {
        this(context, null, 0);
@@ -114,7 +114,6 @@ public class NotificationItemView extends PopupItemView {
    }

    public void applyColors(IconPalette iconPalette) {
        mIconPalette = iconPalette;
        setBackgroundTintList(ColorStateList.valueOf(iconPalette.secondaryColor));
        mHeader.setBackgroundTintList(ColorStateList.valueOf(iconPalette.backgroundColor));
        mHeader.setTextColor(ColorStateList.valueOf(iconPalette.textColor));
@@ -174,4 +173,11 @@ public class NotificationItemView extends PopupItemView {
        animation.playSequentially(removeMainView, removeRest);
        return animation;
    }

    @Override
    public void fillInLogContainerData(View v, ItemInfo info, LauncherLogProto.Target target,
            LauncherLogProto.Target targetParent) {
        target.itemType = LauncherLogProto.ItemType.NOTIFICATION;
        targetParent.containerType = LauncherLogProto.ContainerType.DEEPSHORTCUTS;
    }
}
Loading