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

Commit 9d277a3c authored by Alina Zaidi's avatar Alina Zaidi Committed by Android (Google) Code Review
Browse files

Merge "Add position and dimentions logging to DesktopModeTaskUpdate logs" into main

parents 3d879a03 8d239edc
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -159,13 +159,24 @@ class DesktopModeEventLogger {
    }

    companion object {
        /**
         * Describes a task position and dimensions.
         *
         * @property instanceId instance id of the task
         * @property uid uid of the app associated with the task
         * @property taskHeight height of the task in px
         * @property taskWidth width of the task in px
         * @property taskX x-coordinate of the top-left corner
         * @property taskY y-coordinate of the top-left corner
         *
         */
        data class TaskUpdate(
            val instanceId: Int,
            val uid: Int,
            val taskHeight: Int = Int.MIN_VALUE,
            val taskWidth: Int = Int.MIN_VALUE,
            val taskX: Int = Int.MIN_VALUE,
            val taskY: Int = Int.MIN_VALUE,
            val taskHeight: Int,
            val taskWidth: Int,
            val taskX: Int,
            val taskY: Int,
        )

        /**
+11 −7
Original line number Diff line number Diff line
@@ -228,6 +228,7 @@ class DesktopModeLoggerTransitionObserver(
     * Log the appropriate log event based on the new state of TasksInfos and previously cached
     * state and update it
     */
    // TODO(b/326231724): Trigger logging when task size or position is changed.
    private fun identifyLogEventAndUpdateState(
        transitionInfo: TransitionInfo,
        preTransitionVisibleFreeformTasks: SparseArray<TaskInfo>,
@@ -282,7 +283,6 @@ class DesktopModeLoggerTransitionObserver(
        visibleFreeformTaskInfos.putAll(postTransitionVisibleFreeformTasks)
    }

    // TODO(b/326231724) - Add logging around taskInfoChanges Updates
    /** Compare the old and new state of taskInfos and identify and log the changes */
    private fun identifyAndLogTaskUpdates(
        sessionId: Int,
@@ -304,13 +304,17 @@ class DesktopModeLoggerTransitionObserver(
        }
    }

    // TODO(b/326231724: figure out how to get taskWidth and taskHeight from TaskInfo
    private fun buildTaskUpdateForTask(taskInfo: TaskInfo): TaskUpdate {
        val taskUpdate = TaskUpdate(taskInfo.taskId, taskInfo.userId)
        // add task x, y if available
        taskInfo.positionInParent?.let { taskUpdate.copy(taskX = it.x, taskY = it.y) }

        return taskUpdate
        val screenBounds = taskInfo.configuration.windowConfiguration.bounds
        val positionInParent = taskInfo.positionInParent
        return TaskUpdate(
            instanceId = taskInfo.taskId,
            uid = taskInfo.userId,
            taskHeight = screenBounds.height(),
            taskWidth = screenBounds.width(),
            taskX = positionInParent.x,
            taskY = positionInParent.y,
        )
    }

    /** Get [EnterReason] for this session enter */
+163 −205

File changed.

Preview size limit exceeded, changes collapsed.