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

Commit 1b169920 authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Adding support for derivative apps to safely extend LauncherLog proto am: 2385ebeb

Change-Id: I127f15b1ef3d7a8a84bfbf471b699ac8c24081bd
parents f20205d2 2385ebeb
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ LOCAL_SRC_FILES := \
    $(call all-java-files-under, src) \
    $(call all-java-files-under, src_config) \
    $(call all-java-files-under, src_flags) \
    $(call all-proto-files-under, protos)
    $(call all-proto-files-under, protos) \
    $(call all-proto-files-under, proto_overrides)

LOCAL_RESOURCE_DIR := \
    $(LOCAL_PATH)/res \
@@ -42,7 +43,7 @@ LOCAL_RESOURCE_DIR := \
LOCAL_PROGUARD_FLAG_FILES := proguard.flags

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

LOCAL_AAPT_FLAGS := \
@@ -66,10 +67,10 @@ include $(BUILD_PACKAGE)
#
include $(CLEAR_VARS)

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

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

LOCAL_MODULE_TAGS := optional
+5 −1
Original line number Diff line number Diff line
@@ -41,7 +41,10 @@ android {
            res.srcDirs = ['res']
            java.srcDirs = ['src', 'src_flags']
            manifest.srcFile 'AndroidManifest-common.xml'
            proto.srcDirs 'protos/'
            proto {
                srcDir 'protos/'
                srcDir 'proto_overrides/'
            }
        }

        androidTest {
@@ -92,6 +95,7 @@ protobuf {
                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"
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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";

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

package userevent;

//
// Use this to add any app specific extensions to the proto.
//
message LauncherEventExtension {
}

message TargetExtension {
}
+5 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
syntax = "proto2";

import "launcher_log_extension.proto";

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

@@ -52,6 +54,7 @@ message Target {
  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;
}

// Used to define what type of item a Target would represent.
@@ -144,7 +147,6 @@ message Action {
//         Action (Touch) + Target + Target
//
message LauncherEvent {

  required Action action = 1;

  // List of targets that touch actions can be operated on.
@@ -157,4 +159,6 @@ message LauncherEvent {

  optional bool is_in_multi_window_mode = 7;
  optional bool is_in_landscape_mode = 8;

  optional LauncherEventExtension extension = 9;
}
+8 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import com.android.launcher3.InfoDropTarget;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.UninstallDropTarget;
import com.android.launcher3.userevent.nano.LauncherLogExtensions.TargetExtension;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
@@ -159,6 +160,13 @@ public class LoggerUtils {
        return t;
    }

    public static Target newTarget(int targetType, TargetExtension extension) {
        Target t = new Target();
        t.type = targetType;
        t.extension = extension;
        return t;
    }

    public static Target newTarget(int targetType) {
        Target t = new Target();
        t.type = targetType;