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

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

Updates launcher_atom.proto to support consistent logging for launcher containers.

* Updated default of some fields to invalid values. Because when these fields are not actually set on the client, the default values could lead to misinterpretations on the server side.
* Refactored container messages into a separate oneof message to use it on the client side as interface.

Test: Manual (make NexusLauncherDebug -j100)
Bug: 144124838

Change-Id: I2d2ea05e9d7d043682d8ca1a56a238d9d22174bb
parent e8269b39
Loading
Loading
Loading
Loading
+26 −18
Original line number Diff line number Diff line
@@ -34,13 +34,23 @@ message ItemInfo {
  optional bool is_work = 6;

  // Item can be child node to parent container or parent containers (nested)
  optional ContainerInfo container_info = 7;

  // Stores the origin of the Item
  optional Origin source = 8;
}

// Represents various launcher surface where items are placed.
message ContainerInfo {
  oneof Container {
    WorkspaceContainer workspace = 7;
    HotseatContainer hotseat = 8;
    FolderContainer folder = 9;
    WorkspaceContainer workspace = 1;
    HotseatContainer hotseat = 2;
    FolderContainer folder = 3;
    AllAppsContainer all_apps_container = 4;
  }
  // Stores the origin of the Item
  optional Origin source = 10;
}

message AllAppsContainer {
}

enum Origin {
@@ -68,8 +78,8 @@ message Shortcut {

// AppWidgets handled by AppWidgetManager
message Widget {
  optional int32 span_x = 1;
  optional int32 span_y = 2;
  optional int32 span_x = 1 [default = 1];
  optional int32 span_y = 2 [default = 1];
  optional int32 app_widget_id = 3;
  optional string package_name = 4; // only populated during snapshot if from workspace
  optional string component_name = 5; // only populated during snapshot if from workspace
@@ -86,9 +96,9 @@ message Task {
// Containers

message WorkspaceContainer {
  optional int32 page_index = 1; // range [-1, l], 0 is the index of the main homescreen
  optional int32 grid_x = 2;     // [0, m], m varies based on the display density and resolution
  optional int32 grid_y = 3;     // [0, n], n varies based on the display density and resolution
  optional int32 page_index = 1 [default = -2]; // range [-1, l], 0 is the index of the main homescreen
  optional int32 grid_x = 2 [default = -1]; // [0, m], m varies based on the display density and resolution
  optional int32 grid_y = 3 [default = -1]; // [0, n], n varies based on the display density and resolution
}

message HotseatContainer {
@@ -96,13 +106,11 @@ message HotseatContainer {
}

message FolderContainer {
  optional int32 page_index = 1;
  optional int32 grid_x = 2;
  optional int32 grid_y = 3;
  oneof Container {
  optional int32 page_index = 1 [default = -1];
  optional int32 grid_x = 2 [default = -1];
  optional int32 grid_y = 3 [default = -1];
  oneof ParentContainer {
    WorkspaceContainer workspace = 4;
    HotseatContainer hotseat = 5;
  }
}

+11 −7
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.Workspace;
import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
import com.android.launcher3.util.ContentWriter;

import java.util.Optional;
@@ -290,18 +291,21 @@ public class ItemInfo {
                            .setGridX(fInfo.cellX).setGridY(fInfo.cellY));
                    break;
            }
            itemBuilder.setFolder(folderBuilder);
            itemBuilder.setContainerInfo(ContainerInfo.newBuilder().setFolder(folderBuilder));
        } else {
            switch (container) {
                case CONTAINER_HOTSEAT:
                    itemBuilder.setHotseat(LauncherAtom.HotseatContainer.newBuilder()
                            .setIndex(screenId));
                    itemBuilder.setContainerInfo(
                            ContainerInfo.newBuilder().setHotseat(
                                    LauncherAtom.HotseatContainer.newBuilder().setIndex(screenId)));
                    break;
                case CONTAINER_DESKTOP:
                    itemBuilder.setWorkspace(LauncherAtom.WorkspaceContainer.newBuilder()
                    itemBuilder.setContainerInfo(
                            ContainerInfo.newBuilder().setWorkspace(
                                    LauncherAtom.WorkspaceContainer.newBuilder()
                                            .setGridX(cellX)
                                            .setGridY(cellY)
                            .setPageIndex(screenId));
                                            .setPageIndex(screenId)));
                    break;
            }
        }