diff options
24 files changed, 148 insertions, 54 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/TEST_MAPPING b/libs/WindowManager/Shell/src/com/android/wm/shell/TEST_MAPPING new file mode 100644 index 000000000000..8dd1369ecbb2 --- /dev/null +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/TEST_MAPPING @@ -0,0 +1,15 @@ +{ + "ironwood-postsubmit": [ + { + "name": "WMShellFlickerTests", + "options": [ + { + "include-annotation": "android.platform.test.annotations.IwTest" + }, + { + "exclude-annotation": "org.junit.Ignore" + } + ] + } + ] +} diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/CopyContentInSplit.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/CopyContentInSplit.kt index 102a78ba16ab..49b31d815fb3 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/CopyContentInSplit.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/CopyContentInSplit.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.WindowManagerPolicyConstants @@ -41,6 +42,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:CopyContentInSplit` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DismissSplitScreenByDivider.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DismissSplitScreenByDivider.kt index bf91292811e8..2d3a72689d97 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DismissSplitScreenByDivider.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DismissSplitScreenByDivider.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.WindowManagerPolicyConstants @@ -44,6 +45,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:DismissSplitScreenByDivider` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DismissSplitScreenByGoHome.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DismissSplitScreenByGoHome.kt index 20a7423be681..df855bb11bfd 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DismissSplitScreenByGoHome.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DismissSplitScreenByGoHome.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.WindowManagerPolicyConstants @@ -41,6 +42,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:DismissSplitScreenByGoHome` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DragDividerToResize.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DragDividerToResize.kt index 8f7673b77429..47c1ca7cc10a 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DragDividerToResize.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/DragDividerToResize.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.Surface @@ -42,6 +43,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:DragDividerToResize` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromAllApps.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromAllApps.kt index 8e2769fb75bd..eebf5a2c8ba5 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromAllApps.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromAllApps.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.WindowManagerPolicyConstants @@ -47,6 +48,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:EnterSplitScreenByDragFromAllApps` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromNotification.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromNotification.kt index 531d376e3588..d4cec3b63502 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromNotification.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromNotification.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.WindowManagerPolicyConstants @@ -48,6 +49,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:EnterSplitScreenByDragFromNotification` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromTaskbar.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromTaskbar.kt index ea43c7ea0ddf..28cad6dbb3c9 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromTaskbar.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenByDragFromTaskbar.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.WindowManagerPolicyConstants @@ -47,6 +48,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:EnterSplitScreenByDragFromTaskbar` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenFromOverview.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenFromOverview.kt index 7ce23c5f9a4e..518486f206b9 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenFromOverview.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/EnterSplitScreenFromOverview.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import androidx.test.filters.RequiresDevice @@ -42,6 +43,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:EnterSplitScreenFromOverview` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchAppByDoubleTapDivider.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchAppByDoubleTapDivider.kt index 58f7b048bc70..8a22d55ac05c 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchAppByDoubleTapDivider.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchAppByDoubleTapDivider.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.WindowManagerPolicyConstants @@ -42,6 +43,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:SwitchAppByDoubleTapDivider` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromAnotherApp.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromAnotherApp.kt index 0dd6706fb00e..80d599967aae 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromAnotherApp.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromAnotherApp.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.WindowManagerPolicyConstants @@ -41,6 +42,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:SwitchBackToSplitFromAnotherApp` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromHome.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromHome.kt index dc8ba0caa4e4..79c917ad98f2 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromHome.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromHome.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.WindowManagerPolicyConstants @@ -41,6 +42,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:SwitchBackToSplitFromHome` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromRecent.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromRecent.kt index e5924c563e5b..166caa74e6d2 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromRecent.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/splitscreen/SwitchBackToSplitFromRecent.kt @@ -16,6 +16,7 @@ package com.android.wm.shell.flicker.splitscreen +import android.platform.test.annotations.IwTest import android.platform.test.annotations.Postsubmit import android.platform.test.annotations.Presubmit import android.view.WindowManagerPolicyConstants @@ -41,6 +42,7 @@ import org.junit.runners.Parameterized * * To run this test: `atest WMShellFlickerTests:SwitchBackToSplitFromRecent` */ +@IwTest(focusArea = "sysui") @RequiresDevice @RunWith(Parameterized::class) @Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) diff --git a/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/IllustrationTest.kt b/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/IllustrationTest.kt index 5ac719a503f7..54abec9ac0d7 100644 --- a/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/IllustrationTest.kt +++ b/packages/SettingsLib/Spa/tests/src/com/android/settingslib/spa/widget/IllustrationTest.kt @@ -66,26 +66,6 @@ class IllustrationTest { private var SemanticsPropertyReceiver.rawId by RawId @Test - fun lottie_displayed() { - val resId = R.raw.accessibility_shortcut_type_triple_tap - composeTestRule.setContent { - Illustration( - resId = resId, - resourceType = ResourceType.LOTTIE, - modifier = Modifier.semantics { rawId = resId } - ) - } - - fun hasRaw(@RawRes id: Int): SemanticsMatcher = - SemanticsMatcher.expectValue(RawId, id) - - val isIllustrationNode = hasAnyAncestor(hasRaw(resId)) - composeTestRule.onAllNodes(hasRaw(resId)) - .filterToOne(isIllustrationNode) - .assertIsDisplayed() - } - - @Test fun empty_lottie_not_displayed() { val resId = R.raw.empty composeTestRule.setContent { diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt index 91e75f6436c2..822f8f2e6191 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt @@ -33,6 +33,12 @@ interface ControlsUiController { fun hide() /** + * Returns the preferred activity to start, depending on if the user has favorited any + * controls. + */ + fun resolveActivity(): Class<*> + + /** * Request all open dialogs be closed. Set [immediately] to true to dismiss without * animations. */ diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt index c1e99f578459..bf7d71635694 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt @@ -149,6 +149,19 @@ class ControlsUiControllerImpl @Inject constructor ( } } + override fun resolveActivity(): Class<*> { + val allStructures = controlsController.get().getFavorites() + val selectedStructure = getPreferredStructure(allStructures) + + return if (controlsController.get().addSeedingFavoritesCallback(onSeedingComplete)) { + ControlsActivity::class.java + } else if (selectedStructure.controls.isEmpty() && allStructures.size <= 1) { + ControlsProviderSelectorActivity::class.java + } else { + ControlsActivity::class.java + } + } + override fun show( parent: ViewGroup, onDismiss: Runnable, diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt index 9ecfb7521151..8eca1bad213b 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt @@ -282,7 +282,8 @@ class KeyguardUnlockAnimationController @Inject constructor( * window like any other app. This can be true while [willUnlockWithSmartspaceTransition] is * false, if the smartspace is not available or was not ready in time. */ - private var willUnlockWithInWindowLauncherAnimations: Boolean = false + @VisibleForTesting + var willUnlockWithInWindowLauncherAnimations: Boolean = false /** * Whether we decided in [prepareForInWindowLauncherAnimations] that we are able to and want to @@ -574,7 +575,7 @@ class KeyguardUnlockAnimationController @Inject constructor( // Now that the Launcher surface (with its smartspace positioned identically to ours) is // visible, hide our smartspace. - lockscreenSmartspace!!.visibility = View.INVISIBLE + lockscreenSmartspace?.visibility = View.INVISIBLE // As soon as the shade has animated out of the way, finish the keyguard exit animation. The // in-window animations in the Launcher window will end on their own. diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DeviceControlsTile.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/DeviceControlsTile.kt index 05b342072974..c65bd9b4348e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DeviceControlsTile.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DeviceControlsTile.kt @@ -31,7 +31,6 @@ import com.android.systemui.controls.ControlsServiceInfo import com.android.systemui.controls.dagger.ControlsComponent import com.android.systemui.controls.dagger.ControlsComponent.Visibility.AVAILABLE import com.android.systemui.controls.management.ControlsListingController -import com.android.systemui.controls.ui.ControlsActivity import com.android.systemui.controls.ui.ControlsUiController import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main @@ -42,7 +41,6 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.qs.QSHost import com.android.systemui.qs.logging.QSLogger import com.android.systemui.qs.tileimpl.QSTileImpl -import com.android.systemui.statusbar.policy.KeyguardStateController import java.util.concurrent.atomic.AtomicBoolean import javax.inject.Inject @@ -55,8 +53,7 @@ class DeviceControlsTile @Inject constructor( statusBarStateController: StatusBarStateController, activityStarter: ActivityStarter, qsLogger: QSLogger, - private val controlsComponent: ControlsComponent, - private val keyguardStateController: KeyguardStateController + private val controlsComponent: ControlsComponent ) : QSTileImpl<QSTile.State>( host, backgroundLooper, @@ -105,7 +102,8 @@ class DeviceControlsTile @Inject constructor( } val intent = Intent().apply { - component = ComponentName(mContext, ControlsActivity::class.java) + component = ComponentName(mContext, controlsComponent.getControlsUiController().get() + .resolveActivity()) addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK) putExtra(ControlsUiController.EXTRA_ANIMATE, true) } @@ -127,10 +125,15 @@ class DeviceControlsTile @Inject constructor( state.icon = icon if (controlsComponent.isEnabled() && hasControlsApps.get()) { if (controlsComponent.getVisibility() == AVAILABLE) { - val structure = controlsComponent - .getControlsController().get().getPreferredStructure().structure - state.state = Tile.STATE_ACTIVE - state.secondaryLabel = if (structure == tileLabel) null else structure + val structureInfo = controlsComponent + .getControlsController().get().getPreferredStructure() + state.state = if (structureInfo.controls.isEmpty()) { + Tile.STATE_INACTIVE + } else { + Tile.STATE_ACTIVE + } + val label = structureInfo.structure + state.secondaryLabel = if (label == tileLabel) null else label } else { state.state = Tile.STATE_INACTIVE state.secondaryLabel = mContext.getText(R.string.controls_tile_locked) diff --git a/packages/SystemUI/src/com/android/systemui/shade/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/PanelViewController.java index 876a1ffa3ecb..a00769374938 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/PanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/PanelViewController.java @@ -397,7 +397,7 @@ public abstract class PanelViewController { mInitialOffsetOnTouch = expandedHeight; mInitialExpandY = newY; mInitialExpandX = newX; - mInitialTouchFromKeyguard = mStatusBarStateController.getState() == StatusBarState.KEYGUARD; + mInitialTouchFromKeyguard = mKeyguardStateController.isShowing(); if (startTracking) { mTouchSlopExceeded = true; setExpandedHeight(mInitialOffsetOnTouch); @@ -416,9 +416,7 @@ public abstract class PanelViewController { float vectorVel = (float) Math.hypot( mVelocityTracker.getXVelocity(), mVelocityTracker.getYVelocity()); - final boolean onKeyguard = - mStatusBarStateController.getState() == StatusBarState.KEYGUARD; - + final boolean onKeyguard = mKeyguardStateController.isShowing(); final boolean expand; if (mKeyguardStateController.isKeyguardFadingAway() || (mInitialTouchFromKeyguard && !onKeyguard)) { diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanelDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanelDialog.java index 2c74fb911688..87a167baf9bf 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanelDialog.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanelDialog.java @@ -52,6 +52,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager; import com.android.settingslib.bluetooth.LocalBluetoothProfileManager; import com.android.settingslib.media.MediaOutputConstants; import com.android.systemui.R; +import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.statusbar.phone.SystemUIDialog; import java.util.ArrayList; @@ -69,6 +70,7 @@ public class VolumePanelDialog extends SystemUIDialog implements LifecycleOwner private static final int DURATION_SLICE_BINDING_TIMEOUT_MS = 200; private static final int DEFAULT_SLICE_SIZE = 4; + private final ActivityStarter mActivityStarter; private RecyclerView mVolumePanelSlices; private VolumePanelSlicesAdapter mVolumePanelSlicesAdapter; private final LifecycleRegistry mLifecycleRegistry; @@ -78,8 +80,10 @@ public class VolumePanelDialog extends SystemUIDialog implements LifecycleOwner private boolean mSlicesReadyToLoad; private LocalBluetoothProfileManager mProfileManager; - public VolumePanelDialog(Context context, boolean aboveStatusBar) { + public VolumePanelDialog(Context context, + ActivityStarter activityStarter, boolean aboveStatusBar) { super(context); + mActivityStarter = activityStarter; mLifecycleRegistry = new LifecycleRegistry(this); if (!aboveStatusBar) { getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY); @@ -100,9 +104,11 @@ public class VolumePanelDialog extends SystemUIDialog implements LifecycleOwner doneButton.setOnClickListener(v -> dismiss()); Button settingsButton = dialogView.findViewById(R.id.settings_button); settingsButton.setOnClickListener(v -> { - getContext().startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS).addFlags( - Intent.FLAG_ACTIVITY_NEW_TASK)); dismiss(); + + Intent intent = new Intent(Settings.ACTION_SOUND_SETTINGS); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + mActivityStarter.startActivity(intent, /* dismissShade= */ true); }); LocalBluetoothManager localBluetoothManager = LocalBluetoothManager.getInstance( diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanelFactory.kt b/packages/SystemUI/src/com/android/systemui/volume/VolumePanelFactory.kt index c2fafbf9f55b..0debe0e4cd80 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanelFactory.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanelFactory.kt @@ -21,6 +21,7 @@ import android.util.Log import android.view.View import com.android.systemui.animation.DialogLaunchAnimator import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.plugins.ActivityStarter import javax.inject.Inject private const val TAG = "VolumePanelFactory" @@ -33,6 +34,7 @@ private val DEBUG = Log.isLoggable(TAG, Log.DEBUG) @SysUISingleton class VolumePanelFactory @Inject constructor( private val context: Context, + private val activityStarter: ActivityStarter, private val dialogLaunchAnimator: DialogLaunchAnimator ) { companion object { @@ -45,7 +47,7 @@ class VolumePanelFactory @Inject constructor( return } - val dialog = VolumePanelDialog(context, aboveStatusBar) + val dialog = VolumePanelDialog(context, activityStarter, aboveStatusBar) volumePanelDialog = dialog // Show the dialog. diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt index a4d223853b12..eecbee56d203 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt @@ -27,11 +27,11 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor.forClass import org.mockito.Mock -import org.mockito.Mockito.`when` import org.mockito.Mockito.mock import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions +import org.mockito.Mockito.`when` import org.mockito.MockitoAnnotations @RunWith(AndroidTestingRunner::class) @@ -218,4 +218,18 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() { assertFalse(keyguardUnlockAnimationController.canPerformInWindowLauncherAnimations()) assertFalse(keyguardUnlockAnimationController.isPlayingCannedUnlockAnimation()) } -}
\ No newline at end of file + + @Test + fun playCannedUnlockAnimation_nullSmartspaceView_doesNotThrowExecption() { + keyguardUnlockAnimationController.lockscreenSmartspace = null + keyguardUnlockAnimationController.willUnlockWithInWindowLauncherAnimations = true + + keyguardUnlockAnimationController.notifyStartSurfaceBehindRemoteAnimation( + remoteAnimationTarget, + 0 /* startTime */, + false /* requestedShowSurfaceBehindKeyguard */ + ) + + assertTrue(keyguardUnlockAnimationController.isPlayingCannedUnlockAnimation()) + } +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DeviceControlsTileTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DeviceControlsTileTest.kt index ed988810fc83..f7b9438e6535 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DeviceControlsTileTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DeviceControlsTileTest.kt @@ -33,17 +33,18 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.classifier.FalsingManagerFake import com.android.systemui.controls.ControlsServiceInfo +import com.android.systemui.controls.controller.ControlInfo import com.android.systemui.controls.controller.ControlsController import com.android.systemui.controls.controller.StructureInfo import com.android.systemui.controls.dagger.ControlsComponent import com.android.systemui.controls.management.ControlsListingController +import com.android.systemui.controls.ui.ControlsActivity import com.android.systemui.controls.ui.ControlsUiController import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.qs.QSHost import com.android.systemui.qs.logging.QSLogger import com.android.systemui.qs.tileimpl.QSTileImpl -import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.capture import com.android.systemui.util.mockito.eq @@ -57,13 +58,13 @@ import org.mockito.ArgumentCaptor import org.mockito.ArgumentMatchers.anyBoolean import org.mockito.Captor import org.mockito.Mock +import org.mockito.MockitoAnnotations import org.mockito.Mockito.`when` import org.mockito.Mockito.doNothing import org.mockito.Mockito.nullable import org.mockito.Mockito.spy import org.mockito.Mockito.verify import org.mockito.Mockito.verifyZeroInteractions -import org.mockito.MockitoAnnotations import java.util.Optional @SmallTest @@ -93,8 +94,6 @@ class DeviceControlsTileTest : SysuiTestCase() { private lateinit var serviceInfo: ControlsServiceInfo @Mock private lateinit var uiEventLogger: UiEventLogger - @Mock - private lateinit var keyguardStateController: KeyguardStateController @Captor private lateinit var listingCallbackCaptor: ArgumentCaptor<ControlsListingController.ControlsListingCallback> @@ -119,7 +118,6 @@ class DeviceControlsTileTest : SysuiTestCase() { `when`(qsHost.context).thenReturn(spiedContext) `when`(qsHost.uiEventLogger).thenReturn(uiEventLogger) `when`(controlsComponent.isEnabled()).thenReturn(true) - `when`(keyguardStateController.isUnlocked()).thenReturn(true) `when`(controlsController.getPreferredStructure()) .thenReturn(StructureInfo(ComponentName("pkg", "cls"), "structure", listOf())) secureSettings.putInt(Settings.Secure.LOCKSCREEN_SHOW_CONTROLS, 1) @@ -222,12 +220,19 @@ class DeviceControlsTileTest : SysuiTestCase() { } @Test - fun testStateAvailableIfListings() { + fun testStateActiveIfListingsHasControlsFavorited() { verify(controlsListingController).observe( any(LifecycleOwner::class.java), capture(listingCallbackCaptor) ) `when`(controlsComponent.getVisibility()).thenReturn(ControlsComponent.Visibility.AVAILABLE) + `when`(controlsController.getPreferredStructure()).thenReturn( + StructureInfo( + ComponentName("pkg", "cls"), + "structure", + listOf(ControlInfo("id", "title", "subtitle", 1)) + ) + ) listingCallbackCaptor.value.onServicesUpdated(listOf(serviceInfo)) testableLooper.processAllMessages() @@ -236,6 +241,22 @@ class DeviceControlsTileTest : SysuiTestCase() { } @Test + fun testStateInactiveIfListingsHasNoControlsFavorited() { + verify(controlsListingController).observe( + any(LifecycleOwner::class.java), + capture(listingCallbackCaptor) + ) + `when`(controlsComponent.getVisibility()).thenReturn(ControlsComponent.Visibility.AVAILABLE) + `when`(controlsController.getPreferredStructure()) + .thenReturn(StructureInfo(ComponentName("pkg", "cls"), "structure", listOf())) + + listingCallbackCaptor.value.onServicesUpdated(listOf(serviceInfo)) + testableLooper.processAllMessages() + + assertThat(tile.state.state).isEqualTo(Tile.STATE_INACTIVE) + } + + @Test fun testStateInactiveIfLocked() { verify(controlsListingController).observe( any(LifecycleOwner::class.java), @@ -281,7 +302,14 @@ class DeviceControlsTileTest : SysuiTestCase() { capture(listingCallbackCaptor) ) `when`(controlsComponent.getVisibility()).thenReturn(ControlsComponent.Visibility.AVAILABLE) - `when`(keyguardStateController.isUnlocked).thenReturn(true) + `when`(controlsUiController.resolveActivity()).thenReturn(ControlsActivity::class.java) + `when`(controlsController.getPreferredStructure()).thenReturn( + StructureInfo( + ComponentName("pkg", "cls"), + "structure", + listOf(ControlInfo("id", "title", "subtitle", 1)) + ) + ) listingCallbackCaptor.value.onServicesUpdated(listOf(serviceInfo)) testableLooper.processAllMessages() @@ -305,7 +333,14 @@ class DeviceControlsTileTest : SysuiTestCase() { ) `when`(controlsComponent.getVisibility()) .thenReturn(ControlsComponent.Visibility.AVAILABLE_AFTER_UNLOCK) - `when`(keyguardStateController.isUnlocked).thenReturn(false) + `when`(controlsUiController.resolveActivity()).thenReturn(ControlsActivity::class.java) + `when`(controlsController.getPreferredStructure()).thenReturn( + StructureInfo( + ComponentName("pkg", "cls"), + "structure", + listOf(ControlInfo("id", "title", "subtitle", 1)) + ) + ) listingCallbackCaptor.value.onServicesUpdated(listOf(serviceInfo)) testableLooper.processAllMessages() @@ -345,8 +380,7 @@ class DeviceControlsTileTest : SysuiTestCase() { statusBarStateController, activityStarter, qsLogger, - controlsComponent, - keyguardStateController + controlsComponent ).also { it.initialize() testableLooper.processAllMessages() diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index cb5996035c4a..537b04d7059c 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -2183,9 +2183,7 @@ public class DisplayPolicy { } mDecorInsets.invalidate(); mDecorInsets.mInfoForRotation[rotation].set(newInfo); - // If the device is booting, let the boot procedure trigger the new configuration. - // Otherwise the display configuration needs to be recomputed now. - return mService.mDisplayEnabled; + return true; } DecorInsets.Info getDecorInsetsInfo(int rotation, int w, int h) { |