Loading quickstep/res/layout/task_thumbnail.xml +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:importantForAccessibility="no" android:scaleType="matrix" android:visibility="gone"/> <com.android.quickstep.task.thumbnail.LiveTileView Loading quickstep/src/com/android/quickstep/TaskOverlayFactory.java +5 −1 Original line number Diff line number Diff line Loading @@ -184,6 +184,10 @@ public class TaskOverlayFactory implements ResourceBasedOverride { return mTaskContainer.getTaskView(); } public View getSnapshotView() { return mTaskContainer.getSnapshotView(); } /** * Called when the current task is interactive for the user */ Loading Loading @@ -312,7 +316,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { // the difference between the bitmap bounds and the projected view bounds. Matrix boundsToBitmapSpace = new Matrix(); Matrix thumbnailMatrix = enableRefactorTaskThumbnail() ? mHelper.getEnabledState().getThumbnailMatrix() ? mHelper.getThumbnailMatrix() : mTaskContainer.getThumbnailViewDeprecated().getThumbnailMatrix(); thumbnailMatrix.invert(boundsToBitmapSpace); RectF boundsInBitmapSpace = new RectF(); Loading quickstep/src/com/android/quickstep/recents/usecase/GetThumbnailPositionUseCase.kt 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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. */ package com.android.quickstep.recents.usecase import android.graphics.Matrix import android.graphics.Rect import com.android.quickstep.recents.data.RecentTasksRepository import com.android.quickstep.recents.data.RecentsDeviceProfileRepository import com.android.quickstep.recents.data.RecentsRotationStateRepository import com.android.quickstep.recents.usecase.ThumbnailPositionState.MatrixScaling import com.android.quickstep.recents.usecase.ThumbnailPositionState.MissingThumbnail import com.android.systemui.shared.recents.utilities.PreviewPositionHelper import kotlinx.coroutines.flow.firstOrNull /** Use case for retrieving [Matrix] for positioning Thumbnail in a View */ class GetThumbnailPositionUseCase( private val deviceProfileRepository: RecentsDeviceProfileRepository, private val rotationStateRepository: RecentsRotationStateRepository, private val tasksRepository: RecentTasksRepository, private val previewPositionHelper: PreviewPositionHelper = PreviewPositionHelper() ) { suspend fun run(taskId: Int, width: Int, height: Int, isRtl: Boolean): ThumbnailPositionState { val thumbnailData = tasksRepository.getThumbnailById(taskId).firstOrNull() ?: return MissingThumbnail val thumbnail = thumbnailData.thumbnail ?: return MissingThumbnail previewPositionHelper.updateThumbnailMatrix( Rect(0, 0, thumbnail.width, thumbnail.height), thumbnailData, width, height, deviceProfileRepository.getRecentsDeviceProfile().isLargeScreen, rotationStateRepository.getRecentsRotationState().activityRotation, isRtl ) return MatrixScaling( previewPositionHelper.matrix, previewPositionHelper.isOrientationChanged ) } } quickstep/src/com/android/quickstep/task/util/GetThumbnailUseCase.kt→quickstep/src/com/android/quickstep/recents/usecase/GetThumbnailUseCase.kt +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ package com.android.quickstep.task.util package com.android.quickstep.recents.usecase import android.graphics.Bitmap import com.android.quickstep.recents.data.RecentTasksRepository Loading quickstep/src/com/android/quickstep/recents/usecase/ThumbnailPositionState.kt 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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. */ package com.android.quickstep.recents.usecase import android.graphics.Matrix /** State on how a task Thumbnail can fit on given canvas */ sealed class ThumbnailPositionState { data object MissingThumbnail : ThumbnailPositionState() data class MatrixScaling(val matrix: Matrix, val isRotated: Boolean) : ThumbnailPositionState() } Loading
quickstep/res/layout/task_thumbnail.xml +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:importantForAccessibility="no" android:scaleType="matrix" android:visibility="gone"/> <com.android.quickstep.task.thumbnail.LiveTileView Loading
quickstep/src/com/android/quickstep/TaskOverlayFactory.java +5 −1 Original line number Diff line number Diff line Loading @@ -184,6 +184,10 @@ public class TaskOverlayFactory implements ResourceBasedOverride { return mTaskContainer.getTaskView(); } public View getSnapshotView() { return mTaskContainer.getSnapshotView(); } /** * Called when the current task is interactive for the user */ Loading Loading @@ -312,7 +316,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { // the difference between the bitmap bounds and the projected view bounds. Matrix boundsToBitmapSpace = new Matrix(); Matrix thumbnailMatrix = enableRefactorTaskThumbnail() ? mHelper.getEnabledState().getThumbnailMatrix() ? mHelper.getThumbnailMatrix() : mTaskContainer.getThumbnailViewDeprecated().getThumbnailMatrix(); thumbnailMatrix.invert(boundsToBitmapSpace); RectF boundsInBitmapSpace = new RectF(); Loading
quickstep/src/com/android/quickstep/recents/usecase/GetThumbnailPositionUseCase.kt 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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. */ package com.android.quickstep.recents.usecase import android.graphics.Matrix import android.graphics.Rect import com.android.quickstep.recents.data.RecentTasksRepository import com.android.quickstep.recents.data.RecentsDeviceProfileRepository import com.android.quickstep.recents.data.RecentsRotationStateRepository import com.android.quickstep.recents.usecase.ThumbnailPositionState.MatrixScaling import com.android.quickstep.recents.usecase.ThumbnailPositionState.MissingThumbnail import com.android.systemui.shared.recents.utilities.PreviewPositionHelper import kotlinx.coroutines.flow.firstOrNull /** Use case for retrieving [Matrix] for positioning Thumbnail in a View */ class GetThumbnailPositionUseCase( private val deviceProfileRepository: RecentsDeviceProfileRepository, private val rotationStateRepository: RecentsRotationStateRepository, private val tasksRepository: RecentTasksRepository, private val previewPositionHelper: PreviewPositionHelper = PreviewPositionHelper() ) { suspend fun run(taskId: Int, width: Int, height: Int, isRtl: Boolean): ThumbnailPositionState { val thumbnailData = tasksRepository.getThumbnailById(taskId).firstOrNull() ?: return MissingThumbnail val thumbnail = thumbnailData.thumbnail ?: return MissingThumbnail previewPositionHelper.updateThumbnailMatrix( Rect(0, 0, thumbnail.width, thumbnail.height), thumbnailData, width, height, deviceProfileRepository.getRecentsDeviceProfile().isLargeScreen, rotationStateRepository.getRecentsRotationState().activityRotation, isRtl ) return MatrixScaling( previewPositionHelper.matrix, previewPositionHelper.isOrientationChanged ) } }
quickstep/src/com/android/quickstep/task/util/GetThumbnailUseCase.kt→quickstep/src/com/android/quickstep/recents/usecase/GetThumbnailUseCase.kt +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ package com.android.quickstep.task.util package com.android.quickstep.recents.usecase import android.graphics.Bitmap import com.android.quickstep.recents.data.RecentTasksRepository Loading
quickstep/src/com/android/quickstep/recents/usecase/ThumbnailPositionState.kt 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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. */ package com.android.quickstep.recents.usecase import android.graphics.Matrix /** State on how a task Thumbnail can fit on given canvas */ sealed class ThumbnailPositionState { data object MissingThumbnail : ThumbnailPositionState() data class MatrixScaling(val matrix: Matrix, val isRotated: Boolean) : ThumbnailPositionState() }