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

Commit 8d239edc authored by Alina Zaidi's avatar Alina Zaidi
Browse files

Add position and dimentions logging to DesktopModeTaskUpdate logs

Bug: 326231724
Flag: EXEMPT not a major change
Test: Tested locally, added unit tests
Change-Id: I0fdf3c833680f6859c8236cb02288c20459328d4
parent 898c324c
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.