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

Commit 95786e07 authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Good riddance UserEventDispatcher

Bug: 165675920
Bug: 161381246

TL;DR;;
- nano -> lite proto
- add all the missing logs to WW
- pin item related logging fix
- Removed logging for assistant

sgrep "com.android.launcher3.userevent.nano." | cut -f1 -d: | xargs sed -i -e 's/userevent\.nano\./userevent\./g'

Change-Id: Ie2a49fdd891cacbd7ef40a1dc9e41ff0574c7517
parent 380d603f
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -36,18 +36,12 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
    launcher_log_protos_lite

LOCAL_SRC_FILES := \
    $(call all-proto-files-under, protos) \
    $(call all-proto-files-under, proto_overrides) \
    $(call all-java-files-under, src_build_config) \

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res

LOCAL_PROGUARD_ENABLED := disabled

LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/ --proto_path=$(LOCAL_PATH)/proto_overrides/
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java

LOCAL_SDK_VERSION := current
LOCAL_MIN_SDK_VERSION := 26
LOCAL_MODULE := Launcher3CommonDepsLib
@@ -135,7 +129,6 @@ LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES := \
    SystemUI-statsd \
    SystemUISharedLib \
    launcherprotosnano \
    launcher_log_protos_lite
ifneq (,$(wildcard frameworks/base))
  LOCAL_PRIVATE_PLATFORM_APIS := true
@@ -203,7 +196,6 @@ LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES := \
    SystemUI-statsd \
    SystemUISharedLib \
    launcherprotosnano \
    launcher_log_protos_lite
ifneq (,$(wildcard frameworks/base))
  LOCAL_PRIVATE_PLATFORM_APIS := true
+9 −15
Original line number Diff line number Diff line
@@ -82,7 +82,6 @@ android {
            manifest.srcFile 'AndroidManifest-common.xml'
            proto {
                srcDir 'protos/'
                srcDir 'proto_overrides/'
            }
        }

@@ -150,7 +149,6 @@ dependencies {
    implementation "androidx.preference:preference:${ANDROID_X_VERSION}"
    implementation project(':IconLoader')
    withQuickstepImplementation project(':SharedLibWrapper')
    implementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'launcher_protos.jar')

    // Recents lib dependency
    withQuickstepImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/quickstep/libs", include: 'sysui_shared.jar')
@@ -171,18 +169,14 @@ dependencies {
protobuf {
    // Configure the protoc executable
    protoc {
        artifact = 'com.google.protobuf:protoc:3.0.0'

        artifact = "com.google.protobuf:protoc:${protocVersion}"
    }
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                remove java
                    javanano {
                        option "java_package=launcher_log_extension.proto|com.android.launcher3.userevent.nano"
                        option "java_package=launcher_log.proto|com.android.launcher3.userevent.nano"
                        option "java_package=launcher_dump.proto|com.android.launcher3.model.nano"
                        option "enum_style=java"
                    }
                java {
                    option "lite"
                }
            }
        }

protos/launcher_log.proto

deleted100644 → 0
+0 −245
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
syntax = "proto2";

import "launcher_log_extension.proto";

option java_package = "com.android.launcher3.userevent";
option java_outer_classname = "LauncherLogProto";

package userevent;

message Target {
  enum Type {
    NONE = 0;
    ITEM = 1;
    CONTROL = 2;
    CONTAINER = 3;
  }

  optional Type type = 1;

  // For container type and item type
  // Used mainly for ContainerType.FOLDER, ItemType.*
  optional int32 page_index = 2;
  optional int32 rank = 3;
  optional int32 grid_x = 4;
  optional int32 grid_y = 5;

  // For container types only
  optional ContainerType container_type = 6;
  optional int32 cardinality = 7;

  // For control types only
  optional ControlType control_type = 8;

  // For item types only
  optional ItemType item_type = 9;
  optional int32 package_name_hash = 10;
  optional int32 component_hash = 11;      // Used for ItemType.WIDGET
  optional int32 intent_hash = 12;         // Used for ItemType.SHORTCUT
  optional int32 span_x = 13 [default = 1];// Used for ItemType.WIDGET
  optional int32 span_y = 14 [default = 1];// Used for ItemType.WIDGET
  optional int32 predictedRank = 15;
  optional TargetExtension extension = 16;
  optional TipType tip_type = 17;
  optional int32 search_query_length = 18;
  optional bool is_work_app = 19;
  optional FromFolderLabelState from_folder_label_state = 20;
  optional ToFolderLabelState to_folder_label_state = 21;

  // Note: proto does not support duplicate enum values, even if they belong to different enum type.
  // Hence "FROM" and "TO" prefix added.
  enum FromFolderLabelState {
    FROM_FOLDER_LABEL_STATE_UNSPECIFIED = 0;
    FROM_EMPTY = 1;
    FROM_CUSTOM = 2;
    FROM_SUGGESTED = 3;
  }

  enum ToFolderLabelState {
    TO_FOLDER_LABEL_STATE_UNSPECIFIED = 0;
    TO_SUGGESTION0_WITH_VALID_PRIMARY = 1;
    TO_SUGGESTION1_WITH_VALID_PRIMARY = 2;
    TO_SUGGESTION1_WITH_EMPTY_PRIMARY = 3;
    TO_SUGGESTION2_WITH_VALID_PRIMARY = 4;
    TO_SUGGESTION2_WITH_EMPTY_PRIMARY = 5;
    TO_SUGGESTION3_WITH_VALID_PRIMARY = 6;
    TO_SUGGESTION3_WITH_EMPTY_PRIMARY = 7;
    TO_EMPTY_WITH_VALID_SUGGESTIONS = 8 [deprecated = true];
    TO_EMPTY_WITH_VALID_PRIMARY = 15;
    TO_EMPTY_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY = 16;
    TO_EMPTY_WITH_EMPTY_SUGGESTIONS = 9;
    TO_EMPTY_WITH_SUGGESTIONS_DISABLED = 10;
    TO_CUSTOM_WITH_VALID_SUGGESTIONS = 11 [deprecated = true];
    TO_CUSTOM_WITH_VALID_PRIMARY = 17;
    TO_CUSTOM_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY = 18;
    TO_CUSTOM_WITH_EMPTY_SUGGESTIONS = 12;
    TO_CUSTOM_WITH_SUGGESTIONS_DISABLED = 13;
    UNCHANGED = 14;
  }
}

// Used to define what type of item a Target would represent.
enum ItemType {
  DEFAULT_ITEMTYPE = 0;
  APP_ICON = 1;
  SHORTCUT = 2;
  WIDGET = 3;
  FOLDER_ICON = 4;
  DEEPSHORTCUT = 5;
  SEARCHBOX = 6;
  EDITTEXT = 7;
  NOTIFICATION = 8;
  TASK = 9;         // Each page of Recents UI (QuickStep)
  WEB_APP = 10;
  TASK_ICON = 11;
}

// Used to define what type of container a Target would represent.
enum ContainerType {
  DEFAULT_CONTAINERTYPE = 0;
  WORKSPACE = 1;
  HOTSEAT = 2;
  FOLDER = 3;
  ALLAPPS = 4;
  WIDGETS = 5;
  OVERVIEW = 6;   // Zoomed out workspace (without QuickStep)
  PREDICTION = 7;
  SEARCHRESULT = 8;
  DEEPSHORTCUTS = 9;
  PINITEM = 10;    // confirmation screen
  NAVBAR = 11;
  TASKSWITCHER = 12; // Recents UI Container (QuickStep)
  APP = 13; // Foreground activity is another app (QuickStep)
  TIP = 14; // Onboarding texts (QuickStep)
  OTHER_LAUNCHER_APP = 15;
}

// Used to define what type of control a Target would represent.
enum ControlType {
  DEFAULT_CONTROLTYPE = 0;
  ALL_APPS_BUTTON = 1;
  WIDGETS_BUTTON = 2;
  WALLPAPER_BUTTON = 3;
  SETTINGS_BUTTON = 4;
  REMOVE_TARGET = 5;
  UNINSTALL_TARGET = 6;
  APPINFO_TARGET = 7;
  RESIZE_HANDLE = 8;
  VERTICAL_SCROLL = 9;
  HOME_INTENT = 10; // Deprecated, use enum Command instead
  BACK_BUTTON = 11;
  QUICK_SCRUB_BUTTON = 12;
  CLEAR_ALL_BUTTON = 13;
  CANCEL_TARGET = 14;
  TASK_PREVIEW = 15;
  SPLIT_SCREEN_TARGET = 16;
  REMOTE_ACTION_SHORTCUT = 17;
  APP_USAGE_SETTINGS = 18;
  BACK_GESTURE = 19;
  UNDO = 20;
  DISMISS_PREDICTION = 21;
  HYBRID_HOTSEAT_ACCEPTED = 22;
  HYBRID_HOTSEAT_CANCELED = 23;
  OVERVIEW_ACTIONS_SHARE_BUTTON = 24;
  OVERVIEW_ACTIONS_SCREENSHOT_BUTTON = 25;
  OVERVIEW_ACTIONS_SELECT_BUTTON = 26;
  SELECT_MODE_CLOSE_BUTTON = 27;
  SELECT_MODE_ITEM = 28;
}

enum TipType {
  DEFAULT_NONE = 0;
  BOUNCE = 1;
  SWIPE_UP_TEXT = 2;
  QUICK_SCRUB_TEXT = 3;
  PREDICTION_TEXT = 4;
  DWB_TOAST = 5;
  HYBRID_HOTSEAT = 6;
}

// Used to define the action component of the LauncherEvent.
message Action {
  enum Type {
    TOUCH = 0;
    AUTOMATED = 1;
    COMMAND = 2;
    TIP = 3;
    SOFT_KEYBOARD = 4;
    // HARD_KEYBOARD, ASSIST
  }

  enum Touch {
    TAP = 0;
    LONGPRESS = 1;
    DRAGDROP = 2;
    SWIPE = 3;
    FLING = 4;
    PINCH = 5;
    SWIPE_NOOP = 6;
  }

  enum Direction {
    NONE = 0;
    UP = 1;
    DOWN = 2;
    LEFT = 3;
    RIGHT = 4;
    UPRIGHT = 5;
    UPLEFT = 6;
  }
  enum Command {
    HOME_INTENT = 0;
    BACK = 1;
    ENTRY = 2;          // Indicates entry to one of Launcher container type target
                        // not using the HOME_INTENT
    CANCEL = 3;         // Indicates that a confirmation screen was cancelled
    CONFIRM = 4;        // Indicates thata confirmation screen was accepted
    STOP = 5;           // Indicates onStop() was called (screen time out, power off)
    RECENTS_BUTTON = 6; // Indicates that Recents button was pressed
    RESUME = 7;         // Indicates onResume() was called
  }

  optional Type type = 1;
  optional Touch touch = 2;
  optional Direction dir = 3;
  optional Command command = 4;
  // Log if the action was performed on outside of the container
  optional bool is_outside = 5;
  optional bool is_state_change = 6;
}

//
// Context free grammar of typical user interaction:
//         Action (Touch) + Target
//         Action (Touch) + Target + Target
//
message LauncherEvent {
  required Action action = 1;
  // List of targets that touch actions can be operated on.
  repeated Target src_target = 2;
  repeated Target dest_target = 3;

  optional int64 action_duration_millis = 4;
  optional int64 elapsed_container_millis = 5;
  optional int64 elapsed_session_millis = 6;

  optional bool is_in_multi_window_mode = 7 [deprecated = true];
  optional bool is_in_landscape_mode = 8 [deprecated = true];

  optional LauncherEventExtension extension = 9;
}
+1 −30
Original line number Diff line number Diff line
@@ -16,11 +16,8 @@

package com.android.launcher3.appprediction;

import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.launcher3.logging.LoggerUtils.newTarget;

import android.annotation.TargetApi;
import android.content.Context;
@@ -43,7 +40,6 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.allapps.AllAppsSectionDecorator;
import com.android.launcher3.allapps.FloatingHeaderRow;
@@ -53,13 +49,11 @@ import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.keyboard.FocusIndicatorHelper;
import com.android.launcher3.keyboard.FocusIndicatorHelper.SimpleFocusIndicatorHelper;
import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.Themes;
import com.android.quickstep.AnimatedFloat;

@@ -68,7 +62,7 @@ import java.util.List;

@TargetApi(Build.VERSION_CODES.P)
public class PredictionRowView extends LinearLayout implements
        LogContainerProvider, OnDeviceProfileChangeListener, FloatingHeaderRow {
        OnDeviceProfileChangeListener, FloatingHeaderRow {

    private static final IntProperty<PredictionRowView> TEXT_ALPHA =
            new IntProperty<PredictionRowView>("textAlpha") {
@@ -271,29 +265,6 @@ public class PredictionRowView extends LinearLayout implements
        mParent.onHeightUpdated();
    }

    @Override
    public void fillInLogContainerData(ItemInfo childInfo, LauncherLogProto.Target child,
            ArrayList<LauncherLogProto.Target> parents) {
        for (int i = 0; i < mPredictedApps.size(); i++) {
            ItemInfoWithIcon appInfo = mPredictedApps.get(i);
            if (appInfo == childInfo) {
                child.predictedRank = i;
                break;
            }
        }
        parents.add(newContainerTarget(LauncherLogProto.ContainerType.PREDICTION));

        // include where the prediction is coming this used to be Launcher#modifyUserEvent
        LauncherLogProto.Target parent = newTarget(LauncherLogProto.Target.Type.CONTAINER);
        LauncherState state = mLauncher.getStateManager().getState();
        if (state == LauncherState.ALL_APPS) {
            parent.containerType = LauncherLogProto.ContainerType.ALLAPPS;
        } else if (state == OVERVIEW) {
            parent.containerType = LauncherLogProto.ContainerType.TASKSWITCHER;
        }
        parents.add(parent);
    }

    public void setTextAlpha(int textAlpha) {
        mIconLastSetTextAlpha = textAlpha;
        if (getAlpha() < 1 && textAlpha > 0) {
+0 −1
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.uioverrides.PredictedAppIcon;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.OnboardingPrefs;
import com.android.launcher3.views.ArrowTipView;
import com.android.launcher3.views.Snackbar;
Loading