diff options
28 files changed, 175 insertions, 591 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreen.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreen.java index 1917bd28cb2c..8990065015f1 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreen.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreen.java @@ -18,15 +18,10 @@ package com.android.wm.shell.splitscreen; import android.annotation.IntDef; import android.annotation.NonNull; -import android.annotation.Nullable; import android.app.ActivityManager; import android.graphics.Rect; -import android.os.Bundle; -import android.window.RemoteTransition; import com.android.wm.shell.common.annotations.ExternalThread; -import com.android.internal.logging.InstanceId; -import com.android.wm.shell.common.split.SplitScreenConstants.PersistentSnapPosition; import com.android.wm.shell.common.split.SplitScreenConstants.SplitPosition; import java.util.concurrent.Executor; @@ -79,12 +74,6 @@ public interface SplitScreen { } } - /** Launches a pair of tasks into splitscreen */ - void startTasks(int taskId1, @Nullable Bundle options1, int taskId2, - @Nullable Bundle options2, @SplitPosition int splitPosition, - @PersistentSnapPosition int snapPosition, @Nullable RemoteTransition remoteTransition, - InstanceId instanceId); - /** Registers listener that gets split screen callback. */ void registerSplitScreenListener(@NonNull SplitScreenListener listener, @NonNull Executor executor); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java index c27b514cffc1..79bc24edf961 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java @@ -494,15 +494,6 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, return mStageCoordinator.getActivateSplitPosition(taskInfo); } - /** Start two tasks in parallel as a splitscreen pair. */ - public void startTasks(int taskId1, @Nullable Bundle options1, int taskId2, - @Nullable Bundle options2, @SplitPosition int splitPosition, - @PersistentSnapPosition int snapPosition, - @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { - mStageCoordinator.startTasks(taskId1, options1, taskId2, options2, splitPosition, - snapPosition, remoteTransition, instanceId); - } - /** * Move a task to split select * @param taskInfo the task being moved to split select @@ -1115,15 +1106,6 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, }; @Override - public void startTasks(int taskId1, @Nullable Bundle options1, int taskId2, - @Nullable Bundle options2, int splitPosition, int snapPosition, - @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { - mMainExecutor.execute(() -> SplitScreenController.this.startTasks( - taskId1, options1, taskId2, options2, splitPosition, snapPosition, - remoteTransition, instanceId)); - } - - @Override public void registerSplitScreenListener(SplitScreenListener listener, Executor executor) { if (mExecutors.containsKey(listener)) return; diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig index 321ff68421fd..9e0f78ce0900 100644 --- a/packages/SystemUI/aconfig/systemui.aconfig +++ b/packages/SystemUI/aconfig/systemui.aconfig @@ -115,17 +115,7 @@ flag { } flag { - name: "pss_app_selector_recents_split_screen" - namespace: "systemui" - description: "Allows recent apps selected for partial screenshare to be launched in split screen mode" - bug: "320449039" - metadata { - purpose: PURPOSE_BUGFIX - } -} - -flag { - name: "notifications_background_icons" + name: "notifications_background_media_icons" namespace: "systemui" description: "Updates icons for media notifications in the background." bug: "315143160" diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 45243eeb9007..e181d079fc6d 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -718,20 +718,6 @@ <item>26</item> <!-- MOUTH_COVERING_DETECTED --> </integer-array> - <!-- Which face help messages to surface when fingerprint is enrolled and device is unfolded. - Message ids correspond with the acquired ids in BiometricFaceConstants --> - <integer-array name="config_face_help_msgs_when_fingerprint_enrolled_unfolded"> - <item>3</item> <!-- TOO_DARK --> - <item>4</item> <!-- TOO_CLOSE --> - <item>5</item> <!-- TOO_FAR --> - <item>6</item> <!-- TOO_HIGH --> - <item>7</item> <!-- TOO_LOW --> - <item>8</item> <!-- TOO_RIGHT --> - <item>9</item> <!-- TOO_LEFT --> - <item>25</item> <!-- DARK_GLASSES --> - <item>26</item> <!-- MOUTH_COVERING_DETECTED --> - </integer-array> - <!-- Which device wake-ups will trigger passive auth. These values correspond with PowerManager#WakeReason. --> <integer-array name="config_face_auth_wake_up_triggers"> diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index 9de71c1880fe..94b1979548f0 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -629,7 +629,7 @@ public class AuthContainerView extends LinearLayout if (fpProp != null && fpProp.isAnyUdfpsType()) { maybeUpdatePositionForUdfps(forceInvalidate /* invalidate */); } - if (faceProp != null && mBiometricView.isFaceOnly()) { + if (faceProp != null && mBiometricView != null && mBiometricView.isFaceOnly()) { alwaysUpdatePositionAtScreenBottom(forceInvalidate /* invalidate */); } if (fpProp != null && fpProp.sensorType == TYPE_POWER_BUTTON) { diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractor.kt index 9919f09935c3..846013cef326 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractor.kt @@ -30,20 +30,17 @@ import com.android.systemui.deviceentry.shared.model.FingerprintFailureMessage import com.android.systemui.deviceentry.shared.model.FingerprintLockoutMessage import com.android.systemui.deviceentry.shared.model.FingerprintMessage import com.android.systemui.deviceentry.shared.model.HelpFaceAuthenticationStatus -import com.android.systemui.keyguard.domain.interactor.DevicePostureInteractor -import com.android.systemui.keyguard.shared.model.DevicePosture import com.android.systemui.keyguard.shared.model.ErrorFingerprintAuthenticationStatus import com.android.systemui.res.R +import com.android.systemui.util.kotlin.Utils.Companion.toTriple import com.android.systemui.util.kotlin.sample import javax.inject.Inject import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.flow.filterNot import kotlinx.coroutines.flow.flatMapLatest -import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.merge @@ -62,7 +59,6 @@ constructor( faceAuthInteractor: DeviceEntryFaceAuthInteractor, private val biometricSettingsInteractor: DeviceEntryBiometricSettingsInteractor, faceHelpMessageDeferralInteractor: FaceHelpMessageDeferralInteractor, - devicePostureInteractor: DevicePostureInteractor, ) { private val faceHelp: Flow<HelpFaceAuthenticationStatus> = faceAuthInteractor.authenticationStatus.filterIsInstance<HelpFaceAuthenticationStatus>() @@ -75,18 +71,9 @@ constructor( * The acquisition message ids to show message when both fingerprint and face are enrolled and * enabled for device entry. */ - private val coExFaceAcquisitionMsgIdsToShowDefault: Set<Int> = + private val coExFaceAcquisitionMsgIdsToShow: Set<Int> = resources.getIntArray(R.array.config_face_help_msgs_when_fingerprint_enrolled).toSet() - /** - * The acquisition message ids to show message when both fingerprint and face are enrolled and - * enabled for device entry and the device is unfolded. - */ - private val coExFaceAcquisitionMsgIdsToShowUnfolded: Set<Int> = - resources - .getIntArray(R.array.config_face_help_msgs_when_fingerprint_enrolled_unfolded) - .toSet() - private fun ErrorFingerprintAuthenticationStatus.shouldSuppressError(): Boolean { return isCancellationError() || isPowerPressedError() } @@ -135,17 +122,6 @@ constructor( } } - val coExFaceAcquisitionMsgIdsToShow: Flow<Set<Int>> = - devicePostureInteractor.posture.map { devicePosture -> - when (devicePosture) { - DevicePosture.OPENED -> coExFaceAcquisitionMsgIdsToShowUnfolded - DevicePosture.UNKNOWN, // Devices without posture support (non-foldable) use UNKNOWN - DevicePosture.CLOSED, - DevicePosture.HALF_OPENED, - DevicePosture.FLIPPED -> coExFaceAcquisitionMsgIdsToShowDefault - } - } - val fingerprintMessage: Flow<FingerprintMessage> = merge( fingerprintErrorMessage, @@ -153,38 +129,25 @@ constructor( fingerprintHelpMessage, ) - private val filterConditionForFaceHelpMessages: - Flow<(HelpFaceAuthenticationStatus) -> Boolean> = - combine( - biometricSettingsInteractor.isFingerprintAuthEnrolledAndEnabled, - biometricSettingsInteractor.faceAuthCurrentlyAllowed, - ::Pair - ) - .flatMapLatest { (fingerprintEnrolled, faceAuthCurrentlyAllowed) -> - if (fingerprintEnrolled && faceAuthCurrentlyAllowed) { - // Show only some face help messages if fingerprint is also enrolled - coExFaceAcquisitionMsgIdsToShow.map { msgIdsToShow -> - { helpStatus: HelpFaceAuthenticationStatus -> - msgIdsToShow.contains(helpStatus.msgId) - } - } - } else if (faceAuthCurrentlyAllowed) { - // Show all face help messages if only face is enrolled and currently allowed - flowOf { _: HelpFaceAuthenticationStatus -> true } - } else { - flowOf { _: HelpFaceAuthenticationStatus -> false } - } - } - private val faceHelpMessage: Flow<FaceMessage> = faceHelp .filterNot { // Message deferred to potentially show at face timeout error instead faceHelpMessageDeferralInteractor.shouldDefer(it.msgId) } - .sample(filterConditionForFaceHelpMessages, ::Pair) - .filter { (helpMessage, filterCondition) -> filterCondition(helpMessage) } - .map { (status, _) -> FaceMessage(status.msg) } + .sample(biometricSettingsInteractor.fingerprintAndFaceEnrolledAndEnabled, ::Pair) + .filter { (faceAuthHelpStatus, fingerprintAndFaceEnrolledAndEnabled) -> + if (fingerprintAndFaceEnrolledAndEnabled) { + // Show only some face help messages if fingerprint is also enrolled + coExFaceAcquisitionMsgIdsToShow.contains(faceAuthHelpStatus.msgId) + } else { + // Show all face help messages if only face is enrolled + true + } + } + .sample(biometricSettingsInteractor.faceAuthCurrentlyAllowed, ::toTriple) + .filter { (_, _, faceAuthCurrentlyAllowed) -> faceAuthCurrentlyAllowed } + .map { (status, _, _) -> FaceMessage(status.msg) } private val faceFailureMessage: Flow<FaceMessage> = faceFailure diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DevicePostureInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DevicePostureInteractor.kt deleted file mode 100644 index e48cddb33aa4..000000000000 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DevicePostureInteractor.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.systemui.keyguard.domain.interactor - -import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.keyguard.data.repository.DevicePostureRepository -import javax.inject.Inject -import kotlinx.coroutines.ExperimentalCoroutinesApi - -/** DevicePosture business logic. */ -@ExperimentalCoroutinesApi -@SysUISingleton -class DevicePostureInteractor -@Inject -constructor(devicePostureRepository: DevicePostureRepository) { - val posture = devicePostureRepository.currentDevicePosture -} diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/data/RecentTask.kt b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/data/RecentTask.kt index 1fc97e94e250..e9b458271ef7 100644 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/data/RecentTask.kt +++ b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/data/RecentTask.kt @@ -18,9 +18,7 @@ package com.android.systemui.mediaprojection.appselector.data import android.annotation.ColorInt import android.annotation.UserIdInt -import android.app.ActivityManager.RecentTaskInfo import android.content.ComponentName -import com.android.wm.shell.util.SplitBounds data class RecentTask( val taskId: Int, @@ -31,30 +29,3 @@ data class RecentTask( @ColorInt val colorBackground: Int?, val isForegroundTask: Boolean, ) - val userType: UserType, - val splitBounds: SplitBounds?, -) { - constructor( - taskInfo: RecentTaskInfo, - isForegroundTask: Boolean, - userType: UserType, - splitBounds: SplitBounds? = null - ) : this( - taskInfo.taskId, - taskInfo.displayId, - taskInfo.userId, - taskInfo.topActivity, - taskInfo.baseIntent?.component, - taskInfo.taskDescription?.backgroundColor, - isForegroundTask, - userType, - splitBounds - ) - - enum class UserType { - STANDARD, - WORK, - PRIVATE, - CLONED - } -} diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/data/RecentTaskListProvider.kt b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/data/RecentTaskListProvider.kt index f6b762b44db0..5dde14bf0867 100644 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/data/RecentTaskListProvider.kt +++ b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/data/RecentTaskListProvider.kt @@ -55,8 +55,9 @@ constructor( val foregroundTaskId1 = foregroundGroup?.taskInfo1?.taskId val foregroundTaskId2 = foregroundGroup?.taskInfo2?.taskId val foregroundTaskIds = listOfNotNull(foregroundTaskId1, foregroundTaskId2) - groupedTasks.flatMap { - val task1 = + groupedTasks + .flatMap { listOfNotNull(it.taskInfo1, it.taskInfo2) } + .map { RecentTask( it.taskId, it.displayId, @@ -65,24 +66,8 @@ constructor( it.baseIntent?.component, it.taskDescription?.backgroundColor, isForegroundTask = it.taskId in foregroundTaskIds && it.isVisible - it.taskInfo1, - it.taskInfo1.taskId in foregroundTaskIds && it.taskInfo1.isVisible, - userManager.getUserInfo(it.taskInfo1.userId).toUserType(), - it.splitBounds ) - - val task2 = - if (it.taskInfo2 != null) { - RecentTask( - it.taskInfo2!!, - it.taskInfo2!!.taskId in foregroundTaskIds && it.taskInfo2!!.isVisible, - userManager.getUserInfo(it.taskInfo2!!.userId).toUserType(), - it.splitBounds - ) - } else null - - listOfNotNull(task1, task2) - } + } } private suspend fun RecentTasks.getTasks(): List<GroupedRecentTaskInfo> = diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionRecentsViewController.kt b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionRecentsViewController.kt index 9549ab1cab3e..7c7efd0be8ed 100644 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionRecentsViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionRecentsViewController.kt @@ -24,12 +24,9 @@ import android.graphics.Rect import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.window.RemoteTransition import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.android.systemui.Flags.pssAppSelectorAbruptExitFix -import com.android.systemui.Flags.pssAppSelectorRecentsSplitScreen -import com.android.systemui.display.naturalBounds import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorResultHandler import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorScope import com.android.systemui.mediaprojection.appselector.data.RecentTask @@ -37,11 +34,6 @@ import com.android.systemui.mediaprojection.appselector.view.RecentTasksAdapter. import com.android.systemui.mediaprojection.appselector.view.TaskPreviewSizeProvider.TaskPreviewSizeListener import com.android.systemui.res.R import com.android.systemui.util.recycler.HorizontalSpacerItemDecoration -import com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT -import com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT -import com.android.wm.shell.splitscreen.SplitScreen -import com.android.wm.shell.util.SplitBounds -import java.util.Optional import javax.inject.Inject /** @@ -56,7 +48,6 @@ constructor( private val taskViewSizeProvider: TaskPreviewSizeProvider, private val activityTaskManager: IActivityTaskManager, private val resultHandler: MediaProjectionAppSelectorResultHandler, - private val splitScreen: Optional<SplitScreen>, ) : RecentTaskClickListener, TaskPreviewSizeListener { private var views: Views? = null @@ -72,11 +63,11 @@ constructor( fun createView(parent: ViewGroup): ViewGroup = views?.root ?: createRecentViews(parent) - .also { - views = it - lastBoundData?.let { recents -> bind(recents) } - } - .root + .also { + views = it + lastBoundData?.let { recents -> bind(recents) } + } + .root fun bind(recentTasks: List<RecentTask>) { views?.apply { @@ -102,10 +93,8 @@ constructor( private fun createRecentViews(parent: ViewGroup): Views { val recentsRoot = LayoutInflater.from(parent.context) - .inflate(R.layout.media_projection_recent_tasks, - parent, /* attachToRoot= */ - false) - as ViewGroup + .inflate(R.layout.media_projection_recent_tasks, parent, /* attachToRoot= */ false) + as ViewGroup val container = recentsRoot.requireViewById<View>(R.id.media_projection_recent_tasks_container) @@ -132,34 +121,18 @@ constructor( return Views(recentsRoot, container, progress, recycler) } - private fun RecentTask.isLaunchingInSplitScreen(): Boolean { - return splitScreen.isPresent && splitBounds != null - } - override fun onRecentAppClicked(task: RecentTask, view: View) { val launchCookie = LaunchCookie() val activityOptions = createAnimation(task, view) activityOptions.pendingIntentBackgroundActivityStartMode = MODE_BACKGROUND_ACTIVITY_START_ALLOWED - activityOptions.launchDisplayId = task.displayId activityOptions.setLaunchCookie(launchCookie) + activityOptions.launchDisplayId = task.displayId - val handleResult: () -> Unit = { resultHandler.returnSelectedApp(launchCookie)} - - val taskId = task.taskId - val splitBounds = task.splitBounds - - if (pssAppSelectorRecentsSplitScreen() && - task.isLaunchingInSplitScreen() && - !task.isForegroundTask) { - startSplitScreenTask(view, taskId, splitBounds!!, handleResult, activityOptions) - } else { - activityTaskManager.startActivityFromRecents(taskId, activityOptions.toBundle()) - handleResult() - } + activityTaskManager.startActivityFromRecents(task.taskId, activityOptions.toBundle()) + resultHandler.returnSelectedApp(launchCookie) } - private fun createAnimation(task: RecentTask, view: View): ActivityOptions = if (pssAppSelectorAbruptExitFix() && task.isForegroundTask) { // When the selected task is in the foreground, the scale up animation doesn't work. @@ -172,14 +145,7 @@ constructor( /* startedListener = */ null, /* finishedListener = */ null ) - } else if (task.isLaunchingInSplitScreen()) { - // When the selected task isn't in the foreground, but is launching in split screen, - // then we don't need to specify an animation, since we'll already be passing a - // manually built remote animation to SplitScreenController - ActivityOptions.makeBasic() } else { - // The default case is a selected task not in the foreground and launching fullscreen, - // so for this we can use the default ActivityOptions animation ActivityOptions.makeScaleUpAnimation( view, /* startX= */ 0, @@ -189,29 +155,6 @@ constructor( ) } - private fun startSplitScreenTask( - view: View, - taskId: Int, - splitBounds: SplitBounds, - handleResult: () -> Unit, - activityOptions: ActivityOptions, - ) { - val isLeftTopTask = taskId == splitBounds.leftTopTaskId - val task2Id = - if (isLeftTopTask) splitBounds.rightBottomTaskId else splitBounds.leftTopTaskId - val splitPosition = - if (isLeftTopTask) SPLIT_POSITION_TOP_OR_LEFT else SPLIT_POSITION_BOTTOM_OR_RIGHT - - val animationRunner = RemoteRecentSplitTaskTransitionRunner(taskId, task2Id, - view.locationOnScreen, view.context.display.naturalBounds, handleResult) - val remoteTransition = RemoteTransition(animationRunner, - view.context.iApplicationThread, "startSplitScreenTask") - - splitScreen.get().startTasks(taskId, activityOptions.toBundle(), task2Id, null, - splitPosition, splitBounds.snapPosition, remoteTransition, null) - } - - override fun onTaskSizeChanged(size: Rect) { views?.recentsContainer?.setTaskHeightSize() } @@ -220,12 +163,12 @@ constructor( val thumbnailHeight = taskViewSizeProvider.size.height() val itemHeight = thumbnailHeight + - context.resources.getDimensionPixelSize( - R.dimen.media_projection_app_selector_task_icon_size - ) + - context.resources.getDimensionPixelSize( - R.dimen.media_projection_app_selector_task_icon_margin - ) * 2 + context.resources.getDimensionPixelSize( + R.dimen.media_projection_app_selector_task_icon_size + ) + + context.resources.getDimensionPixelSize( + R.dimen.media_projection_app_selector_task_icon_margin + ) * 2 layoutParams = layoutParams.apply { height = itemHeight } } diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/RemoteRecentSplitTaskTransitionRunner.kt b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/RemoteRecentSplitTaskTransitionRunner.kt deleted file mode 100644 index 9514c4ab8f2d..000000000000 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/RemoteRecentSplitTaskTransitionRunner.kt +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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.systemui.mediaprojection.appselector.view - -import android.animation.Animator -import android.animation.AnimatorListenerAdapter -import android.animation.AnimatorSet -import android.animation.ValueAnimator -import android.annotation.UiThread -import android.graphics.Rect -import android.os.IBinder -import android.os.RemoteException -import android.util.Log -import android.view.SurfaceControl -import android.view.animation.DecelerateInterpolator -import android.window.IRemoteTransition -import android.window.IRemoteTransitionFinishedCallback -import android.window.TransitionInfo -import android.window.WindowContainerToken -import com.android.app.viewcapture.ViewCapture -import com.android.internal.policy.TransitionAnimation -import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorActivity.Companion.TAG - -class RemoteRecentSplitTaskTransitionRunner( - private val firstTaskId: Int, - private val secondTaskId: Int, - private val viewPosition: IntArray, - private val screenBounds: Rect, - private val handleResult: () -> Unit, -) : IRemoteTransition.Stub() { - override fun startAnimation( - transition: IBinder?, - info: TransitionInfo?, - t: SurfaceControl.Transaction?, - finishedCallback: IRemoteTransitionFinishedCallback - ) { - val launchAnimation = AnimatorSet() - var rootCandidate = - info!!.changes.firstOrNull { - it.taskInfo?.taskId == firstTaskId || it.taskInfo?.taskId == secondTaskId - } - - // If we could not find a proper root candidate, something went wrong. - check(rootCandidate != null) { "Could not find a split root candidate" } - - // Recurse up the tree until parent is null, then we've found our root. - var parentToken: WindowContainerToken? = rootCandidate.parent - while (parentToken != null) { - rootCandidate = info.getChange(parentToken) ?: break - parentToken = rootCandidate.parent - } - - // Make sure nothing weird happened, like getChange() returning null. - check(rootCandidate != null) { "Failed to find a root leash" } - - // Ending position is the full device screen. - val startingScale = 0.25f - - val startX = viewPosition[0] - val startY = viewPosition[1] - val endX = screenBounds.left - val endY = screenBounds.top - - ViewCapture.MAIN_EXECUTOR.execute { - val progressUpdater = ValueAnimator.ofFloat(0f, 1f) - with(progressUpdater) { - interpolator = DecelerateInterpolator(1.5f) - setDuration(TransitionAnimation.DEFAULT_APP_TRANSITION_DURATION.toLong()) - - addUpdateListener { valueAnimator -> - val progress = valueAnimator.animatedFraction - - val x = startX + ((endX - startX) * progress) - val y = startY + ((endY - startY) * progress) - val scale = startingScale + ((1 - startingScale) * progress) - - t!! - .setPosition(rootCandidate.leash, x, y) - .setScale(rootCandidate.leash, scale, scale) - .setAlpha(rootCandidate.leash, progress) - .apply() - } - - addListener( - object : AnimatorListenerAdapter() { - override fun onAnimationEnd(animation: Animator) { - try { - onTransitionFinished() - finishedCallback.onTransitionFinished(null, null) - } catch (e: RemoteException) { - Log.e(TAG, "Failed to call transition finished callback", e) - } - } - } - ) - } - - launchAnimation.play(progressUpdater) - launchAnimation.start() - } - } - - override fun mergeAnimation( - transition: IBinder?, - info: TransitionInfo?, - t: SurfaceControl.Transaction?, - mergeTarget: IBinder?, - finishedCallback: IRemoteTransitionFinishedCallback? - ) {} - - @Throws(RemoteException::class) - override fun onTransitionConsumed(transition: IBinder, aborted: Boolean) { - Log.w(TAG, "unexpected consumption of app selector transition: aborted=$aborted") - } - - @UiThread - private fun onTransitionFinished() { - // After finished transition, then invoke callback to close the app selector, so that - // finish animation of app selector does not override the launch animation of the split - // tasks - handleResult() - } -} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 0d2b3e10711d..1963d641702a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -97,7 +97,6 @@ import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; -import com.android.systemui.deviceentry.domain.interactor.BiometricMessageInteractor; import com.android.systemui.dock.DockManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.KeyguardIndication; @@ -121,6 +120,7 @@ import com.android.systemui.util.wakelock.WakeLock; import java.io.PrintWriter; import java.text.NumberFormat; +import java.util.HashSet; import java.util.Set; import java.util.function.Consumer; @@ -181,7 +181,6 @@ public class KeyguardIndicationController { private BroadcastReceiver mBroadcastReceiver; private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private KeyguardInteractor mKeyguardInteractor; - private final BiometricMessageInteractor mBiometricMessageInteractor; private String mPersistentUnlockMessage; private String mAlignmentIndication; private boolean mForceIsDismissible; @@ -210,7 +209,7 @@ public class KeyguardIndicationController { private boolean mBatteryPresent = true; protected long mChargingTimeRemaining; private Pair<String, BiometricSourceType> mBiometricErrorMessageToShowOnScreenOn; - private Set<Integer> mCoExFaceAcquisitionMsgIdsToShow; + private final Set<Integer> mCoExFaceAcquisitionMsgIdsToShow; private final FaceHelpMessageDeferral mFaceAcquiredMessageDeferral; private boolean mInited; @@ -228,10 +227,6 @@ public class KeyguardIndicationController { mIsActiveDreamLockscreenHosted = isLockscreenHosted; updateDeviceEntryIndication(false); }; - @VisibleForTesting - final Consumer<Set<Integer>> mCoExAcquisitionMsgIdsToShowCallback = - (Set<Integer> coExFaceAcquisitionMsgIdsToShow) -> mCoExFaceAcquisitionMsgIdsToShow = - coExFaceAcquisitionMsgIdsToShow; private final ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() { @Override public void onScreenTurnedOn() { @@ -291,8 +286,7 @@ public class KeyguardIndicationController { BouncerMessageInteractor bouncerMessageInteractor, FeatureFlags flags, IndicationHelper indicationHelper, - KeyguardInteractor keyguardInteractor, - BiometricMessageInteractor biometricMessageInteractor + KeyguardInteractor keyguardInteractor ) { mContext = context; mBroadcastDispatcher = broadcastDispatcher; @@ -321,9 +315,14 @@ public class KeyguardIndicationController { mFeatureFlags = flags; mIndicationHelper = indicationHelper; mKeyguardInteractor = keyguardInteractor; - mBiometricMessageInteractor = biometricMessageInteractor; mFaceAcquiredMessageDeferral = faceHelpMessageDeferral.create(); + mCoExFaceAcquisitionMsgIdsToShow = new HashSet<>(); + int[] msgIds = context.getResources().getIntArray( + com.android.systemui.res.R.array.config_face_help_msgs_when_fingerprint_enrolled); + for (int msgId : msgIds) { + mCoExFaceAcquisitionMsgIdsToShow.add(msgId); + } mHandler = new Handler(mainLooper) { @Override @@ -370,7 +369,7 @@ public class KeyguardIndicationController { mIndicationArea = indicationArea; mTopIndicationView = indicationArea.findViewById(R.id.keyguard_indication_text); mLockScreenIndicationView = indicationArea.findViewById( - R.id.keyguard_indication_text_bottom); + R.id.keyguard_indication_text_bottom); mInitialTextColorState = mTopIndicationView != null ? mTopIndicationView.getTextColors() : ColorStateList.valueOf(Color.WHITE); if (mRotateTextViewController != null) { @@ -402,10 +401,6 @@ public class KeyguardIndicationController { collectFlow(mIndicationArea, mKeyguardInteractor.isActiveDreamLockscreenHosted(), mIsActiveDreamLockscreenHostedCallback); } - - collectFlow(mIndicationArea, - mBiometricMessageInteractor.getCoExFaceAcquisitionMsgIdsToShow(), - mCoExAcquisitionMsgIdsToShowCallback); } /** diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/DevicePostureRepositoryKosmos.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/DeviceBasedSatelliteInputLog.kt index 9bbb34c970d0..73c015d234f5 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/DevicePostureRepositoryKosmos.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/DeviceBasedSatelliteInputLog.kt @@ -14,9 +14,16 @@ * limitations under the License. */ -package com.android.systemui.keyguard.data.repository +package com.android.systemui.statusbar.pipeline.dagger -import com.android.systemui.kosmos.Kosmos +import javax.inject.Qualifier -val Kosmos.devicePostureRepository: DevicePostureRepository by - Kosmos.Fixture { FakeDevicePostureRepository() } +/** + * Logs for device-based satellite events that are **not** that frequent/chatty. + * + * For chatty logs, use [VerboseDeviceBasedSatelliteInputLog] instead. + */ +@Qualifier +@MustBeDocumented +@Retention(AnnotationRetention.RUNTIME) +annotation class DeviceBasedSatelliteInputLog diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt index 3811d6b91a52..9810af75fa25 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/StatusBarPipelineModule.kt @@ -274,9 +274,16 @@ abstract class StatusBarPipelineModule { @Provides @SysUISingleton - @OemSatelliteInputLog - fun provideOemSatelliteInputLog(factory: LogBufferFactory): LogBuffer { - return factory.create("DeviceBasedSatelliteInputLog", 150) + @DeviceBasedSatelliteInputLog + fun provideDeviceBasedSatelliteInputLog(factory: LogBufferFactory): LogBuffer { + return factory.create("DeviceBasedSatelliteInputLog", 200) + } + + @Provides + @SysUISingleton + @VerboseDeviceBasedSatelliteInputLog + fun provideVerboseDeviceBasedSatelliteInputLog(factory: LogBufferFactory): LogBuffer { + return factory.create("VerboseDeviceBasedSatelliteInputLog", 200) } const val FIRST_MOBILE_SUB_SHOWING_NETWORK_TYPE_ICON = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/OemSatelliteInputLog.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/VerboseDeviceBasedSatelliteInputLog.kt index 252945f1ed6a..af6805513c89 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/OemSatelliteInputLog.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/dagger/VerboseDeviceBasedSatelliteInputLog.kt @@ -16,11 +16,14 @@ package com.android.systemui.statusbar.pipeline.dagger -import com.android.systemui.statusbar.pipeline.satellite.data.DeviceBasedSatelliteRepository import javax.inject.Qualifier -/** Detailed [DeviceBasedSatelliteRepository] logs */ +/** + * Logs for device-based satellite events that are frequent/chatty. + * + * For non-chatty logs, use [DeviceBasedSatelliteInputLog] instead. + */ @Qualifier @MustBeDocumented -@kotlin.annotation.Retention(AnnotationRetention.RUNTIME) -annotation class OemSatelliteInputLog +@Retention(AnnotationRetention.RUNTIME) +annotation class VerboseDeviceBasedSatelliteInputLog diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImpl.kt index 788375d7bdd2..879aa1d5a956 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImpl.kt @@ -30,7 +30,8 @@ import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.log.core.MessageInitializer import com.android.systemui.log.core.MessagePrinter -import com.android.systemui.statusbar.pipeline.dagger.OemSatelliteInputLog +import com.android.systemui.statusbar.pipeline.dagger.DeviceBasedSatelliteInputLog +import com.android.systemui.statusbar.pipeline.dagger.VerboseDeviceBasedSatelliteInputLog import com.android.systemui.statusbar.pipeline.satellite.data.DeviceBasedSatelliteRepository import com.android.systemui.statusbar.pipeline.satellite.data.prod.SatelliteSupport.Companion.whenSupported import com.android.systemui.statusbar.pipeline.satellite.data.prod.SatelliteSupport.NotSupported @@ -132,7 +133,8 @@ constructor( satelliteManagerOpt: Optional<SatelliteManager>, @Background private val bgDispatcher: CoroutineDispatcher, @Application private val scope: CoroutineScope, - @OemSatelliteInputLog private val logBuffer: LogBuffer, + @DeviceBasedSatelliteInputLog private val logBuffer: LogBuffer, + @VerboseDeviceBasedSatelliteInputLog private val verboseLogBuffer: LogBuffer, private val systemClock: SystemClock, ) : DeviceBasedSatelliteRepository { @@ -233,7 +235,7 @@ constructor( private fun signalStrengthFlow(sm: SupportedSatelliteManager) = conflatedCallbackFlow { val cb = NtnSignalStrengthCallback { signalStrength -> - logBuffer.i({ int1 = signalStrength.level }) { + verboseLogBuffer.i({ int1 = signalStrength.level }) { "onNtnSignalStrengthChanged: level=$int1" } trySend(signalStrength.level) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractor.kt index 5b954b272044..b66ace6b0fe3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractor.kt @@ -21,7 +21,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel -import com.android.systemui.statusbar.pipeline.dagger.OemSatelliteInputLog +import com.android.systemui.statusbar.pipeline.dagger.DeviceBasedSatelliteInputLog import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.MobileIconsInteractor import com.android.systemui.statusbar.pipeline.satellite.data.DeviceBasedSatelliteRepository import com.android.systemui.statusbar.pipeline.satellite.shared.model.SatelliteConnectionState @@ -48,7 +48,7 @@ constructor( deviceProvisioningInteractor: DeviceProvisioningInteractor, wifiInteractor: WifiInteractor, @Application scope: CoroutineScope, - @OemSatelliteInputLog private val logBuffer: LogBuffer, + @DeviceBasedSatelliteInputLog private val logBuffer: LogBuffer, ) { /** Must be observed by any UI showing Satellite iconography */ val isSatelliteAllowed = diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModel.kt index d76fd40522e4..0ed1b9b0f77a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModel.kt @@ -24,7 +24,7 @@ import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.res.R import com.android.systemui.statusbar.pipeline.airplane.data.repository.AirplaneModeRepository -import com.android.systemui.statusbar.pipeline.dagger.OemSatelliteInputLog +import com.android.systemui.statusbar.pipeline.dagger.DeviceBasedSatelliteInputLog import com.android.systemui.statusbar.pipeline.satellite.domain.interactor.DeviceBasedSatelliteInteractor import com.android.systemui.statusbar.pipeline.satellite.shared.model.SatelliteConnectionState import com.android.systemui.statusbar.pipeline.satellite.ui.model.SatelliteIconModel @@ -70,7 +70,7 @@ constructor( interactor: DeviceBasedSatelliteInteractor, @Application scope: CoroutineScope, airplaneModeRepository: AirplaneModeRepository, - @OemSatelliteInputLog logBuffer: LogBuffer, + @DeviceBasedSatelliteInputLog logBuffer: LogBuffer, ) : DeviceBasedSatelliteViewModel { private val shouldShowIcon: Flow<Boolean> = interactor.areAllConnectionsOutOfService.flatMapLatest { allOos -> diff --git a/packages/SystemUI/src/com/android/systemui/util/kotlin/Utils.kt b/packages/SystemUI/src/com/android/systemui/util/kotlin/Utils.kt index 405b57a1a04d..a88be065d722 100644 --- a/packages/SystemUI/src/com/android/systemui/util/kotlin/Utils.kt +++ b/packages/SystemUI/src/com/android/systemui/util/kotlin/Utils.kt @@ -28,8 +28,6 @@ class Utils { fun <A, B, C, D> toQuad(a: A, b: B, c: C, d: D) = Quad(a, b, c, d) fun <A, B, C, D> toQuad(a: A, bcd: Triple<B, C, D>) = Quad(a, bcd.first, bcd.second, bcd.third) - fun <A, B, C, D> toQuad(abc: Triple<A, B, C>, d: D) = - Quad(abc.first, abc.second, abc.third, d) fun <A, B, C, D, E> toQuint(a: A, b: B, c: C, d: D, e: E) = Quint(a, b, c, d, e) fun <A, B, C, D, E> toQuint(a: A, bcde: Quad<B, C, D, E>) = diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt index 13bc8dd1fac6..b594f91ef132 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt @@ -18,6 +18,7 @@ package com.android.systemui.biometrics import android.app.ActivityTaskManager import android.app.admin.DevicePolicyManager import android.content.pm.PackageManager +import android.content.res.Configuration import android.hardware.biometrics.BiometricAuthenticator import android.hardware.biometrics.BiometricConstants import android.hardware.biometrics.BiometricManager @@ -384,6 +385,33 @@ open class AuthContainerViewTest : SysuiTestCase() { } @Test + fun testAnimateToCredentialUI_rotateCredentialUI() { + val container = initializeFingerprintContainer( + authenticators = BiometricManager.Authenticators.BIOMETRIC_WEAK or + BiometricManager.Authenticators.DEVICE_CREDENTIAL + ) + container.animateToCredentialUI(false) + waitForIdleSync() + + assertThat(container.hasCredentialView()).isTrue() + assertThat(container.hasBiometricPrompt()).isFalse() + + // Check credential view persists after new attachment + container.onAttachedToWindow() + + assertThat(container.hasCredentialView()).isTrue() + assertThat(container.hasBiometricPrompt()).isFalse() + + val configuration = Configuration(context.resources.configuration) + configuration.orientation = Configuration.ORIENTATION_LANDSCAPE + container.dispatchConfigurationChanged(configuration) + waitForIdleSync() + + assertThat(container.hasCredentialView()).isTrue() + assertThat(container.hasBiometricPrompt()).isFalse() + } + + @Test fun testShowBiometricUI() { val container = initializeFingerprintContainer() diff --git a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/MediaProjectionAppSelectorControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/MediaProjectionAppSelectorControllerTest.kt index 253607846e0f..44798ea99bee 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/MediaProjectionAppSelectorControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/MediaProjectionAppSelectorControllerTest.kt @@ -257,8 +257,6 @@ class MediaProjectionAppSelectorControllerTest : SysuiTestCase() { userId = userId, colorBackground = 0, isForegroundTask = isForegroundTask, - userType = RecentTask.UserType.STANDARD, - splitBounds = null, ) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/data/ShellRecentTaskListProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/data/ShellRecentTaskListProviderTest.kt index c2289c4757f4..b593def283ae 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/data/ShellRecentTaskListProviderTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/data/ShellRecentTaskListProviderTest.kt @@ -164,8 +164,6 @@ class ShellRecentTaskListProviderTest : SysuiTestCase() { baseIntentComponent = null, colorBackground = null, isForegroundTask = false, - userType = userType, - splitBounds = null ) private fun createSingleTask(taskId: Int, isVisible: Boolean = false): GroupedRecentTaskInfo = diff --git a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionRecentsViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionRecentsViewControllerTest.kt index a50922aa03c0..ac4107359dbc 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionRecentsViewControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionRecentsViewControllerTest.kt @@ -18,28 +18,22 @@ package com.android.systemui.mediaprojection.appselector.view import android.app.ActivityOptions import android.app.IActivityTaskManager -import android.graphics.Rect import android.os.Bundle import android.view.View import android.view.ViewGroup import androidx.test.filters.SmallTest import com.android.systemui.Flags.FLAG_PSS_APP_SELECTOR_ABRUPT_EXIT_FIX -import com.android.systemui.Flags.FLAG_PSS_APP_SELECTOR_RECENTS_SPLIT_SCREEN import com.android.systemui.SysuiTestCase import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorResultHandler import com.android.systemui.mediaprojection.appselector.data.RecentTask import com.android.systemui.util.mockito.mock -import com.android.wm.shell.splitscreen.SplitScreen -import com.android.wm.shell.util.SplitBounds import com.google.common.truth.Expect import com.google.common.truth.Truth.assertThat -import java.util.Optional import org.junit.Rule import org.junit.Test import org.mockito.ArgumentCaptor import org.mockito.ArgumentMatchers.eq import org.mockito.Mockito.any -import org.mockito.Mockito.anyInt import org.mockito.Mockito.verify @SmallTest @@ -52,10 +46,9 @@ class MediaProjectionRecentsViewControllerTest : SysuiTestCase() { private val taskViewSizeProvider = mock<TaskPreviewSizeProvider>() private val activityTaskManager = mock<IActivityTaskManager>() private val resultHandler = mock<MediaProjectionAppSelectorResultHandler>() - private val splitScreen = Optional.of(mock<SplitScreen>()) private val bundleCaptor = ArgumentCaptor.forClass(Bundle::class.java) - private val fullScreenTask = + private val task = RecentTask( taskId = 123, displayId = 456, @@ -64,22 +57,6 @@ class MediaProjectionRecentsViewControllerTest : SysuiTestCase() { baseIntentComponent = null, colorBackground = null, isForegroundTask = false - isForegroundTask = false, - userType = RecentTask.UserType.STANDARD, - splitBounds = null - ) - - private val splitScreenTask = - RecentTask( - taskId = 123, - displayId = 456, - userId = 789, - topActivityComponent = null, - baseIntentComponent = null, - colorBackground = null, - isForegroundTask = false, - userType = RecentTask.UserType.STANDARD, - splitBounds = SplitBounds(Rect(), Rect(), 0, 0, 0) ) private val taskView = @@ -92,97 +69,61 @@ class MediaProjectionRecentsViewControllerTest : SysuiTestCase() { tasksAdapterFactory, taskViewSizeProvider, activityTaskManager, - resultHandler, - splitScreen, + resultHandler ) @Test - fun onRecentAppClicked_fullScreenTaskWithSameIdIsStartedFromRecents() { - controller.onRecentAppClicked(fullScreenTask, taskView) + fun onRecentAppClicked_taskWithSameIdIsStartedFromRecents() { + controller.onRecentAppClicked(task, taskView) - verify(activityTaskManager).startActivityFromRecents(eq(fullScreenTask.taskId), any()) - } - - @Test - fun onRecentAppClicked_splitScreenTaskWithSameIdIsStartedFromRecents() { - mSetFlagsRule.enableFlags(FLAG_PSS_APP_SELECTOR_RECENTS_SPLIT_SCREEN) - controller.onRecentAppClicked(splitScreenTask, taskView) - - verify(splitScreen.get()) - .startTasks( - eq(splitScreenTask.taskId), - any(), - anyInt(), - any(), - anyInt(), - anyInt(), - any(), - any() - ) + verify(activityTaskManager).startActivityFromRecents(eq(task.taskId), any()) } @Test fun onRecentAppClicked_launchDisplayIdIsSet() { - controller.onRecentAppClicked(fullScreenTask, taskView) + controller.onRecentAppClicked(task, taskView) - assertThat(getStartedTaskActivityOptions(fullScreenTask.taskId).launchDisplayId) - .isEqualTo(fullScreenTask.displayId) + assertThat(getStartedTaskActivityOptions().launchDisplayId).isEqualTo(task.displayId) } @Test - fun onRecentAppClicked_fullScreenTaskNotInForeground_usesScaleUpAnimation() { - assertThat(fullScreenTask.isForegroundTask).isFalse() - controller.onRecentAppClicked(fullScreenTask, taskView) + fun onRecentAppClicked_taskNotInForeground_usesScaleUpAnimation() { + controller.onRecentAppClicked(task, taskView) - assertThat(getStartedTaskActivityOptions(fullScreenTask.taskId).animationType) + assertThat(getStartedTaskActivityOptions().animationType) .isEqualTo(ActivityOptions.ANIM_SCALE_UP) } @Test - fun onRecentAppClicked_fullScreenTaskInForeground_flagOff_usesScaleUpAnimation() { + fun onRecentAppClicked_taskInForeground_flagOff_usesScaleUpAnimation() { mSetFlagsRule.disableFlags(FLAG_PSS_APP_SELECTOR_ABRUPT_EXIT_FIX) - controller.onRecentAppClicked(fullScreenTask, taskView) + controller.onRecentAppClicked(task, taskView) - assertThat(getStartedTaskActivityOptions(fullScreenTask.taskId).animationType) + assertThat(getStartedTaskActivityOptions().animationType) .isEqualTo(ActivityOptions.ANIM_SCALE_UP) } @Test - fun onRecentAppClicked_fullScreenTaskInForeground_flagOn_usesDefaultAnimation() { + fun onRecentAppClicked_taskInForeground_flagOn_usesDefaultAnimation() { mSetFlagsRule.enableFlags(FLAG_PSS_APP_SELECTOR_ABRUPT_EXIT_FIX) - assertForegroundTaskUsesDefaultCloseAnimation(fullScreenTask) - } - - @Test - fun onRecentAppClicked_splitScreenTaskInForeground_flagOn_usesDefaultAnimation() { - mSetFlagsRule.enableFlags( - FLAG_PSS_APP_SELECTOR_ABRUPT_EXIT_FIX, - FLAG_PSS_APP_SELECTOR_RECENTS_SPLIT_SCREEN - ) - assertForegroundTaskUsesDefaultCloseAnimation(splitScreenTask) - } - - private fun assertForegroundTaskUsesDefaultCloseAnimation(task: RecentTask) { val foregroundTask = task.copy(isForegroundTask = true) + controller.onRecentAppClicked(foregroundTask, taskView) expect - .that(getStartedTaskActivityOptions(foregroundTask.taskId).animationType) + .that(getStartedTaskActivityOptions().animationType) .isEqualTo(ActivityOptions.ANIM_CUSTOM) + expect.that(getStartedTaskActivityOptions().overrideTaskTransition).isTrue() expect - .that(getStartedTaskActivityOptions(foregroundTask.taskId).overrideTaskTransition) - .isTrue() - expect - .that(getStartedTaskActivityOptions(foregroundTask.taskId).customExitResId) + .that(getStartedTaskActivityOptions().customExitResId) .isEqualTo(com.android.internal.R.anim.resolver_close_anim) - expect - .that(getStartedTaskActivityOptions(foregroundTask.taskId).customEnterResId) - .isEqualTo(0) + expect.that(getStartedTaskActivityOptions().customEnterResId).isEqualTo(0) } - private fun getStartedTaskActivityOptions(taskId: Int): ActivityOptions { - verify(activityTaskManager).startActivityFromRecents(eq(taskId), bundleCaptor.capture()) + private fun getStartedTaskActivityOptions(): ActivityOptions { + verify(activityTaskManager) + .startActivityFromRecents(eq(task.taskId), bundleCaptor.capture()) return ActivityOptions.fromBundle(bundleCaptor.value) } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java index fe066ca2c318..2bd0d7963593 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerBaseTest.java @@ -32,8 +32,6 @@ import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static java.util.Collections.emptySet; - import android.app.AlarmManager; import android.app.Instrumentation; import android.app.admin.DevicePolicyManager; @@ -64,7 +62,6 @@ import com.android.systemui.biometrics.FaceHelpMessageDeferralFactory; import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor; import com.android.systemui.bouncer.domain.interactor.BouncerMessageInteractor; import com.android.systemui.broadcast.BroadcastDispatcher; -import com.android.systemui.deviceentry.domain.interactor.BiometricMessageInteractor; import com.android.systemui.dock.DockManager; import com.android.systemui.flags.FakeFeatureFlags; import com.android.systemui.keyguard.KeyguardIndication; @@ -84,8 +81,6 @@ import com.android.systemui.util.concurrency.FakeExecutor; import com.android.systemui.util.time.FakeSystemClock; import com.android.systemui.util.wakelock.WakeLockFake; -import kotlinx.coroutines.flow.StateFlow; - import org.junit.After; import org.junit.Before; import org.mockito.ArgumentCaptor; @@ -148,8 +143,6 @@ public class KeyguardIndicationControllerBaseTest extends SysuiTestCase { @Mock protected AlternateBouncerInteractor mAlternateBouncerInteractor; @Mock - protected BiometricMessageInteractor mBiometricMessageInteractor; - @Mock protected ScreenLifecycle mScreenLifecycle; @Mock protected AuthController mAuthController; @@ -233,8 +226,6 @@ public class KeyguardIndicationControllerBaseTest extends SysuiTestCase { when(mDevicePolicyResourcesManager.getString(anyString(), any(), anyString())) .thenReturn(mDisclosureWithOrganization); when(mUserTracker.getUserId()).thenReturn(mCurrentUserId); - when(mBiometricMessageInteractor.getCoExFaceAcquisitionMsgIdsToShow()) - .thenReturn(mock(StateFlow.class)); when(mFaceHelpMessageDeferralFactory.create()).thenReturn(mFaceHelpMessageDeferral); @@ -278,12 +269,10 @@ public class KeyguardIndicationControllerBaseTest extends SysuiTestCase { mock(BouncerMessageInteractor.class), mFlags, mIndicationHelper, - KeyguardInteractorFactory.create(mFlags).getKeyguardInteractor(), - mBiometricMessageInteractor + KeyguardInteractorFactory.create(mFlags).getKeyguardInteractor() ); mController.init(); mController.setIndicationArea(mIndicationArea); - mController.mCoExAcquisitionMsgIdsToShowCallback.accept(emptySet()); verify(mStatusBarStateController).addCallback(mStatusBarStateListenerCaptor.capture()); mStatusBarStateListener = mStatusBarStateListenerCaptor.getValue(); verify(mBroadcastDispatcher).registerReceiver(mBroadcastReceiverCaptor.capture(), any()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java index 13b521bd32d3..1504d4c1f033 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java @@ -88,8 +88,8 @@ import java.util.List; import java.util.Set; @SmallTest -@RunWith(AndroidJUnit4.class) -@TestableLooper.RunWithLooper(setAsMainLooper = true) +@RunWith(AndroidTestingRunner.class) +@TestableLooper.RunWithLooper public class KeyguardIndicationControllerTest extends KeyguardIndicationControllerBaseTest { @Test public void afterFaceLockout_skipShowingFaceNotRecognized() { @@ -131,11 +131,14 @@ public class KeyguardIndicationControllerTest extends KeyguardIndicationControll @Test public void onAlignmentStateChanged_showsSlowChargingIndication() { - createController(); - verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); - mController.setVisible(true); - - mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_POOR); + mInstrumentation.runOnMainSync(() -> { + createController(); + verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); + mController.setVisible(true); + + mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_POOR); + }); + mInstrumentation.waitForIdleSync(); mTestableLooper.processAllMessages(); verifyIndicationMessage(INDICATION_TYPE_ALIGNMENT, @@ -146,11 +149,14 @@ public class KeyguardIndicationControllerTest extends KeyguardIndicationControll @Test public void onAlignmentStateChanged_showsNotChargingIndication() { - createController(); - verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); - mController.setVisible(true); - - mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_TERRIBLE); + mInstrumentation.runOnMainSync(() -> { + createController(); + verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); + mController.setVisible(true); + + mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_TERRIBLE); + }); + mInstrumentation.waitForIdleSync(); mTestableLooper.processAllMessages(); verifyIndicationMessage(INDICATION_TYPE_ALIGNMENT, @@ -162,12 +168,15 @@ public class KeyguardIndicationControllerTest extends KeyguardIndicationControll @FlakyTest(bugId = 279944472) @Test public void onAlignmentStateChanged_whileDozing_showsSlowChargingIndication() { - createController(); - verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); - mController.setVisible(true); - mStatusBarStateListener.onDozingChanged(true); - - mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_POOR); + mInstrumentation.runOnMainSync(() -> { + createController(); + verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); + mController.setVisible(true); + mStatusBarStateListener.onDozingChanged(true); + + mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_POOR); + }); + mInstrumentation.waitForIdleSync(); mTestableLooper.processAllMessages(); assertThat(mTextView.getText()).isEqualTo( @@ -178,12 +187,15 @@ public class KeyguardIndicationControllerTest extends KeyguardIndicationControll @Test public void onAlignmentStateChanged_whileDozing_showsNotChargingIndication() { - createController(); - verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); - mController.setVisible(true); - mStatusBarStateListener.onDozingChanged(true); - - mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_TERRIBLE); + mInstrumentation.runOnMainSync(() -> { + createController(); + verify(mDockManager).addAlignmentStateListener(mAlignmentListener.capture()); + mController.setVisible(true); + mStatusBarStateListener.onDozingChanged(true); + + mAlignmentListener.getValue().onAlignmentStateChanged(DockManager.ALIGN_STATE_TERRIBLE); + }); + mInstrumentation.waitForIdleSync(); mTestableLooper.processAllMessages(); assertThat(mTextView.getText()).isEqualTo( @@ -630,12 +642,6 @@ public class KeyguardIndicationControllerTest extends KeyguardIndicationControll @Test public void sendFaceHelpMessages_fingerprintEnrolled() { createController(); - mController.mCoExAcquisitionMsgIdsToShowCallback.accept( - Set.of( - BiometricFaceConstants.FACE_ACQUIRED_MOUTH_COVERING_DETECTED, - BiometricFaceConstants.FACE_ACQUIRED_DARK_GLASSES_DETECTED - ) - ); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt index 77e48bff04de..8debe29d2493 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt @@ -88,7 +88,8 @@ class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() { Optional.empty(), dispatcher, testScope.backgroundScope, - FakeLogBuffer.Factory.create(), + logBuffer = FakeLogBuffer.Factory.create(), + verboseLogBuffer = FakeLogBuffer.Factory.create(), systemClock, ) @@ -382,7 +383,8 @@ class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() { if (satMan != null) Optional.of(satMan) else Optional.empty(), dispatcher, testScope.backgroundScope, - FakeLogBuffer.Factory.create(), + logBuffer = FakeLogBuffer.Factory.create(), + verboseLogBuffer = FakeLogBuffer.Factory.create(), systemClock, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractorKosmos.kt index 77d39f066e08..3ea46872ebcf 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/BiometricMessageInteractorKosmos.kt @@ -18,7 +18,6 @@ package com.android.systemui.deviceentry.domain.interactor import android.content.res.mainResources import com.android.systemui.biometrics.domain.interactor.fingerprintPropertyInteractor -import com.android.systemui.keyguard.domain.interactor.devicePostureInteractor import com.android.systemui.kosmos.Kosmos import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -32,6 +31,5 @@ val Kosmos.biometricMessageInteractor by faceAuthInteractor = deviceEntryFaceAuthInteractor, biometricSettingsInteractor = deviceEntryBiometricSettingsInteractor, faceHelpMessageDeferralInteractor = faceHelpMessageDeferralInteractor, - devicePostureInteractor = devicePostureInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/DevicePostureInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/DevicePostureInteractorKosmos.kt deleted file mode 100644 index 75eb3c9ad7ad..000000000000 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/DevicePostureInteractorKosmos.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.systemui.keyguard.domain.interactor - -import com.android.systemui.keyguard.data.repository.devicePostureRepository -import com.android.systemui.kosmos.Kosmos -import kotlinx.coroutines.ExperimentalCoroutinesApi - -@ExperimentalCoroutinesApi -val Kosmos.devicePostureInteractor by - Kosmos.Fixture { - DevicePostureInteractor( - devicePostureRepository = devicePostureRepository, - ) - } |