Merge changes from topic "revert-26719621-VJCEHBBDKS" into main
* changes:
Revert "Aslgen tests"
Revert "Adding more supported fields/logic to aslgen."
diff --git a/Ravenwood.bp b/Ravenwood.bp
index f43c37b..6237e3e 100644
--- a/Ravenwood.bp
+++ b/Ravenwood.bp
@@ -77,6 +77,19 @@
],
}
+// Extract the stats file.
+genrule {
+ name: "framework-minus-apex.ravenwood.stats",
+ defaults: ["ravenwood-internal-only-visibility-genrule"],
+ cmd: "cp $(in) $(out)",
+ srcs: [
+ ":framework-minus-apex.ravenwood-base{hoststubgen_framework-minus-apex_stats.csv}",
+ ],
+ out: [
+ "hoststubgen_framework-minus-apex_stats.csv",
+ ],
+}
+
java_library {
name: "services.core-for-hoststubgen",
installable: false, // host only jar.
@@ -135,6 +148,19 @@
],
}
+// Extract the stats file.
+genrule {
+ name: "services.core.ravenwood.stats",
+ defaults: ["ravenwood-internal-only-visibility-genrule"],
+ cmd: "cp $(in) $(out)",
+ srcs: [
+ ":services.core.ravenwood-base{hoststubgen_services.core_stats.csv}",
+ ],
+ out: [
+ "hoststubgen_services.core_stats.csv",
+ ],
+}
+
java_library {
name: "services.core.ravenwood-jarjar",
installable: false,
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index bff90f1..5d4babb 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -847,5 +847,5 @@
@EnforcePermission("GET_APP_METADATA")
int getAppMetadataSource(String packageName, int userId);
- ComponentName getDomainVerificationAgent();
+ ComponentName getDomainVerificationAgent(int userId);
}
diff --git a/core/java/android/view/BatchedInputEventReceiver.java b/core/java/android/view/BatchedInputEventReceiver.java
index ca2e56d..2e39f73 100644
--- a/core/java/android/view/BatchedInputEventReceiver.java
+++ b/core/java/android/view/BatchedInputEventReceiver.java
@@ -29,6 +29,7 @@
private Choreographer mChoreographer;
private boolean mBatchingEnabled;
private boolean mBatchedInputScheduled;
+ private final String mTag;
private final Handler mHandler;
private final Runnable mConsumeBatchedInputEvents = new Runnable() {
@Override
@@ -43,6 +44,7 @@
super(inputChannel, looper);
mChoreographer = choreographer;
mBatchingEnabled = true;
+ mTag = inputChannel.getName();
traceBoolVariable("mBatchingEnabled", mBatchingEnabled);
traceBoolVariable("mBatchedInputScheduled", mBatchedInputScheduled);
mHandler = new Handler(looper);
@@ -123,7 +125,12 @@
private final class BatchedInputRunnable implements Runnable {
@Override
public void run() {
- doConsumeBatchedInput(mChoreographer.getFrameTimeNanos());
+ try {
+ Trace.traceBegin(Trace.TRACE_TAG_INPUT, mTag);
+ doConsumeBatchedInput(mChoreographer.getFrameTimeNanos());
+ } finally {
+ Trace.traceEnd(Trace.TRACE_TAG_INPUT);
+ }
}
}
private final BatchedInputRunnable mBatchedInputRunnable = new BatchedInputRunnable();
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 49d4af8..0d9e471 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -10173,13 +10173,18 @@
final class ConsumeBatchedInputRunnable implements Runnable {
@Override
public void run() {
- mConsumeBatchedInputScheduled = false;
- if (doConsumeBatchedInput(mChoreographer.getFrameTimeNanos())) {
- // If we consumed a batch here, we want to go ahead and schedule the
- // consumption of batched input events on the next frame. Otherwise, we would
- // wait until we have more input events pending and might get starved by other
- // things occurring in the process.
- scheduleConsumeBatchedInput();
+ Trace.traceBegin(TRACE_TAG_VIEW, mTag);
+ try {
+ mConsumeBatchedInputScheduled = false;
+ if (doConsumeBatchedInput(mChoreographer.getFrameTimeNanos())) {
+ // If we consumed a batch here, we want to go ahead and schedule the
+ // consumption of batched input events on the next frame. Otherwise, we would
+ // wait until we have more input events pending and might get starved by other
+ // things occurring in the process.
+ scheduleConsumeBatchedInput();
+ }
+ } finally {
+ Trace.traceEnd(TRACE_TAG_VIEW);
}
}
}
diff --git a/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java b/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java
index 9df93f9..e12becd 100644
--- a/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java
+++ b/core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java
@@ -407,8 +407,10 @@
*/
private ParseResult<ParsingPackage> parseMonolithicPackage(ParseInput input, File apkFile,
int flags) {
+ // The signature parsing will be done later in method parseBaseApk.
+ int liteParseFlags = flags & ~PARSE_COLLECT_CERTIFICATES;
final ParseResult<PackageLite> liteResult =
- ApkLiteParseUtils.parseMonolithicPackageLite(input, apkFile, flags);
+ ApkLiteParseUtils.parseMonolithicPackageLite(input, apkFile, liteParseFlags);
if (liteResult.isError()) {
return input.error(liteResult);
}
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt
index a1d8c29..bdd888f 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalContainer.kt
@@ -8,12 +8,15 @@
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.dimensionResource
import com.android.compose.animation.scene.Edge
import com.android.compose.animation.scene.ElementKey
import com.android.compose.animation.scene.FixedSizeEdgeDetector
import com.android.compose.animation.scene.LowestZIndexScenePicker
+import com.android.compose.animation.scene.MutableSceneTransitionLayoutState
import com.android.compose.animation.scene.SceneKey
import com.android.compose.animation.scene.SceneScope
import com.android.compose.animation.scene.SceneTransitionLayout
@@ -21,12 +24,13 @@
import com.android.compose.animation.scene.SwipeDirection
import com.android.compose.animation.scene.observableTransitionState
import com.android.compose.animation.scene.transitions
-import com.android.compose.animation.scene.updateSceneTransitionLayoutState
import com.android.compose.theme.LocalAndroidColorScheme
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.communal.ui.viewmodel.BaseCommunalViewModel
import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import com.android.systemui.res.R
+import com.android.systemui.scene.shared.model.SceneDataSourceDelegator
+import com.android.systemui.scene.ui.composable.SceneTransitionLayoutDataSource
import com.android.systemui.statusbar.phone.SystemUIDialogFactory
object Communal {
@@ -63,27 +67,35 @@
fun CommunalContainer(
modifier: Modifier = Modifier,
viewModel: CommunalViewModel,
+ dataSourceDelegator: SceneDataSourceDelegator,
dialogFactory: SystemUIDialogFactory,
) {
- val currentScene: SceneKey by viewModel.currentScene.collectAsState(CommunalScenes.Blank)
- val sceneTransitionLayoutState =
- updateSceneTransitionLayoutState(
- currentScene,
- onChangeScene = { viewModel.onSceneChanged(it) },
+ val coroutineScope = rememberCoroutineScope()
+ val currentSceneKey: SceneKey by viewModel.currentScene.collectAsState(CommunalScenes.Blank)
+ val touchesAllowed by viewModel.touchesAllowed.collectAsState(initial = false)
+ val state: MutableSceneTransitionLayoutState = remember {
+ MutableSceneTransitionLayoutState(
+ initialScene = currentSceneKey,
transitions = sceneTransitions,
enableInterruptions = false,
)
- val touchesAllowed by viewModel.touchesAllowed.collectAsState(initial = false)
+ }
+
+ DisposableEffect(state) {
+ val dataSource = SceneTransitionLayoutDataSource(state, coroutineScope)
+ dataSourceDelegator.setDelegate(dataSource)
+ onDispose { dataSourceDelegator.setDelegate(null) }
+ }
// This effect exposes the SceneTransitionLayout's observable transition state to the rest of
// the system, and unsets it when the view is disposed to avoid a memory leak.
- DisposableEffect(viewModel, sceneTransitionLayoutState) {
- viewModel.setTransitionState(sceneTransitionLayoutState.observableTransitionState())
+ DisposableEffect(viewModel, state) {
+ viewModel.setTransitionState(state.observableTransitionState())
onDispose { viewModel.setTransitionState(null) }
}
SceneTransitionLayout(
- state = sceneTransitionLayoutState,
+ state = state,
modifier = modifier.fillMaxSize(),
swipeSourceDetector =
FixedSizeEdgeDetector(
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt
index 320c455..c008a1a 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt
@@ -16,10 +16,15 @@
package com.android.systemui.keyguard.ui.composable.blueprint
+import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.collectAsState
+import androidx.compose.runtime.getValue
+import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.unit.IntRect
@@ -28,6 +33,7 @@
import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection
import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection
import com.android.systemui.keyguard.ui.composable.section.LockSection
+import com.android.systemui.keyguard.ui.composable.section.NotificationSection
import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection
import com.android.systemui.keyguard.ui.composable.section.StatusBarSection
import com.android.systemui.keyguard.ui.composable.section.TopAreaSection
@@ -52,6 +58,7 @@
private val bottomAreaSection: BottomAreaSection,
private val settingsMenuSection: SettingsMenuSection,
private val topAreaSection: TopAreaSection,
+ private val notificationSection: NotificationSection,
) : ComposableLockscreenSceneBlueprint {
override val id: String = "default"
@@ -59,6 +66,8 @@
@Composable
override fun SceneScope.Content(modifier: Modifier) {
val isUdfpsVisible = viewModel.isUdfpsVisible
+ val shouldUseSplitNotificationShade by
+ viewModel.shouldUseSplitNotificationShade.collectAsState()
LockscreenLongPress(
viewModel = viewModel.longPress,
@@ -68,10 +77,27 @@
content = {
// Constrained to above the lock icon.
Column(
- modifier = Modifier.fillMaxWidth(),
+ modifier = Modifier.fillMaxSize(),
) {
with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) }
- with(topAreaSection) { DefaultClockLayoutWithNotifications() }
+
+ Box {
+ with(topAreaSection) { DefaultClockLayout() }
+ if (shouldUseSplitNotificationShade) {
+ with(notificationSection) {
+ Notifications(
+ Modifier.fillMaxWidth(0.5f)
+ .fillMaxHeight()
+ .align(alignment = Alignment.TopEnd)
+ )
+ }
+ }
+ }
+ if (!shouldUseSplitNotificationShade) {
+ with(notificationSection) {
+ Notifications(Modifier.weight(weight = 1f))
+ }
+ }
if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) {
with(ambientIndicationSectionOptional.get()) {
AmbientIndication(modifier = Modifier.fillMaxWidth())
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt
index 64c2cb3..091a439 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt
@@ -16,10 +16,15 @@
package com.android.systemui.keyguard.ui.composable.blueprint
+import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.collectAsState
+import androidx.compose.runtime.getValue
+import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.unit.IntRect
@@ -28,6 +33,7 @@
import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection
import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection
import com.android.systemui.keyguard.ui.composable.section.LockSection
+import com.android.systemui.keyguard.ui.composable.section.NotificationSection
import com.android.systemui.keyguard.ui.composable.section.SettingsMenuSection
import com.android.systemui.keyguard.ui.composable.section.StatusBarSection
import com.android.systemui.keyguard.ui.composable.section.TopAreaSection
@@ -52,6 +58,7 @@
private val bottomAreaSection: BottomAreaSection,
private val settingsMenuSection: SettingsMenuSection,
private val topAreaSection: TopAreaSection,
+ private val notificationSection: NotificationSection,
) : ComposableLockscreenSceneBlueprint {
override val id: String = "shortcuts-besides-udfps"
@@ -59,6 +66,8 @@
@Composable
override fun SceneScope.Content(modifier: Modifier) {
val isUdfpsVisible = viewModel.isUdfpsVisible
+ val shouldUseSplitNotificationShade by
+ viewModel.shouldUseSplitNotificationShade.collectAsState()
LockscreenLongPress(
viewModel = viewModel.longPress,
@@ -68,11 +77,27 @@
content = {
// Constrained to above the lock icon.
Column(
- modifier = Modifier.fillMaxWidth(),
+ modifier = Modifier.fillMaxSize(),
) {
with(statusBarSection) { StatusBar(modifier = Modifier.fillMaxWidth()) }
- with(topAreaSection) { DefaultClockLayoutWithNotifications() }
+ Box {
+ with(topAreaSection) { DefaultClockLayout() }
+ if (shouldUseSplitNotificationShade) {
+ with(notificationSection) {
+ Notifications(
+ Modifier.fillMaxWidth(0.5f)
+ .fillMaxHeight()
+ .align(alignment = Alignment.TopEnd)
+ )
+ }
+ }
+ }
+ if (!shouldUseSplitNotificationShade) {
+ with(notificationSection) {
+ Notifications(Modifier.weight(weight = 1f))
+ }
+ }
if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) {
with(ambientIndicationSectionOptional.get()) {
AmbientIndication(modifier = Modifier.fillMaxWidth())
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/WeatherClockBlueprint.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/WeatherClockBlueprint.kt
index fe774a0..09d76a3 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/WeatherClockBlueprint.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/WeatherClockBlueprint.kt
@@ -86,6 +86,7 @@
val burnIn = rememberBurnIn(clockInteractor)
val resources = LocalContext.current.resources
val currentClockState = clockViewModel.currentClock.collectAsState()
+ val areNotificationsVisible by viewModel.areNotificationsVisible.collectAsState()
LockscreenLongPress(
viewModel = viewModel.longPress,
modifier = modifier,
@@ -145,7 +146,7 @@
with(mediaCarouselSection) { MediaCarousel() }
- if (viewModel.areNotificationsVisible) {
+ if (areNotificationsVisible) {
with(notificationSection) {
Notifications(
modifier = Modifier.fillMaxWidth().weight(weight = 1f)
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt
index 6b86a48..fa0a1c4 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt
@@ -17,12 +17,25 @@
package com.android.systemui.keyguard.ui.composable.section
import android.view.ViewGroup
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.collectAsState
+import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.dimensionResource
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
import com.android.compose.animation.scene.SceneScope
+import com.android.compose.modifiers.thenIf
+import com.android.systemui.Flags
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.MigrateClocksToBlueprint
+import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel
import com.android.systemui.notifications.ui.composable.NotificationStack
+import com.android.systemui.res.R
+import com.android.systemui.shade.LargeScreenHeaderHelper
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder
@@ -39,6 +52,7 @@
sharedNotificationContainerViewModel: SharedNotificationContainerViewModel,
stackScrollLayout: NotificationStackScrollLayout,
sharedNotificationContainerBinder: SharedNotificationContainerBinder,
+ private val lockscreenContentViewModel: LockscreenContentViewModel,
) {
init {
@@ -65,9 +79,27 @@
@Composable
fun SceneScope.Notifications(modifier: Modifier = Modifier) {
+ val shouldUseSplitNotificationShade by
+ lockscreenContentViewModel.shouldUseSplitNotificationShade.collectAsState()
+ val areNotificationsVisible by
+ lockscreenContentViewModel.areNotificationsVisible.collectAsState()
+ val splitShadeTopMargin: Dp =
+ if (Flags.centralizedStatusBarHeightFix()) {
+ LargeScreenHeaderHelper.getLargeScreenHeaderHeight(LocalContext.current).dp
+ } else {
+ dimensionResource(id = R.dimen.large_screen_shade_header_height)
+ }
+
+ if (!areNotificationsVisible) {
+ return
+ }
+
NotificationStack(
viewModel = viewModel,
- modifier = modifier,
+ modifier =
+ modifier.fillMaxWidth().thenIf(shouldUseSplitNotificationShade) {
+ Modifier.padding(top = splitShadeTopMargin)
+ },
)
}
}
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt
index b4472fc..f8e6341 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt
@@ -16,30 +16,20 @@
package com.android.systemui.keyguard.ui.composable.section
-import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.offset
-import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
-import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.LocalContext
-import androidx.compose.ui.res.dimensionResource
-import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntOffset
-import androidx.compose.ui.unit.dp
+import com.android.compose.animation.scene.SceneScope
import com.android.compose.animation.scene.SceneTransitionLayout
import com.android.compose.modifiers.thenIf
-import com.android.systemui.Flags
import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor
import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.largeClockScene
import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.smallClockScene
@@ -48,8 +38,6 @@
import com.android.systemui.keyguard.ui.composable.blueprint.ClockTransition
import com.android.systemui.keyguard.ui.composable.blueprint.rememberBurnIn
import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel
-import com.android.systemui.res.R
-import com.android.systemui.shade.LargeScreenHeaderHelper
import javax.inject.Inject
class TopAreaSection
@@ -58,19 +46,16 @@
private val clockViewModel: KeyguardClockViewModel,
private val smartSpaceSection: SmartSpaceSection,
private val mediaCarouselSection: MediaCarouselSection,
- private val notificationSection: NotificationSection,
private val clockSection: DefaultClockSection,
private val clockInteractor: KeyguardClockInteractor,
) {
@Composable
- fun DefaultClockLayoutWithNotifications(
+ fun DefaultClockLayout(
modifier: Modifier = Modifier,
) {
- val isLargeClockVisible by clockViewModel.isLargeClockVisible.collectAsState()
val currentClockLayout by clockViewModel.currentClockLayout.collectAsState()
val hasCustomPositionUpdatedAnimation by
clockViewModel.hasCustomPositionUpdatedAnimation.collectAsState()
-
val currentScene =
when (currentClockLayout) {
KeyguardClockViewModel.ClockLayout.SPLIT_SHADE_LARGE_CLOCK ->
@@ -81,144 +66,83 @@
KeyguardClockViewModel.ClockLayout.SMALL_CLOCK -> smallClockScene
}
- val splitShadeTopMargin: Dp =
- if (Flags.centralizedStatusBarHeightFix()) {
- LargeScreenHeaderHelper.getLargeScreenHeaderHeight(LocalContext.current).dp
- } else {
- dimensionResource(id = R.dimen.large_screen_shade_header_height)
+ SceneTransitionLayout(
+ modifier = modifier,
+ currentScene = currentScene,
+ onChangeScene = {},
+ transitions = ClockTransition.defaultClockTransitions,
+ enableInterruptions = false,
+ ) {
+ scene(splitShadeLargeClockScene) {
+ LargeClockWithSmartSpace(
+ shouldOffSetClockToOneHalf = !hasCustomPositionUpdatedAnimation
+ )
}
+
+ scene(splitShadeSmallClockScene) {
+ SmallClockWithSmartSpace(modifier = Modifier.fillMaxWidth(0.5f))
+ }
+
+ scene(smallClockScene) { SmallClockWithSmartSpace() }
+
+ scene(largeClockScene) { LargeClockWithSmartSpace() }
+ }
+ }
+
+ @Composable
+ private fun SceneScope.SmallClockWithSmartSpace(modifier: Modifier = Modifier) {
val burnIn = rememberBurnIn(clockInteractor)
+ Column(modifier = modifier) {
+ with(clockSection) {
+ SmallClock(
+ burnInParams = burnIn.parameters,
+ onTopChanged = burnIn.onSmallClockTopChanged,
+ modifier = Modifier.wrapContentSize()
+ )
+ }
+ with(smartSpaceSection) {
+ SmartSpace(
+ burnInParams = burnIn.parameters,
+ onTopChanged = burnIn.onSmartspaceTopChanged,
+ )
+ }
+ with(mediaCarouselSection) { MediaCarousel() }
+ }
+ }
+
+ @Composable
+ private fun SceneScope.LargeClockWithSmartSpace(shouldOffSetClockToOneHalf: Boolean = false) {
+ val burnIn = rememberBurnIn(clockInteractor)
+ val isLargeClockVisible by clockViewModel.isLargeClockVisible.collectAsState()
+
LaunchedEffect(isLargeClockVisible) {
if (isLargeClockVisible) {
burnIn.onSmallClockTopChanged(null)
}
}
- SceneTransitionLayout(
- modifier = modifier.fillMaxSize(),
- currentScene = currentScene,
- onChangeScene = {},
- transitions = ClockTransition.defaultClockTransitions,
- enableInterruptions = false,
- ) {
- scene(splitShadeLargeClockScene) {
- Box(modifier = Modifier.fillMaxSize()) {
- Column(
- modifier = Modifier.fillMaxSize(),
- horizontalAlignment = Alignment.CenterHorizontally,
- ) {
- with(smartSpaceSection) {
- SmartSpace(
- burnInParams = burnIn.parameters,
- onTopChanged = burnIn.onSmartspaceTopChanged,
- )
- }
-
- with(clockSection) {
- LargeClock(
- modifier =
- Modifier.fillMaxSize().thenIf(
- !hasCustomPositionUpdatedAnimation
- ) {
- // If we do not have a custom position animation, we want
- // the clock to be on one half of the screen.
- Modifier.offset {
- IntOffset(
- x =
- -clockSection
- .getClockCenteringDistance()
- .toInt(),
- y = 0,
- )
- }
- }
- )
- }
- }
- }
-
- Row(
- modifier = Modifier.fillMaxSize(),
- ) {
- Spacer(modifier = Modifier.weight(weight = 1f))
- with(notificationSection) {
- Notifications(
- modifier =
- Modifier.fillMaxHeight()
- .weight(weight = 1f)
- .padding(top = splitShadeTopMargin)
- )
- }
- }
+ Column {
+ with(smartSpaceSection) {
+ SmartSpace(
+ burnInParams = burnIn.parameters,
+ onTopChanged = burnIn.onSmartspaceTopChanged,
+ )
}
-
- scene(splitShadeSmallClockScene) {
- Row(
- modifier = Modifier.fillMaxSize(),
- ) {
- Column(
- modifier = Modifier.fillMaxHeight().weight(weight = 1f),
- horizontalAlignment = Alignment.CenterHorizontally,
- ) {
- with(clockSection) {
- SmallClock(
- burnInParams = burnIn.parameters,
- onTopChanged = burnIn.onSmallClockTopChanged,
- modifier = Modifier.wrapContentSize()
- )
+ with(clockSection) {
+ LargeClock(
+ modifier =
+ Modifier.fillMaxSize().thenIf(shouldOffSetClockToOneHalf) {
+ // If we do not have a custom position animation, we want
+ // the clock to be on one half of the screen.
+ Modifier.offset {
+ IntOffset(
+ x = -clockSection.getClockCenteringDistance().toInt(),
+ y = 0,
+ )
+ }
}
- with(smartSpaceSection) {
- SmartSpace(
- burnInParams = burnIn.parameters,
- onTopChanged = burnIn.onSmartspaceTopChanged,
- )
- }
- with(mediaCarouselSection) { MediaCarousel() }
- }
- with(notificationSection) {
- Notifications(
- modifier =
- Modifier.fillMaxHeight()
- .weight(weight = 1f)
- .padding(top = splitShadeTopMargin)
- )
- }
- }
- }
-
- scene(smallClockScene) {
- Column {
- with(clockSection) {
- SmallClock(
- burnInParams = burnIn.parameters,
- onTopChanged = burnIn.onSmallClockTopChanged,
- modifier = Modifier.wrapContentSize()
- )
- }
- with(smartSpaceSection) {
- SmartSpace(
- burnInParams = burnIn.parameters,
- onTopChanged = burnIn.onSmartspaceTopChanged,
- )
- }
- with(mediaCarouselSection) { MediaCarousel() }
- with(notificationSection) {
- Notifications(modifier = Modifier.fillMaxWidth().weight(weight = 1f))
- }
- }
- }
-
- scene(largeClockScene) {
- Column {
- with(smartSpaceSection) {
- SmartSpace(
- burnInParams = burnIn.parameters,
- onTopChanged = burnIn.onSmartspaceTopChanged,
- )
- }
- with(clockSection) { LargeClock(modifier = Modifier.fillMaxSize()) }
- }
+ )
}
}
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt
index 43266bf..a944afb 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt
@@ -88,7 +88,7 @@
testScope.runTest {
val scene by collectLastValue(communalInteractor.desiredScene)
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
assertThat(scene).isEqualTo(CommunalScenes.Communal)
fakeKeyguardTransitionRepository.sendTransitionSteps(
@@ -158,7 +158,7 @@
with(kosmos) {
testScope.runTest {
val scene by collectLastValue(communalInteractor.desiredScene)
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
assertThat(scene).isEqualTo(CommunalScenes.Communal)
fakeKeyguardTransitionRepository.sendTransitionSteps(
@@ -179,7 +179,7 @@
with(kosmos) {
testScope.runTest {
val scene by collectLastValue(communalInteractor.desiredScene)
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
assertThat(scene).isEqualTo(CommunalScenes.Communal)
fakeKeyguardTransitionRepository.sendTransitionSteps(
@@ -207,7 +207,7 @@
fun dockingOnLockscreen_forcesCommunal() =
with(kosmos) {
testScope.runTest {
- communalInteractor.onSceneChanged(CommunalScenes.Blank)
+ communalInteractor.changeScene(CommunalScenes.Blank)
val scene by collectLastValue(communalInteractor.desiredScene)
// device is docked while on the lockscreen
@@ -229,7 +229,7 @@
fun dockingOnLockscreen_doesNotForceCommunalIfDreamStarts() =
with(kosmos) {
testScope.runTest {
- communalInteractor.onSceneChanged(CommunalScenes.Blank)
+ communalInteractor.changeScene(CommunalScenes.Blank)
val scene by collectLastValue(communalInteractor.desiredScene)
// device is docked while on the lockscreen
@@ -261,7 +261,7 @@
testScope.runTest {
// Device is dreaming and on communal.
fakeKeyguardRepository.setDreaming(true)
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
val scene by collectLastValue(communalInteractor.desiredScene)
assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -278,7 +278,7 @@
testScope.runTest {
// Device is not dreaming and on communal.
fakeKeyguardRepository.setDreaming(false)
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
// Scene stays as Communal
advanceTimeBy(SCREEN_TIMEOUT.milliseconds)
@@ -293,7 +293,7 @@
testScope.runTest {
// Device is dreaming and on communal.
fakeKeyguardRepository.setDreaming(true)
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
val scene by collectLastValue(communalInteractor.desiredScene)
assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -316,7 +316,7 @@
testScope.runTest {
// Device is on communal, but not dreaming.
fakeKeyguardRepository.setDreaming(false)
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
val scene by collectLastValue(communalInteractor.desiredScene)
assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -338,7 +338,7 @@
testScope.runTest {
// Device is dreaming and on communal.
fakeKeyguardRepository.setDreaming(true)
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
val scene by collectLastValue(communalInteractor.desiredScene)
assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -367,7 +367,7 @@
// Device is dreaming and on communal.
fakeKeyguardRepository.setDreaming(true)
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
val scene by collectLastValue(communalInteractor.desiredScene)
assertThat(scene).isEqualTo(CommunalScenes.Communal)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalRepositoryImplTest.kt
index 43acf31..2d78a9b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalRepositoryImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalRepositoryImplTest.kt
@@ -22,36 +22,26 @@
import com.android.systemui.SysuiTestCase
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.coroutines.collectLastValue
+import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.kosmos.testScope
-import com.android.systemui.scene.data.repository.sceneContainerRepository
-import com.android.systemui.scene.shared.flag.fakeSceneContainerFlags
+import com.android.systemui.scene.shared.model.sceneDataSource
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
-import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@SmallTest
@RunWith(AndroidJUnit4::class)
class CommunalRepositoryImplTest : SysuiTestCase() {
- private lateinit var underTest: CommunalRepositoryImpl
private val kosmos = testKosmos()
private val testScope = kosmos.testScope
- private val sceneContainerRepository = kosmos.sceneContainerRepository
-
- @Before
- fun setUp() {
- underTest = createRepositoryImpl(false)
- }
-
- private fun createRepositoryImpl(sceneContainerEnabled: Boolean): CommunalRepositoryImpl {
- return CommunalRepositoryImpl(
- testScope.backgroundScope,
- kosmos.fakeSceneContainerFlags.apply { enabled = sceneContainerEnabled },
- sceneContainerRepository,
+ private val underTest by lazy {
+ CommunalRepositoryImpl(
+ kosmos.applicationCoroutineScope,
+ kosmos.sceneDataSource,
)
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt
index 8e9d769..e7ccde2 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt
@@ -482,7 +482,7 @@
assertThat(desiredScene()).isEqualTo(CommunalScenes.Blank)
val targetScene = CommunalScenes.Communal
- communalRepository.setDesiredScene(targetScene)
+ communalRepository.changeScene(targetScene)
desiredScene = collectLastValue(underTest.desiredScene)
runCurrent()
assertThat(desiredScene()).isEqualTo(targetScene)
@@ -493,9 +493,9 @@
testScope.runTest {
val targetScene = CommunalScenes.Communal
- underTest.onSceneChanged(targetScene)
+ underTest.changeScene(targetScene)
- val desiredScene = collectLastValue(communalRepository.desiredScene)
+ val desiredScene = collectLastValue(communalRepository.currentScene)
runCurrent()
assertThat(desiredScene()).isEqualTo(targetScene)
}
@@ -508,7 +508,7 @@
val desiredScene by collectLastValue(underTest.desiredScene)
- underTest.onSceneChanged(CommunalScenes.Communal)
+ underTest.changeScene(CommunalScenes.Communal)
assertThat(desiredScene).isEqualTo(CommunalScenes.Communal)
kosmos.setCommunalAvailable(false)
@@ -659,7 +659,7 @@
runCurrent()
assertThat(isCommunalShowing()).isEqualTo(false)
- underTest.onSceneChanged(CommunalScenes.Communal)
+ underTest.changeScene(CommunalScenes.Communal)
isCommunalShowing = collectLastValue(underTest.isCommunalShowing)
runCurrent()
@@ -683,12 +683,12 @@
assertThat(isCommunalShowing).isFalse()
// Verify scene changes (without the flag) to communal sets the value to true
- underTest.onSceneChanged(CommunalScenes.Communal)
+ underTest.changeScene(CommunalScenes.Communal)
runCurrent()
assertThat(isCommunalShowing).isTrue()
// Verify scene changes (without the flag) to blank sets the value back to false
- underTest.onSceneChanged(CommunalScenes.Blank)
+ underTest.changeScene(CommunalScenes.Blank)
runCurrent()
assertThat(isCommunalShowing).isFalse()
}
@@ -704,7 +704,7 @@
assertThat(isCommunalShowing).isFalse()
// Verify scene changes without the flag doesn't have any impact
- underTest.onSceneChanged(CommunalScenes.Communal)
+ underTest.changeScene(CommunalScenes.Communal)
runCurrent()
assertThat(isCommunalShowing).isFalse()
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalTutorialInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalTutorialInteractorTest.kt
index 50b8da6..3a23e14 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalTutorialInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalTutorialInteractorTest.kt
@@ -158,7 +158,7 @@
kosmos.setCommunalAvailable(true)
communalTutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_NOT_STARTED)
- communalInteractor.onSceneChanged(CommunalScenes.Blank)
+ communalInteractor.changeScene(CommunalScenes.Blank)
assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_NOT_STARTED)
}
@@ -171,7 +171,7 @@
goToCommunal()
communalTutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_STARTED)
- communalInteractor.onSceneChanged(CommunalScenes.Blank)
+ communalInteractor.changeScene(CommunalScenes.Blank)
assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_COMPLETED)
}
@@ -184,13 +184,13 @@
goToCommunal()
communalTutorialRepository.setTutorialSettingState(HUB_MODE_TUTORIAL_COMPLETED)
- communalInteractor.onSceneChanged(CommunalScenes.Blank)
+ communalInteractor.changeScene(CommunalScenes.Blank)
assertThat(tutorialSettingState).isEqualTo(HUB_MODE_TUTORIAL_COMPLETED)
}
private suspend fun goToCommunal() {
kosmos.setCommunalAvailable(true)
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
}
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlowsTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlowsTest.kt
index ad2ae8b..e6b3017 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlowsTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlowsTest.kt
@@ -20,6 +20,7 @@
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.bouncer.domain.interactor.mockPrimaryBouncerInteractor
+import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectValues
import com.android.systemui.flags.Flags
import com.android.systemui.flags.fakeFeatureFlagsClassic
@@ -149,6 +150,38 @@
}
@Test
+ fun showAllNotifications_isTrue_whenLeaveShadeOpen() =
+ testScope.runTest {
+ val showAllNotifications by
+ collectLastValue(underTest.showAllNotifications(500.milliseconds, PRIMARY_BOUNCER))
+
+ sysuiStatusBarStateController.setLeaveOpenOnKeyguardHide(true)
+
+ keyguardTransitionRepository.sendTransitionStep(step(0f, TransitionState.STARTED))
+ keyguardTransitionRepository.sendTransitionStep(step(0.1f))
+
+ assertThat(showAllNotifications).isTrue()
+ keyguardTransitionRepository.sendTransitionStep(step(1f, TransitionState.FINISHED))
+ assertThat(showAllNotifications).isFalse()
+ }
+
+ @Test
+ fun showAllNotifications_isFalse_whenLeaveShadeIsNotOpen() =
+ testScope.runTest {
+ val showAllNotifications by
+ collectLastValue(underTest.showAllNotifications(500.milliseconds, PRIMARY_BOUNCER))
+
+ sysuiStatusBarStateController.setLeaveOpenOnKeyguardHide(false)
+
+ keyguardTransitionRepository.sendTransitionStep(step(0f, TransitionState.STARTED))
+ keyguardTransitionRepository.sendTransitionStep(step(0.1f))
+
+ assertThat(showAllNotifications).isFalse()
+ keyguardTransitionRepository.sendTransitionStep(step(1f, TransitionState.FINISHED))
+ assertThat(showAllNotifications).isFalse()
+ }
+
+ @Test
fun scrimBehindAlpha_doNotLeaveShadeOpen() =
testScope.runTest {
val values by collectValues(underTest.scrimAlpha(500.milliseconds, PRIMARY_BOUNCER))
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelTest.kt
index 751ac1d..e9a8257 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelTest.kt
@@ -21,6 +21,7 @@
import com.android.keyguard.KeyguardClockSwitch
import com.android.systemui.SysuiTestCase
import com.android.systemui.biometrics.authController
+import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.Flags
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.keyguard.data.repository.fakeKeyguardClockRepository
@@ -96,7 +97,7 @@
shadeRepository.setShadeMode(ShadeMode.Split)
kosmos.fakeKeyguardClockRepository.setClockSize(KeyguardClockSwitch.LARGE)
- assertThat(underTest.areNotificationsVisible).isTrue()
+ assertThat(collectLastValue(underTest.areNotificationsVisible).invoke()).isTrue()
}
}
@Test
@@ -104,7 +105,7 @@
with(kosmos) {
testScope.runTest {
kosmos.fakeKeyguardClockRepository.setClockSize(KeyguardClockSwitch.SMALL)
- assertThat(underTest.areNotificationsVisible).isTrue()
+ assertThat(collectLastValue(underTest.areNotificationsVisible).invoke()).isTrue()
}
}
@@ -113,7 +114,7 @@
with(kosmos) {
testScope.runTest {
kosmos.fakeKeyguardClockRepository.setClockSize(KeyguardClockSwitch.LARGE)
- assertThat(underTest.areNotificationsVisible).isFalse()
+ assertThat(collectLastValue(underTest.areNotificationsVisible).invoke()).isFalse()
}
}
@@ -122,7 +123,8 @@
with(kosmos) {
testScope.runTest {
shadeRepository.setShadeMode(ShadeMode.Split)
- assertThat(underTest.shouldUseSplitNotificationShade).isTrue()
+ assertThat(collectLastValue(underTest.shouldUseSplitNotificationShade).invoke())
+ .isTrue()
}
}
@@ -131,16 +133,8 @@
with(kosmos) {
testScope.runTest {
shadeRepository.setShadeMode(ShadeMode.Single)
- assertThat(underTest.shouldUseSplitNotificationShade).isFalse()
- }
- }
-
- @Test
- fun sceneKey() =
- with(kosmos) {
- testScope.runTest {
- shadeRepository.setShadeMode(ShadeMode.Single)
- assertThat(underTest.shouldUseSplitNotificationShade).isFalse()
+ assertThat(collectLastValue(underTest.shouldUseSplitNotificationShade).invoke())
+ .isFalse()
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt b/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt
index ef686f9..4d328d6 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt
@@ -72,7 +72,7 @@
.filterNotNull()
// TODO(b/322787129): Also set a custom transition animation here to avoid the regular
// slide-in animation when setting the scene programmatically
- .onEach { nextScene -> communalInteractor.onSceneChanged(nextScene) }
+ .onEach { nextScene -> communalInteractor.changeScene(nextScene) }
.launchIn(applicationScope)
// TODO(b/322787129): re-enable once custom animations are in place
@@ -129,7 +129,7 @@
.sample(keyguardInteractor.isDreaming, ::Pair)
.collect { (shouldTimeout, isDreaming) ->
if (isDreaming && shouldTimeout) {
- communalInteractor.onSceneChanged(CommunalScenes.Blank)
+ communalInteractor.changeScene(CommunalScenes.Blank)
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/communal/dagger/Communal.kt b/packages/SystemUI/src/com/android/systemui/communal/dagger/Communal.kt
new file mode 100644
index 0000000..5e41a1b
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/communal/dagger/Communal.kt
@@ -0,0 +1,21 @@
+/*
+ * 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.communal.dagger
+
+import javax.inject.Qualifier
+
+@Qualifier @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) annotation class Communal
diff --git a/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt b/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt
index 82d9437..72dcb26 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt
@@ -23,11 +23,19 @@
import com.android.systemui.communal.data.repository.CommunalSettingsRepositoryModule
import com.android.systemui.communal.data.repository.CommunalTutorialRepositoryModule
import com.android.systemui.communal.data.repository.CommunalWidgetRepositoryModule
+import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.communal.widgets.CommunalWidgetModule
import com.android.systemui.communal.widgets.EditWidgetsActivityStarter
import com.android.systemui.communal.widgets.EditWidgetsActivityStarterImpl
+import com.android.systemui.dagger.SysUISingleton
+import com.android.systemui.dagger.qualifiers.Application
+import com.android.systemui.scene.shared.model.SceneContainerConfig
+import com.android.systemui.scene.shared.model.SceneDataSource
+import com.android.systemui.scene.shared.model.SceneDataSourceDelegator
import dagger.Binds
import dagger.Module
+import dagger.Provides
+import kotlinx.coroutines.CoroutineScope
@Module(
includes =
@@ -47,4 +55,24 @@
fun bindEditWidgetsActivityStarter(
starter: EditWidgetsActivityStarterImpl
): EditWidgetsActivityStarter
+
+ @Binds
+ @Communal
+ fun bindCommunalSceneDataSource(@Communal delegator: SceneDataSourceDelegator): SceneDataSource
+
+ companion object {
+ @Provides
+ @Communal
+ @SysUISingleton
+ fun providesCommunalSceneDataSourceDelegator(
+ @Application applicationScope: CoroutineScope
+ ): SceneDataSourceDelegator {
+ val config =
+ SceneContainerConfig(
+ sceneKeys = listOf(CommunalScenes.Blank, CommunalScenes.Communal),
+ initialSceneKey = CommunalScenes.Blank
+ )
+ return SceneDataSourceDelegator(applicationScope, config)
+ }
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalRepository.kt b/packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalRepository.kt
index 201ce83..8bfd8d9 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalRepository.kt
@@ -18,11 +18,12 @@
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.compose.animation.scene.SceneKey
+import com.android.compose.animation.scene.TransitionKey
+import com.android.systemui.communal.dagger.Communal
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Background
-import com.android.systemui.scene.data.repository.SceneContainerRepository
-import com.android.systemui.scene.shared.flag.SceneContainerFlags
+import com.android.systemui.scene.shared.model.SceneDataSource
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -30,7 +31,6 @@
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
-import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.stateIn
@@ -38,16 +38,15 @@
/** Encapsulates the state of communal mode. */
interface CommunalRepository {
/**
- * Target scene as requested by the underlying [SceneTransitionLayout] or through
- * [setDesiredScene].
+ * Target scene as requested by the underlying [SceneTransitionLayout] or through [changeScene].
*/
- val desiredScene: StateFlow<SceneKey>
+ val currentScene: StateFlow<SceneKey>
/** Exposes the transition state of the communal [SceneTransitionLayout]. */
val transitionState: StateFlow<ObservableTransitionState>
/** Updates the requested scene. */
- fun setDesiredScene(desiredScene: SceneKey)
+ fun changeScene(toScene: SceneKey, transitionKey: TransitionKey? = null)
/**
* Updates the transition state of the hub [SceneTransitionLayout].
@@ -63,12 +62,10 @@
@Inject
constructor(
@Background backgroundScope: CoroutineScope,
- sceneContainerFlags: SceneContainerFlags,
- sceneContainerRepository: SceneContainerRepository,
+ @Communal private val sceneDataSource: SceneDataSource,
) : CommunalRepository {
- private val _desiredScene: MutableStateFlow<SceneKey> = MutableStateFlow(CommunalScenes.Default)
- override val desiredScene: StateFlow<SceneKey> = _desiredScene.asStateFlow()
+ override val currentScene: StateFlow<SceneKey> = sceneDataSource.currentScene
private val defaultTransitionState = ObservableTransitionState.Idle(CommunalScenes.Default)
private val _transitionState = MutableStateFlow<Flow<ObservableTransitionState>?>(null)
@@ -81,8 +78,8 @@
initialValue = defaultTransitionState,
)
- override fun setDesiredScene(desiredScene: SceneKey) {
- _desiredScene.value = desiredScene
+ override fun changeScene(toScene: SceneKey, transitionKey: TransitionKey?) {
+ sceneDataSource.changeScene(toScene, transitionKey)
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt b/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt
index ada984d..86b254b 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/domain/interactor/CommunalInteractor.kt
@@ -25,6 +25,7 @@
import android.provider.Settings
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.compose.animation.scene.SceneKey
+import com.android.compose.animation.scene.TransitionKey
import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.communal.data.repository.CommunalMediaRepository
import com.android.systemui.communal.data.repository.CommunalPrefsRepository
@@ -142,13 +143,12 @@
)
/**
- * Target scene as requested by the underlying [SceneTransitionLayout] or through
- * [onSceneChanged].
+ * Target scene as requested by the underlying [SceneTransitionLayout] or through [changeScene].
*
* If [isCommunalAvailable] is false, will return [CommunalScenes.Blank]
*/
val desiredScene: Flow<SceneKey> =
- communalRepository.desiredScene.combine(isCommunalAvailable) { scene, available ->
+ communalRepository.currentScene.combine(isCommunalAvailable) { scene, available ->
if (available) scene else CommunalScenes.Blank
}
@@ -254,9 +254,12 @@
!(it is ObservableTransitionState.Idle && it.scene == CommunalScenes.Blank)
}
- /** Callback received whenever the [SceneTransitionLayout] finishes a scene transition. */
- fun onSceneChanged(newScene: SceneKey) {
- communalRepository.setDesiredScene(newScene)
+ /**
+ * Asks for an asynchronous scene witch to [newScene], which will use the corresponding
+ * installed transition or the one specified by [transitionKey], if provided.
+ */
+ fun changeScene(newScene: SceneKey, transitionKey: TransitionKey? = null) {
+ communalRepository.changeScene(newScene, transitionKey)
}
fun setEditModeOpen(isOpen: Boolean) {
diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/BaseCommunalViewModel.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/BaseCommunalViewModel.kt
index 531f1987..095222a 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/BaseCommunalViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/ui/viewmodel/BaseCommunalViewModel.kt
@@ -49,8 +49,8 @@
communalInteractor.signalUserInteraction()
}
- fun onSceneChanged(scene: SceneKey) {
- communalInteractor.onSceneChanged(scene)
+ fun changeScene(scene: SceneKey) {
+ communalInteractor.changeScene(scene)
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt b/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt
index 902133d..5f4b394 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt
@@ -31,7 +31,6 @@
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.Modifier
import androidx.lifecycle.lifecycleScope
-import com.android.app.tracing.coroutines.launch
import com.android.compose.theme.LocalAndroidColorScheme
import com.android.compose.theme.PlatformTheme
import com.android.internal.logging.UiEventLogger
@@ -150,7 +149,7 @@
private fun onEditDone() {
try {
- communalViewModel.onSceneChanged(CommunalScenes.Communal)
+ communalViewModel.changeScene(CommunalScenes.Communal)
checkNotNull(windowManagerService).lockNow(/* options */ null)
finish()
} catch (e: RemoteException) {
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
index 19af371..1ed4b50 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
@@ -49,6 +49,7 @@
import com.android.systemui.communal.dagger.CommunalModule;
import com.android.systemui.complication.dagger.ComplicationComponent;
import com.android.systemui.controls.dagger.ControlsModule;
+import com.android.systemui.dagger.qualifiers.Application;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dagger.qualifiers.SystemUser;
import com.android.systemui.dagger.qualifiers.UiBackground;
@@ -89,6 +90,7 @@
import com.android.systemui.recents.Recents;
import com.android.systemui.recordissue.RecordIssueModule;
import com.android.systemui.retail.dagger.RetailModeModule;
+import com.android.systemui.scene.shared.model.SceneContainerConfig;
import com.android.systemui.scene.shared.model.SceneDataSource;
import com.android.systemui.scene.shared.model.SceneDataSourceDelegator;
import com.android.systemui.scene.ui.view.WindowRootViewComponent;
@@ -165,6 +167,8 @@
import javax.inject.Named;
+import kotlinx.coroutines.CoroutineScope;
+
/**
* A dagger module for injecting components of System UI that are required by System UI.
*
@@ -402,6 +406,13 @@
@ClassKey(SystemUISecondaryUserService.class)
abstract Service bindsSystemUISecondaryUserService(SystemUISecondaryUserService service);
+ @Provides
+ @SysUISingleton
+ static SceneDataSourceDelegator providesSceneDataSourceDelegator(
+ @Application CoroutineScope applicationScope, SceneContainerConfig config) {
+ return new SceneDataSourceDelegator(applicationScope, config);
+ }
+
@Binds
abstract SceneDataSource bindSceneDataSource(SceneDataSourceDelegator delegator);
}
diff --git a/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamViewModel.kt b/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamViewModel.kt
index 1b832d4..037c23b 100644
--- a/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/dreams/ui/viewmodel/DreamViewModel.kt
@@ -57,7 +57,7 @@
!keyguardUpdateMonitor.isEncryptedOrLockdown(userTracker.userId)
if (showGlanceableHub) {
toGlanceableHubTransitionViewModel.startTransition()
- communalInteractor.onSceneChanged(CommunalScenes.Communal)
+ communalInteractor.changeScene(CommunalScenes.Communal)
} else {
toLockscreenTransitionViewModel.startTransition()
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardPreviewClockViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardPreviewClockViewBinder.kt
index d9f12c3..5906cfd 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardPreviewClockViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardPreviewClockViewBinder.kt
@@ -18,6 +18,7 @@
package com.android.systemui.keyguard.ui.binder
import android.content.Context
+import android.util.DisplayMetrics
import android.view.View
import android.view.View.INVISIBLE
import android.view.View.VISIBLE
@@ -109,7 +110,7 @@
private fun applyClockDefaultConstraints(context: Context, constraints: ConstraintSet) {
constraints.apply {
constrainWidth(R.id.lockscreen_clock_view_large, ConstraintSet.WRAP_CONTENT)
- constrainHeight(R.id.lockscreen_clock_view_large, ConstraintSet.WRAP_CONTENT)
+ constrainHeight(R.id.lockscreen_clock_view_large, ConstraintSet.MATCH_CONSTRAINT)
val largeClockTopMargin =
context.resources.getDimensionPixelSize(R.dimen.status_bar_height) +
context.resources.getDimensionPixelSize(
@@ -129,7 +130,29 @@
ConstraintSet.END
)
- connect(R.id.lockscreen_clock_view_large, BOTTOM, R.id.lock_icon_view, TOP)
+ // In preview, we'll show UDFPS icon for UDFPS devices
+ // and nothing for non-UDFPS devices,
+ // but we need position of device entry icon to constrain clock
+ if (getConstraint(R.id.lock_icon_view) != null) {
+ connect(R.id.lockscreen_clock_view_large, BOTTOM, R.id.lock_icon_view, TOP)
+ } else {
+ // Copied calculation codes from applyConstraints in DefaultDeviceEntrySection
+ val bottomPaddingPx =
+ context.resources.getDimensionPixelSize(R.dimen.lock_icon_margin_bottom)
+ val defaultDensity =
+ DisplayMetrics.DENSITY_DEVICE_STABLE.toFloat() /
+ DisplayMetrics.DENSITY_DEFAULT.toFloat()
+ val lockIconRadiusPx = (defaultDensity * 36).toInt()
+ val clockBottomMargin = bottomPaddingPx + 2 * lockIconRadiusPx
+ connect(
+ R.id.lockscreen_clock_view_large,
+ BOTTOM,
+ PARENT_ID,
+ BOTTOM,
+ clockBottomMargin
+ )
+ }
+
constrainWidth(R.id.lockscreen_clock_view, WRAP_CONTENT)
constrainHeight(
R.id.lockscreen_clock_view,
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToGoneTransitionViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToGoneTransitionViewModel.kt
index c921fa7..8c6be98 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToGoneTransitionViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerToGoneTransitionViewModel.kt
@@ -81,6 +81,10 @@
)
}
+ /** See [BouncerToGoneFlows#showAllNotifications] */
+ val showAllNotifications: Flow<Boolean> =
+ bouncerToGoneFlows.showAllNotifications(TO_GONE_DURATION, ALTERNATE_BOUNCER)
+
/** Scrim alpha values */
val scrimAlpha: Flow<ScrimAlpha> =
bouncerToGoneFlows.scrimAlpha(TO_GONE_DURATION, ALTERNATE_BOUNCER)
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlows.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlows.kt
index 924fc5d..fe88b81 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlows.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/BouncerToGoneFlows.kt
@@ -32,6 +32,7 @@
import kotlin.time.Duration
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.map
@@ -63,6 +64,31 @@
}
}
+ /**
+ * When the shade is expanded, make sure that all notifications can be seen immediately during a
+ * transition to GONE. This matters especially when the user has chosen to not show
+ * notifications on the lockscreen and then pulls down the shade, which presents them with an
+ * immediate auth prompt, followed by a notification animation.
+ */
+ fun showAllNotifications(duration: Duration, from: KeyguardState): Flow<Boolean> {
+ var leaveShadeOpen = false
+ return animationFlow
+ .setup(
+ duration = duration,
+ from = from,
+ to = GONE,
+ )
+ .sharedFlow(
+ duration = duration,
+ onStart = { leaveShadeOpen = statusBarStateController.leaveOpenOnKeyguardHide() },
+ onStep = { if (leaveShadeOpen) 1f else 0f },
+ onFinish = { 0f },
+ onCancel = { 0f },
+ )
+ .map { it == 1f }
+ .distinctUntilChanged()
+ }
+
private fun createScrimAlphaFlow(
duration: Duration,
fromState: KeyguardState,
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt
index 1f80441..36896f9 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt
@@ -18,8 +18,10 @@
import android.content.res.Resources
import com.android.keyguard.KeyguardClockSwitch
+import com.android.keyguard.KeyguardClockSwitch.SMALL
import com.android.systemui.biometrics.AuthController
import com.android.systemui.dagger.SysUISingleton
+import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor
import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor
import com.android.systemui.res.R
@@ -29,6 +31,7 @@
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
@@ -42,6 +45,7 @@
private val authController: AuthController,
val longPress: KeyguardLongPressViewModel,
val shadeInteractor: ShadeInteractor,
+ @Application private val applicationScope: CoroutineScope,
) {
private val clockSize = clockInteractor.clockSize
@@ -50,11 +54,26 @@
val isLargeClockVisible: Boolean
get() = clockSize.value == KeyguardClockSwitch.LARGE
- val areNotificationsVisible: Boolean
- get() = !isLargeClockVisible || shouldUseSplitNotificationShade
+ val shouldUseSplitNotificationShade: StateFlow<Boolean> =
+ shadeInteractor.shadeMode
+ .map { it == ShadeMode.Split }
+ .stateIn(
+ scope = applicationScope,
+ started = SharingStarted.WhileSubscribed(),
+ initialValue = false,
+ )
- val shouldUseSplitNotificationShade: Boolean
- get() = shadeInteractor.shadeMode.value == ShadeMode.Split
+ val areNotificationsVisible: StateFlow<Boolean> =
+ combine(clockSize, shouldUseSplitNotificationShade) {
+ clockSize,
+ shouldUseSplitNotificationShade ->
+ clockSize == SMALL || shouldUseSplitNotificationShade
+ }
+ .stateIn(
+ scope = applicationScope,
+ started = SharingStarted.WhileSubscribed(),
+ initialValue = false,
+ )
fun getSmartSpacePaddingTop(resources: Resources): Int {
return if (isLargeClockVisible) {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModel.kt
index 53f4488..0587826 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModel.kt
@@ -60,6 +60,10 @@
private var leaveShadeOpen: Boolean = false
private var willRunDismissFromKeyguard: Boolean = false
+ /** See [BouncerToGoneFlows#showAllNotifications] */
+ val showAllNotifications: Flow<Boolean> =
+ bouncerToGoneFlows.showAllNotifications(TO_GONE_DURATION, PRIMARY_BOUNCER)
+
val notificationAlpha: Flow<Float> =
transitionAnimation.sharedFlow(
duration = 200.milliseconds,
diff --git a/packages/SystemUI/src/com/android/systemui/scene/shared/model/SceneDataSourceDelegator.kt b/packages/SystemUI/src/com/android/systemui/scene/shared/model/SceneDataSourceDelegator.kt
index 69dce83..2fbcba9 100644
--- a/packages/SystemUI/src/com/android/systemui/scene/shared/model/SceneDataSourceDelegator.kt
+++ b/packages/SystemUI/src/com/android/systemui/scene/shared/model/SceneDataSourceDelegator.kt
@@ -20,9 +20,6 @@
import com.android.compose.animation.scene.SceneKey
import com.android.compose.animation.scene.TransitionKey
-import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.dagger.qualifiers.Application
-import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
@@ -36,14 +33,10 @@
* Delegates calls to a runtime-provided [SceneDataSource] or to a no-op implementation if a
* delegate isn't set.
*/
-@SysUISingleton
-class SceneDataSourceDelegator
-@Inject
-constructor(
- @Application private val applicationScope: CoroutineScope,
+class SceneDataSourceDelegator(
+ applicationScope: CoroutineScope,
config: SceneContainerConfig,
) : SceneDataSource {
-
private val noOpDelegate = NoOpSceneDataSource(config.initialSceneKey)
private val delegateMutable = MutableStateFlow<SceneDataSource>(noOpDelegate)
@@ -82,6 +75,7 @@
) : SceneDataSource {
override val currentScene: StateFlow<SceneKey> =
MutableStateFlow(initialSceneKey).asStateFlow()
+
override fun changeScene(toScene: SceneKey, transitionKey: TransitionKey?) = Unit
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
index 597e773..047ecb4 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.java
@@ -29,8 +29,6 @@
import static com.android.systemui.screenshot.ScreenshotEvent.SCREENSHOT_DISMISSED_OTHER;
import static com.android.systemui.screenshot.ScreenshotEvent.SCREENSHOT_INTERACTION_TIMEOUT;
-import static java.util.Objects.requireNonNull;
-
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.MainThread;
@@ -72,7 +70,6 @@
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
-import android.view.accessibility.AccessibilityManager;
import android.widget.Toast;
import android.window.WindowContext;
@@ -80,6 +77,7 @@
import com.android.internal.logging.UiEventLogger;
import com.android.internal.policy.PhoneWindow;
import com.android.settingslib.applications.InterestingConfigChanges;
+import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.broadcast.BroadcastSender;
import com.android.systemui.clipboardoverlay.ClipboardOverlayController;
import com.android.systemui.dagger.qualifiers.Main;
@@ -216,17 +214,10 @@
// ScreenshotNotificationSmartActionsProvider.
static final String EXTRA_ACTION_TYPE = "android:screenshot_action_type";
static final String EXTRA_ID = "android:screenshot_id";
- static final String ACTION_TYPE_DELETE = "Delete";
- static final String ACTION_TYPE_SHARE = "Share";
- static final String ACTION_TYPE_EDIT = "Edit";
static final String EXTRA_SMART_ACTIONS_ENABLED = "android:smart_actions_enabled";
- static final String EXTRA_OVERRIDE_TRANSITION = "android:screenshot_override_transition";
static final String EXTRA_ACTION_INTENT = "android:screenshot_action_intent";
static final String EXTRA_ACTION_INTENT_FILLIN = "android:screenshot_action_intent_fillin";
- static final String SCREENSHOT_URI_ID = "android:screenshot_uri_id";
- static final String EXTRA_CANCEL_NOTIFICATION = "android:screenshot_cancel_notification";
- static final String EXTRA_DISALLOW_ENTER_PIP = "android:screenshot_disallow_enter_pip";
// From WizardManagerHelper.java
private static final String SETTINGS_SECURE_USER_SETUP_COMPLETE = "user_setup_complete";
@@ -245,10 +236,10 @@
private final Executor mMainExecutor;
private final ExecutorService mBgExecutor;
private final BroadcastSender mBroadcastSender;
+ private final BroadcastDispatcher mBroadcastDispatcher;
private final WindowManager mWindowManager;
private final WindowManager.LayoutParams mWindowLayoutParams;
- private final AccessibilityManager mAccessibilityManager;
@Nullable
private final ScreenshotSoundController mScreenshotSoundController;
private final ScrollCaptureClient mScrollCaptureClient;
@@ -276,7 +267,7 @@
private Animator mScreenshotAnimation;
private RequestCallback mCurrentRequestCallback;
private String mPackageName = "";
- private BroadcastReceiver mCopyBroadcastReceiver;
+ private final BroadcastReceiver mCopyBroadcastReceiver;
// When false, the screenshot is taken without showing the ui. Note that this only applies to
// external displays, as on the default one the UI should **always** be shown.
@@ -298,6 +289,8 @@
@AssistedInject
ScreenshotController(
Context context,
+ DisplayManager displayManager,
+ WindowManager windowManager,
FeatureFlags flags,
ScreenshotViewProxy.Factory viewProxyFactory,
ScreenshotActionsProvider.Factory actionsProviderFactory,
@@ -313,6 +306,7 @@
ActivityManager activityManager,
TimeoutHandler timeoutHandler,
BroadcastSender broadcastSender,
+ BroadcastDispatcher broadcastDispatcher,
ScreenshotNotificationSmartActionsProvider screenshotNotificationSmartActionsProvider,
ActionIntentExecutor actionExecutor,
UserManager userManager,
@@ -335,16 +329,17 @@
mScreenshotNotificationSmartActionsProvider = screenshotNotificationSmartActionsProvider;
mBgExecutor = Executors.newSingleThreadExecutor();
mBroadcastSender = broadcastSender;
+ mBroadcastDispatcher = broadcastDispatcher;
mScreenshotHandler = timeoutHandler;
mScreenshotHandler.setDefaultTimeoutMillis(SCREENSHOT_CORNER_DEFAULT_TIMEOUT_MILLIS);
mDisplayId = displayId;
- mDisplayManager = requireNonNull(context.getSystemService(DisplayManager.class));
+ mDisplayManager = displayManager;
+ mWindowManager = windowManager;
final Context displayContext = context.createDisplayContext(getDisplay());
mContext = (WindowContext) displayContext.createWindowContext(TYPE_SCREENSHOT, null);
- mWindowManager = mContext.getSystemService(WindowManager.class);
mFlags = flags;
mActionExecutor = actionExecutor;
mUserManager = userManager;
@@ -361,8 +356,6 @@
mViewProxy.requestDismissal(SCREENSHOT_INTERACTION_TIMEOUT);
});
- mAccessibilityManager = AccessibilityManager.getInstance(mContext);
-
// Setup the window that we are going to use
mWindowLayoutParams = FloatingWindowUtil.getFloatingWindowParams();
mWindowLayoutParams.setTitle("ScreenshotAnimation");
@@ -388,9 +381,9 @@
}
}
};
- mContext.registerReceiver(mCopyBroadcastReceiver, new IntentFilter(
- ClipboardOverlayController.COPY_OVERLAY_ACTION),
- ClipboardOverlayController.SELF_PERMISSION, null, Context.RECEIVER_NOT_EXPORTED);
+ mBroadcastDispatcher.registerReceiver(mCopyBroadcastReceiver, new IntentFilter(
+ ClipboardOverlayController.COPY_OVERLAY_ACTION), null, null,
+ Context.RECEIVER_NOT_EXPORTED, ClipboardOverlayController.SELF_PERMISSION);
mShowUIOnExternalDisplay = showUIOnExternalDisplay;
}
@@ -555,7 +548,7 @@
* Release the constructed window context.
*/
private void releaseContext() {
- mContext.unregisterReceiver(mCopyBroadcastReceiver);
+ mBroadcastDispatcher.unregisterReceiver(mCopyBroadcastReceiver);
mContext.release();
}
@@ -603,7 +596,7 @@
if (DEBUG_WINDOW) {
Log.d(TAG, "setContentView: " + mViewProxy.getView());
}
- setContentView(mViewProxy.getView());
+ mWindow.setContentView(mViewProxy.getView());
}
private void enqueueScrollCaptureRequest(UserHandle owner) {
@@ -685,10 +678,8 @@
final ScrollCaptureResponse response = mLastScrollCaptureResponse;
mViewProxy.showScrollChip(response.getPackageName(), /* onClick */ () -> {
- DisplayMetrics displayMetrics = new DisplayMetrics();
- getDisplay().getRealMetrics(displayMetrics);
- Bitmap newScreenshot = mImageCapture.captureDisplay(mDisplayId,
- new Rect(0, 0, displayMetrics.widthPixels, displayMetrics.heightPixels));
+ Bitmap newScreenshot =
+ mImageCapture.captureDisplay(mDisplayId, getFullScreenRect());
if (newScreenshot != null) {
// delay starting scroll capture to make sure scrim is up before the app moves
@@ -785,10 +776,6 @@
}
}
- private void setContentView(View contentView) {
- mWindow.setContentView(contentView);
- }
-
@MainThread
private void attachWindow() {
View decorView = mWindow.getDecorView();
@@ -900,12 +887,10 @@
public void onFinish() {
}
};
- Pair<ActivityOptions, ExitTransitionCoordinator> transition =
- ActivityOptions.startSharedElementAnimation(mWindow, callbacks, null,
- Pair.create(mViewProxy.getScreenshotPreview(),
- ChooserActivity.FIRST_IMAGE_PREVIEW_TRANSITION_NAME));
- return transition;
+ return ActivityOptions.startSharedElementAnimation(mWindow, callbacks, null,
+ Pair.create(mViewProxy.getScreenshotPreview(),
+ ChooserActivity.FIRST_IMAGE_PREVIEW_TRANSITION_NAME));
}
/** Reset screenshot view and then call onCompleteRunnable */
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/data/model/DisplayContentModel.kt b/packages/SystemUI/src/com/android/systemui/screenshot/data/model/DisplayContentModel.kt
new file mode 100644
index 0000000..837a661
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/data/model/DisplayContentModel.kt
@@ -0,0 +1,29 @@
+/*
+ * 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.screenshot.data.model
+
+import android.app.ActivityTaskManager.RootTaskInfo
+
+/** Information about the tasks on a display. */
+data class DisplayContentModel(
+ /** The id of the display. */
+ val displayId: Int,
+ /** Information about the current System UI state which can affect capture. */
+ val systemUiState: SystemUiState,
+ /** A list of root tasks on the display, ordered from bottom to top along the z-axis */
+ val rootTasks: List<RootTaskInfo>,
+)
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/data/model/SystemUiState.kt b/packages/SystemUI/src/com/android/systemui/screenshot/data/model/SystemUiState.kt
new file mode 100644
index 0000000..78be6bd
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/data/model/SystemUiState.kt
@@ -0,0 +1,20 @@
+/*
+ * 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.screenshot.data.model
+
+/** Information about SystemUI state relevant to screenshot policy. */
+data class SystemUiState(val shadeExpanded: Boolean)
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/data/repository/DisplayContentRepository.kt b/packages/SystemUI/src/com/android/systemui/screenshot/data/repository/DisplayContentRepository.kt
new file mode 100644
index 0000000..9c81b32
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/data/repository/DisplayContentRepository.kt
@@ -0,0 +1,24 @@
+/*
+ * 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.screenshot.data.repository
+
+import com.android.systemui.screenshot.data.model.DisplayContentModel
+
+/** Provides information about tasks related to a display. */
+interface DisplayContentRepository {
+ /** Provides information about the tasks and content presented on a given display. */
+ suspend fun getDisplayContent(displayId: Int): DisplayContentModel
+}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/data/repository/DisplayContentRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/screenshot/data/repository/DisplayContentRepositoryImpl.kt
new file mode 100644
index 0000000..e9599dc
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/data/repository/DisplayContentRepositoryImpl.kt
@@ -0,0 +1,60 @@
+/*
+ * 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.screenshot.data.repository
+
+import android.annotation.SuppressLint
+import android.app.ActivityTaskManager
+import android.app.IActivityTaskManager
+import com.android.systemui.dagger.qualifiers.Background
+import com.android.systemui.screenshot.data.model.DisplayContentModel
+import com.android.systemui.screenshot.data.model.SystemUiState
+import com.android.systemui.screenshot.proxy.SystemUiProxy
+import javax.inject.Inject
+import kotlinx.coroutines.CoroutineDispatcher
+import kotlinx.coroutines.withContext
+
+/**
+ * Implements DisplayTaskRepository using [IActivityTaskManager], along with [ProfileTypeRepository]
+ * and [SystemUiProxy].
+ */
+@SuppressLint("MissingPermission")
+class DisplayContentRepositoryImpl
+@Inject
+constructor(
+ private val atmService: IActivityTaskManager,
+ private val systemUiProxy: SystemUiProxy,
+ @Background private val background: CoroutineDispatcher,
+) : DisplayContentRepository {
+
+ override suspend fun getDisplayContent(displayId: Int): DisplayContentModel {
+ return withContext(background) {
+ val rootTasks = atmService.getAllRootTaskInfosOnDisplay(displayId)
+ toDisplayTasksModel(displayId, rootTasks)
+ }
+ }
+
+ private suspend fun toDisplayTasksModel(
+ displayId: Int,
+ rootTasks: List<ActivityTaskManager.RootTaskInfo>,
+ ): DisplayContentModel {
+ return DisplayContentModel(
+ displayId,
+ SystemUiState(systemUiProxy.isNotificationShadeExpanded()),
+ rootTasks
+ )
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/policy/ScreenshotPolicyModule.kt b/packages/SystemUI/src/com/android/systemui/screenshot/policy/ScreenshotPolicyModule.kt
index 39b07e3..bc71ab7 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/policy/ScreenshotPolicyModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/policy/ScreenshotPolicyModule.kt
@@ -21,6 +21,8 @@
import com.android.systemui.screenshot.RequestProcessor
import com.android.systemui.screenshot.ScreenshotPolicy
import com.android.systemui.screenshot.ScreenshotRequestProcessor
+import com.android.systemui.screenshot.data.repository.DisplayContentRepository
+import com.android.systemui.screenshot.data.repository.DisplayContentRepositoryImpl
import com.android.systemui.screenshot.data.repository.ProfileTypeRepository
import com.android.systemui.screenshot.data.repository.ProfileTypeRepositoryImpl
import dagger.Binds
@@ -45,4 +47,8 @@
return RequestProcessor(imageCapture, policyProvider.get())
}
}
+
+ @Binds
+ @SysUISingleton
+ fun bindDisplayContentRepository(impl: DisplayContentRepositoryImpl): DisplayContentRepository
}
diff --git a/packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt b/packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt
index 3169e9c..33cf9ba 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/GlanceableHubContainerController.kt
@@ -26,12 +26,14 @@
import androidx.compose.ui.platform.ComposeView
import com.android.compose.theme.PlatformTheme
import com.android.internal.annotations.VisibleForTesting
+import com.android.systemui.communal.dagger.Communal
import com.android.systemui.communal.domain.interactor.CommunalInteractor
import com.android.systemui.communal.ui.compose.CommunalContainer
import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.res.R
+import com.android.systemui.scene.shared.model.SceneDataSourceDelegator
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.statusbar.phone.SystemUIDialogFactory
import com.android.systemui.util.kotlin.collectFlow
@@ -52,6 +54,7 @@
private val keyguardTransitionInteractor: KeyguardTransitionInteractor,
private val shadeInteractor: ShadeInteractor,
private val powerManager: PowerManager,
+ @Communal private val dataSourceDelegator: SceneDataSourceDelegator,
) {
/** The container view for the hub. This will not be initialized until [initView] is called. */
private var communalContainerView: View? = null
@@ -125,6 +128,7 @@
PlatformTheme {
CommunalContainer(
viewModel = communalViewModel,
+ dataSourceDelegator = dataSourceDelegator,
dialogFactory = dialogFactory,
)
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
index 725c153..9f57606 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
@@ -589,8 +589,13 @@
combine(
isOnLockscreen,
keyguardInteractor.statusBarState,
- ) { isOnLockscreen, statusBarState ->
- statusBarState == SHADE_LOCKED || !isOnLockscreen
+ merge(
+ primaryBouncerToGoneTransitionViewModel.showAllNotifications,
+ alternateBouncerToGoneTransitionViewModel.showAllNotifications,
+ )
+ .onStart { emit(false) }
+ ) { isOnLockscreen, statusBarState, showAllNotifications ->
+ statusBarState == SHADE_LOCKED || !isOnLockscreen || showAllNotifications
}
return combineTransform(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt
index 07d9350..5ca6cf1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt
@@ -41,6 +41,7 @@
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testScope
import com.android.systemui.res.R
+import com.android.systemui.scene.shared.model.sceneDataSourceDelegator
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.statusbar.phone.SystemUIDialogFactory
import com.android.systemui.testKosmos
@@ -104,7 +105,8 @@
dialogFactory,
keyguardTransitionInteractor,
shadeInteractor,
- powerManager
+ powerManager,
+ kosmos.sceneDataSourceDelegator,
)
testableLooper = TestableLooper.get(this)
@@ -145,6 +147,7 @@
keyguardTransitionInteractor,
shadeInteractor,
powerManager,
+ kosmos.sceneDataSourceDelegator,
)
// First call succeeds.
@@ -268,7 +271,7 @@
}
private fun goToScene(scene: SceneKey) {
- communalRepository.setDesiredScene(scene)
+ communalRepository.changeScene(scene)
testableLooper.processAllMessages()
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/SysUITestModule.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/SysUITestModule.kt
index bc0bf9d..de7b14d 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/SysUITestModule.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/SysUITestModule.kt
@@ -32,6 +32,7 @@
import com.android.systemui.deviceentry.domain.interactor.SystemUIDeviceEntryFaceAuthInteractor
import com.android.systemui.scene.SceneContainerFrameworkModule
import com.android.systemui.scene.shared.flag.SceneContainerFlags
+import com.android.systemui.scene.shared.model.SceneContainerConfig
import com.android.systemui.scene.shared.model.SceneDataSource
import com.android.systemui.scene.shared.model.SceneDataSourceDelegator
import com.android.systemui.shade.domain.interactor.BaseShadeInteractor
@@ -45,6 +46,7 @@
import javax.inject.Provider
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
+import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
@@ -71,7 +73,10 @@
@Binds @Main fun bindMainResources(resources: Resources): Resources
@Binds fun bindBroadcastDispatcher(fake: FakeBroadcastDispatcher): BroadcastDispatcher
@Binds @SysUISingleton fun bindsShadeInteractor(sii: ShadeInteractorImpl): ShadeInteractor
- @Binds fun bindSceneDataSource(delegator: SceneDataSourceDelegator): SceneDataSource
+
+ @Binds
+ @SysUISingleton
+ fun bindSceneDataSource(delegator: SceneDataSourceDelegator): SceneDataSource
@Binds
fun provideFaceAuthInteractor(
@@ -109,6 +114,15 @@
sceneContainerOff.get()
}
}
+
+ @Provides
+ @SysUISingleton
+ fun providesSceneDataSourceDelegator(
+ @Application applicationScope: CoroutineScope,
+ config: SceneContainerConfig,
+ ): SceneDataSourceDelegator {
+ return SceneDataSourceDelegator(applicationScope, config)
+ }
}
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/communal/data/repository/FakeCommunalRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/communal/data/repository/FakeCommunalRepository.kt
index 5ff588f..9f5c6b8 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/communal/data/repository/FakeCommunalRepository.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/communal/data/repository/FakeCommunalRepository.kt
@@ -2,6 +2,7 @@
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.compose.animation.scene.SceneKey
+import com.android.compose.animation.scene.TransitionKey
import com.android.systemui.communal.shared.model.CommunalScenes
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -17,11 +18,11 @@
@OptIn(ExperimentalCoroutinesApi::class)
class FakeCommunalRepository(
applicationScope: CoroutineScope,
- override val desiredScene: MutableStateFlow<SceneKey> =
+ override val currentScene: MutableStateFlow<SceneKey> =
MutableStateFlow(CommunalScenes.Default),
) : CommunalRepository {
- override fun setDesiredScene(desiredScene: SceneKey) {
- this.desiredScene.value = desiredScene
+ override fun changeScene(toScene: SceneKey, transitionKey: TransitionKey?) {
+ this.currentScene.value = toScene
}
private val defaultTransitionState = ObservableTransitionState.Idle(CommunalScenes.Default)
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt
index f0fedd2..1e25f7f 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt
@@ -20,6 +20,7 @@
import com.android.systemui.keyguard.domain.interactor.keyguardBlueprintInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardClockInteractor
import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.shade.domain.interactor.shadeInteractor
val Kosmos.lockscreenContentViewModel by
@@ -30,5 +31,6 @@
authController = authController,
longPress = keyguardLongPressViewModel,
shadeInteractor = shadeInteractor,
+ applicationScope = applicationCoroutineScope,
)
}
diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp
index 178102e..f4337d4 100644
--- a/ravenwood/Android.bp
+++ b/ravenwood/Android.bp
@@ -154,3 +154,15 @@
srcs: ["ravenwood-services-jarjar-rules.txt"],
visibility: ["//frameworks/base"],
}
+
+// For collecting the *stats.csv files in a known directory under out/host/linux-x86/testcases/.
+// The "test" just shows the available stats filenames.
+sh_test_host {
+ name: "ravenwood-stats-checker",
+ src: "ravenwood-stats-checker.sh",
+ test_suites: ["general-tests"],
+ data: [
+ ":framework-minus-apex.ravenwood.stats",
+ ":services.core.ravenwood.stats",
+ ],
+}
diff --git a/ravenwood/ravenwood-stats-checker.sh b/ravenwood/ravenwood-stats-checker.sh
new file mode 100755
index 0000000..fb58e72
--- /dev/null
+++ b/ravenwood/ravenwood-stats-checker.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# Just print the available *.csv filenames.
+echo '#Stats files:'
+ls *.csv
\ No newline at end of file
diff --git a/services/core/java/com/android/server/SensitiveContentProtectionManagerService.java b/services/core/java/com/android/server/SensitiveContentProtectionManagerService.java
index 253fe35..ac19d8b 100644
--- a/services/core/java/com/android/server/SensitiveContentProtectionManagerService.java
+++ b/services/core/java/com/android/server/SensitiveContentProtectionManagerService.java
@@ -161,20 +161,20 @@
}
if (DEBUG) Log.d(TAG, "onBootPhase - PHASE_BOOT_COMPLETED");
-
- mPackageManagerInternal = LocalServices.getService(PackageManagerInternal.class);
init(getContext().getSystemService(MediaProjectionManager.class),
LocalServices.getService(WindowManagerInternal.class),
- getExemptedPackages());
+ LocalServices.getService(PackageManagerInternal.class),
+ getExemptedPackages()
+ );
if (sensitiveContentAppProtection()) {
publishBinderService(Context.SENSITIVE_CONTENT_PROTECTION_SERVICE,
- new SensitiveContentProtectionManagerServiceBinder(mPackageManagerInternal));
+ new SensitiveContentProtectionManagerServiceBinder());
}
}
@VisibleForTesting
void init(MediaProjectionManager projectionManager, WindowManagerInternal windowManager,
- ArraySet<String> exemptedPackages) {
+ PackageManagerInternal packageManagerInternal, ArraySet<String> exemptedPackages) {
if (DEBUG) Log.d(TAG, "init");
Objects.requireNonNull(projectionManager);
@@ -182,6 +182,7 @@
mProjectionManager = projectionManager;
mWindowManager = windowManager;
+ mPackageManagerInternal = packageManagerInternal;
mExemptedPackages = exemptedPackages;
// TODO(b/317250444): use MediaProjectionManagerService directly, reduces unnecessary
@@ -231,14 +232,16 @@
}
private void onProjectionStart(MediaProjectionInfo projectionInfo) {
- int uid = mPackageManagerInternal.getPackageUid(projectionInfo.getPackageName(), 0,
- projectionInfo.getUserHandle().getIdentifier());
boolean isPackageExempted = (mExemptedPackages != null && mExemptedPackages.contains(
projectionInfo.getPackageName()))
- || canRecordSensitiveContent(projectionInfo.getPackageName());
+ || canRecordSensitiveContent(projectionInfo.getPackageName())
+ || isAutofillServiceRecorderPackage(projectionInfo.getUserHandle().getIdentifier(),
+ projectionInfo.getPackageName());
// TODO(b/324447419): move GlobalSettings lookup to background thread
boolean isFeatureDisabled = Settings.Global.getInt(getContext().getContentResolver(),
DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS, 0) != 0;
+ int uid = mPackageManagerInternal.getPackageUid(projectionInfo.getPackageName(), 0,
+ projectionInfo.getUserHandle().getIdentifier());
mMediaProjectionSession = new MediaProjectionSession(
uid, isPackageExempted || isFeatureDisabled, new Random().nextLong());
@@ -295,8 +298,9 @@
// notify windowmanager of any currently posted sensitive content notifications
ArraySet<PackageInfo> packageInfos =
getSensitivePackagesFromNotifications(notifications, rankingMap);
-
- mWindowManager.addBlockScreenCaptureForApps(packageInfos);
+ if (packageInfos.size() > 0) {
+ mWindowManager.addBlockScreenCaptureForApps(packageInfos);
+ }
}
private ArraySet<PackageInfo> getSensitivePackagesFromNotifications(
@@ -422,6 +426,7 @@
if (!mProjectionActive) {
return;
}
+
if (DEBUG) {
Log.d(TAG, "setSensitiveContentProtection - current package=" + packageInfo
+ ", isShowingSensitiveContent=" + isShowingSensitiveContent
@@ -452,15 +457,29 @@
}
}
- private final class SensitiveContentProtectionManagerServiceBinder
- extends ISensitiveContentProtectionManager.Stub {
- private final PackageManagerInternal mPackageManagerInternal;
-
- SensitiveContentProtectionManagerServiceBinder(
- PackageManagerInternal packageManagerInternal) {
- mPackageManagerInternal = packageManagerInternal;
+ // TODO: b/328251279 - Autofill service exemption is temporary and will be removed in future.
+ private boolean isAutofillServiceRecorderPackage(int userId, String projectionPackage) {
+ String autofillServiceName = Settings.Secure.getStringForUser(
+ getContext().getContentResolver(), Settings.Secure.AUTOFILL_SERVICE, userId);
+ if (DEBUG) {
+ Log.d(TAG, "autofill service for user " + userId + " is " + autofillServiceName);
}
+ if (autofillServiceName == null) {
+ return false;
+ }
+ ComponentName serviceComponent = ComponentName.unflattenFromString(autofillServiceName);
+ if (serviceComponent == null) {
+ return false;
+ }
+ String autofillServicePackage = serviceComponent.getPackageName();
+
+ return autofillServicePackage != null
+ && autofillServicePackage.equals(projectionPackage);
+ }
+
+ private final class SensitiveContentProtectionManagerServiceBinder
+ extends ISensitiveContentProtectionManager.Stub {
public void setSensitiveContentProtection(IBinder windowToken, String packageName,
boolean isShowingSensitiveContent) {
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER,
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index ba21a32..434985e 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -464,10 +464,11 @@
// May be used outside of the lock but only on the handler thread.
private final ArrayList<CallbackRecord> mTempCallbacks = new ArrayList<CallbackRecord>();
- // Pending callback records indexed by calling process uid.
+ // Pending callback records indexed by calling process uid and pid.
// Must be used outside of the lock mSyncRoot and should be selflocked.
@GuardedBy("mPendingCallbackSelfLocked")
- public final SparseArray<PendingCallback> mPendingCallbackSelfLocked = new SparseArray<>();
+ public final SparseArray<SparseArray<PendingCallback>> mPendingCallbackSelfLocked =
+ new SparseArray<>();
// Temporary viewports, used when sending new viewport information to the
// input system. May be used outside of the lock but only on the handler thread.
@@ -1011,8 +1012,8 @@
}
// Do we care about this uid?
- PendingCallback pendingCallback = mPendingCallbackSelfLocked.get(uid);
- if (pendingCallback == null) {
+ SparseArray<PendingCallback> pendingCallbacks = mPendingCallbackSelfLocked.get(uid);
+ if (pendingCallbacks == null) {
return;
}
@@ -1020,7 +1021,12 @@
if (DEBUG) {
Slog.d(TAG, "Uid " + uid + " becomes " + importance);
}
- pendingCallback.sendPendingDisplayEvent();
+ for (int i = 0; i < pendingCallbacks.size(); i++) {
+ PendingCallback pendingCallback = pendingCallbacks.valueAt(i);
+ if (pendingCallback != null) {
+ pendingCallback.sendPendingDisplayEvent();
+ }
+ }
mPendingCallbackSelfLocked.delete(uid);
}
}
@@ -3193,16 +3199,23 @@
for (int i = 0; i < mTempCallbacks.size(); i++) {
CallbackRecord callbackRecord = mTempCallbacks.get(i);
final int uid = callbackRecord.mUid;
+ final int pid = callbackRecord.mPid;
if (isUidCached(uid)) {
// For cached apps, save the pending event until it becomes non-cached
synchronized (mPendingCallbackSelfLocked) {
- PendingCallback pendingCallback = mPendingCallbackSelfLocked.get(uid);
+ SparseArray<PendingCallback> pendingCallbacks = mPendingCallbackSelfLocked.get(
+ uid);
if (extraLogging(callbackRecord.mPackageName)) {
- Slog.i(TAG,
- "Uid is cached: " + uid + ", pendingCallback: " + pendingCallback);
+ Slog.i(TAG, "Uid is cached: " + uid
+ + ", pendingCallbacks: " + pendingCallbacks);
}
+ if (pendingCallbacks == null) {
+ pendingCallbacks = new SparseArray<>();
+ mPendingCallbackSelfLocked.put(uid, pendingCallbacks);
+ }
+ PendingCallback pendingCallback = pendingCallbacks.get(pid);
if (pendingCallback == null) {
- mPendingCallbackSelfLocked.put(uid,
+ pendingCallbacks.put(pid,
new PendingCallback(callbackRecord, displayId, event));
} else {
pendingCallback.addDisplayEvent(displayId, event);
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index fd3da85..4da280b 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -2446,7 +2446,7 @@
ComponentName intentFilterVerifierComponent =
getIntentFilterVerifierComponentNameLPr(computer);
ComponentName domainVerificationAgent =
- getDomainVerificationAgentComponentNameLPr(computer);
+ getDomainVerificationAgentComponentNameLPr(computer, UserHandle.USER_SYSTEM);
DomainVerificationProxy domainVerificationProxy = DomainVerificationProxy.makeProxy(
intentFilterVerifierComponent, domainVerificationAgent, mContext,
@@ -2754,12 +2754,13 @@
}
@Nullable
- private ComponentName getDomainVerificationAgentComponentNameLPr(@NonNull Computer computer) {
+ private ComponentName getDomainVerificationAgentComponentNameLPr(@NonNull Computer computer,
+ int userId) {
Intent intent = new Intent(Intent.ACTION_DOMAINS_NEED_VERIFICATION);
List<ResolveInfo> matches =
mResolveIntentHelper.queryIntentReceiversInternal(computer, intent, null,
MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE,
- UserHandle.USER_SYSTEM, Binder.getCallingUid());
+ userId, Binder.getCallingUid());
ResolveInfo best = null;
final int N = matches.size();
for (int i = 0; i < N; i++) {
@@ -2767,7 +2768,7 @@
final String packageName = cur.getComponentInfo().packageName;
if (checkPermission(
android.Manifest.permission.DOMAIN_VERIFICATION_AGENT, packageName,
- UserHandle.USER_SYSTEM) != PackageManager.PERMISSION_GRANTED) {
+ userId) != PackageManager.PERMISSION_GRANTED) {
Slog.w(TAG, "Domain verification agent found but does not hold permission: "
+ packageName);
continue;
@@ -2775,7 +2776,7 @@
if (best == null || cur.priority > best.priority) {
if (computer.isComponentEffectivelyEnabled(cur.getComponentInfo(),
- UserHandle.SYSTEM)) {
+ UserHandle.of(userId))) {
best = cur;
} else {
Slog.w(TAG, "Domain verification agent found but not enabled");
@@ -6512,13 +6513,13 @@
@Override
@Nullable
- public ComponentName getDomainVerificationAgent() {
+ public ComponentName getDomainVerificationAgent(int userId) {
final int callerUid = Binder.getCallingUid();
if (!PackageManagerServiceUtils.isRootOrShell(callerUid)) {
throw new SecurityException("Not allowed to query domain verification agent");
}
final Computer snapshot = snapshotComputer();
- return getDomainVerificationAgentComponentNameLPr(snapshot);
+ return getDomainVerificationAgentComponentNameLPr(snapshot, userId);
}
@Override
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
index a9e1725..59faf24 100644
--- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
+++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
@@ -4412,8 +4412,31 @@
private int runGetDomainVerificationAgent() throws RemoteException {
final PrintWriter pw = getOutPrintWriter();
+ int userId = UserHandle.USER_ALL;
+
+ String opt;
+ while ((opt = getNextOption()) != null) {
+ if (opt.equals("--user")) {
+ userId = UserHandle.parseUserArg(getNextArgRequired());
+ if (userId != UserHandle.USER_ALL && userId != UserHandle.USER_CURRENT) {
+ UserManagerInternal umi =
+ LocalServices.getService(UserManagerInternal.class);
+ UserInfo userInfo = umi.getUserInfo(userId);
+ if (userInfo == null) {
+ pw.println("Failure [user " + userId + " doesn't exist]");
+ return 1;
+ }
+ }
+ } else {
+ pw.println("Error: Unknown option: " + opt);
+ return 1;
+ }
+ }
+ final int translatedUserId =
+ translateUserId(userId, UserHandle.USER_SYSTEM, "runGetDomainVerificationAgent");
try {
- final ComponentName domainVerificationAgent = mInterface.getDomainVerificationAgent();
+ final ComponentName domainVerificationAgent =
+ mInterface.getDomainVerificationAgent(translatedUserId);
pw.println(domainVerificationAgent == null
? "No Domain Verifier available!" : domainVerificationAgent.flattenToString());
} catch (Exception e) {
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 2ec26ca..baf274d 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -819,6 +819,12 @@
@Nullable
private Rect mLetterboxBoundsForFixedOrientationAndAspectRatio;
+ // Bounds populated in resolveAspectRatioRestriction when this activity is letterboxed for
+ // aspect ratio. If not null, they are used as parent container in
+ // resolveSizeCompatModeConfiguration and in a constructor of CompatDisplayInsets.
+ @Nullable
+ private Rect mLetterboxBoundsForAspectRatio;
+
// Whether the activity is eligible to be letterboxed for fixed orientation with respect to its
// requested orientation, even when it's letterbox for another reason (e.g., size compat mode)
// and therefore #isLetterboxedForFixedOrientationAndAspectRatio returns false.
@@ -8421,10 +8427,14 @@
fullConfig.windowConfiguration.getRotation());
}
+ final Rect letterboxedContainerBounds =
+ mLetterboxBoundsForFixedOrientationAndAspectRatio != null
+ ? mLetterboxBoundsForFixedOrientationAndAspectRatio
+ : mLetterboxBoundsForAspectRatio;
+
// The role of CompatDisplayInsets is like the override bounds.
mCompatDisplayInsets =
- new CompatDisplayInsets(
- mDisplayContent, this, mLetterboxBoundsForFixedOrientationAndAspectRatio);
+ new CompatDisplayInsets(mDisplayContent, this, letterboxedContainerBounds);
}
private void clearSizeCompatModeAttributes() {
@@ -8496,6 +8506,7 @@
mIsAspectRatioApplied = false;
mIsEligibleForFixedOrientationLetterbox = false;
mLetterboxBoundsForFixedOrientationAndAspectRatio = null;
+ mLetterboxBoundsForAspectRatio = null;
// Can't use resolvedConfig.windowConfiguration.getWindowingMode() because it can be
// different from windowing mode of the task (PiP) during transition from fullscreen to PiP
@@ -8534,9 +8545,11 @@
getTaskFragment().computeConfigResourceOverrides(resolvedConfig,
newParentConfiguration);
}
+ }
// If activity in fullscreen mode is letterboxed because of fixed orientation then bounds
- // are already calculated in resolveFixedOrientationConfiguration.
- } else if (!isLetterboxedForFixedOrientationAndAspectRatio()) {
+ // are already calculated in resolveFixedOrientationConfiguration, or if in size compat
+ // mode, it should already be calculated in resolveSizeCompatModeConfiguration
+ if (!isLetterboxedForFixedOrientationAndAspectRatio() && !mInSizeCompatModeForBounds) {
resolveAspectRatioRestriction(newParentConfiguration);
}
@@ -9030,7 +9043,8 @@
}
final CompatDisplayInsets compatDisplayInsets = getCompatDisplayInsets();
- if (compatDisplayInsets != null && !compatDisplayInsets.mIsInFixedOrientationLetterbox) {
+ if (compatDisplayInsets != null
+ && !compatDisplayInsets.mIsInFixedOrientationOrAspectRatioLetterbox) {
// App prefers to keep its original size.
// If the size compat is from previous fixed orientation letterboxing, we may want to
// have fixed orientation letterbox again, otherwise it will show the size compat
@@ -9162,6 +9176,7 @@
// restrict, the bounds should be the requested override bounds.
getTaskFragment().computeConfigResourceOverrides(resolvedConfig, newParentConfiguration,
getFixedRotationTransformDisplayInfo());
+ mLetterboxBoundsForAspectRatio = new Rect(resolvedBounds);
}
}
@@ -10726,10 +10741,10 @@
/** Whether the {@link Task} windowingMode represents a floating window*/
final boolean mIsFloating;
/**
- * Whether is letterboxed because of fixed orientation when the unresizable activity is
- * first shown.
+ * Whether is letterboxed because of fixed orientation or aspect ratio when the
+ * unresizable activity is first shown.
*/
- final boolean mIsInFixedOrientationLetterbox;
+ final boolean mIsInFixedOrientationOrAspectRatioLetterbox;
/**
* The nonDecorInsets for each rotation. Includes the navigation bar and cutout insets. It
* is used to compute the appBounds.
@@ -10744,7 +10759,7 @@
/** Constructs the environment to simulate the bounds behavior of the given container. */
CompatDisplayInsets(DisplayContent display, ActivityRecord container,
- @Nullable Rect fixedOrientationBounds) {
+ @Nullable Rect letterboxedContainerBounds) {
mOriginalRotation = display.getRotation();
mIsFloating = container.getWindowConfiguration().tasksAreFloating();
mOriginalRequestedOrientation = container.getRequestedConfigurationOrientation();
@@ -10759,22 +10774,21 @@
mNonDecorInsets[rotation] = emptyRect;
mStableInsets[rotation] = emptyRect;
}
- mIsInFixedOrientationLetterbox = false;
+ mIsInFixedOrientationOrAspectRatioLetterbox = false;
return;
}
final Task task = container.getTask();
- mIsInFixedOrientationLetterbox = fixedOrientationBounds != null;
-
+ mIsInFixedOrientationOrAspectRatioLetterbox = letterboxedContainerBounds != null;
// Store the bounds of the Task for the non-resizable activity to use in size compat
// mode so that the activity will not be resized regardless the windowing mode it is
// currently in.
- // When an activity needs to be letterboxed because of fixed orientation, use fixed
- // orientation bounds instead of task bounds since the activity will be displayed
- // within these even if it is in size compat mode.
- final Rect filledContainerBounds = mIsInFixedOrientationLetterbox
- ? fixedOrientationBounds
+ // When an activity needs to be letterboxed because of fixed orientation or aspect
+ // ratio, use resolved bounds instead of task bounds since the activity will be
+ // displayed within these even if it is in size compat mode.
+ final Rect filledContainerBounds = mIsInFixedOrientationOrAspectRatioLetterbox
+ ? letterboxedContainerBounds
: task != null ? task.getBounds() : display.getBounds();
final int filledContainerRotation = task != null
? task.getConfiguration().windowConfiguration.getRotation()
diff --git a/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceContentTest.java b/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceContentTest.java
index 2366f56..7aafa8e 100644
--- a/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceContentTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceContentTest.java
@@ -24,9 +24,11 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.atLeast;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
+import android.content.pm.PackageManagerInternal;
import android.media.projection.MediaProjectionInfo;
import android.media.projection.MediaProjectionManager;
import android.os.Binder;
@@ -72,6 +74,7 @@
@Mock private WindowManagerInternal mWindowManager;
@Mock private MediaProjectionManager mProjectionManager;
+ @Mock private PackageManagerInternal mPackageManagerInternal;
private MediaProjectionInfo mMediaProjectionInfo;
@Captor
@@ -91,7 +94,7 @@
mSensitiveContentProtectionManagerService =
new SensitiveContentProtectionManagerService(mContext);
mSensitiveContentProtectionManagerService.init(mProjectionManager, mWindowManager,
- new ArraySet<>(Set.of(mExemptedScreenRecorderPackage)));
+ mPackageManagerInternal, new ArraySet<>(Set.of(mExemptedScreenRecorderPackage)));
verify(mProjectionManager).addCallback(mMediaProjectionCallbackCaptor.capture(), any());
mMediaPorjectionCallback = mMediaProjectionCallbackCaptor.getValue();
mMediaProjectionInfo =
@@ -146,6 +149,20 @@
}
@Test
+ public void testAutofillServicePackageExemption() {
+ String testAutofillService = mScreenRecorderPackage + "/com.example.SampleAutofillService";
+ int userId = Process.myUserHandle().getIdentifier();
+ Settings.Secure.putStringForUser(mContext.getContentResolver(),
+ Settings.Secure.AUTOFILL_SERVICE, testAutofillService , userId);
+
+ mMediaPorjectionCallback.onStart(mMediaProjectionInfo);
+ mSensitiveContentProtectionManagerService.setSensitiveContentProtection(
+ mPackageInfo.getWindowToken(), mPackageInfo.getPkg(), mPackageInfo.getUid(), true);
+ verify(mWindowManager, never())
+ .addBlockScreenCaptureForApps(mPackageInfoCaptor.capture());
+ }
+
+ @Test
public void testDeveloperOptionDisableFeature() {
mockDisabledViaDeveloperOption();
mMediaProjectionCallbackCaptor.getValue().onStart(mMediaProjectionInfo);
diff --git a/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceNotificationTest.java b/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceNotificationTest.java
index e74fe29..5065144 100644
--- a/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceNotificationTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/SensitiveContentProtectionManagerServiceNotificationTest.java
@@ -31,6 +31,7 @@
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
+import android.content.pm.PackageManagerInternal;
import android.media.projection.MediaProjectionInfo;
import android.media.projection.MediaProjectionManager;
import android.platform.test.annotations.RequiresFlagsEnabled;
@@ -104,6 +105,9 @@
private WindowManagerInternal mWindowManager;
@Mock
+ private PackageManagerInternal mPackageManagerInternal;
+
+ @Mock
private StatusBarNotification mNotification1;
@Mock
@@ -141,7 +145,7 @@
setupSensitiveNotification();
mSensitiveContentProtectionManagerService.init(mProjectionManager, mWindowManager,
- new ArraySet<>(Set.of(EXEMPTED_SCREEN_RECORDER_PACKAGE)));
+ mPackageManagerInternal, new ArraySet<>(Set.of(EXEMPTED_SCREEN_RECORDER_PACKAGE)));
// Obtain useful mMediaProjectionCallback
verify(mProjectionManager).addCallback(mMediaProjectionCallbackCaptor.capture(), any());
diff --git a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
index 856ad2a..680738b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
@@ -27,6 +27,7 @@
import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
+import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_16_9;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_3_2;
@@ -1942,8 +1943,7 @@
assertThat(mActivity.inSizeCompatMode()).isTrue();
assertActivityMaxBoundsSandboxed();
-
- final int scale = dh / dw;
+ final int scale = dh / dw;
// App bounds should be dh / scale x dw / scale
assertEquals(dw, rotatedDisplayBounds.width());
@@ -4148,6 +4148,37 @@
}
@Test
+ public void testFixedAspectRatioAppInPortraitCloseToSquareDisplay_notInSizeCompat() {
+ setUpDisplaySizeWithApp(2200, 2280);
+ mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
+ final DisplayContent display = mActivity.mDisplayContent;
+ // Simulate taskbar, final app bounds are (0, 0, 2200, 2130) - landscape
+ final WindowState navbar = createWindow(null, TYPE_NAVIGATION_BAR, mDisplayContent,
+ "navbar");
+ final Binder owner = new Binder();
+ navbar.mAttrs.providedInsets = new InsetsFrameProvider[] {
+ new InsetsFrameProvider(owner, 0, WindowInsets.Type.navigationBars())
+ .setInsetsSize(Insets.of(0, 0, 0, 150))
+ };
+ display.getDisplayPolicy().addWindowLw(navbar, navbar.mAttrs);
+ assertTrue(navbar.providesDisplayDecorInsets()
+ && display.getDisplayPolicy().updateDecorInsetsInfo());
+ display.sendNewConfiguration();
+
+ prepareMinAspectRatio(mActivity, OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE,
+ SCREEN_ORIENTATION_LANDSCAPE);
+ // To force config to update again but with the same landscape orientation.
+ mActivity.setRequestedOrientation(SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
+
+ assertTrue(mActivity.shouldCreateCompatDisplayInsets());
+ assertNotNull(mActivity.getCompatDisplayInsets());
+ // Activity is not letterboxed for fixed orientation because orientation is respected
+ // with insets, and should not be in size compat mode
+ assertFalse(mActivity.isLetterboxedForFixedOrientationAndAspectRatio());
+ assertFalse(mActivity.inSizeCompatMode());
+ }
+
+ @Test
public void testApplyAspectRatio_activityAlignWithParentAppVertical() {
if (Flags.insetsDecoupledConfiguration()) {
// TODO (b/151861875): Re-enable it. This is disabled temporarily because the config
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
index 1ca808f..dab966b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskTests.java
@@ -833,7 +833,7 @@
final ActivityRecord activity = new ActivityBuilder(mAtm).setTask(task).build();
final ActivityRecord.CompatDisplayInsets compatInsets =
new ActivityRecord.CompatDisplayInsets(
- display, activity, /* fixedOrientationBounds= */ null);
+ display, activity, /* letterboxedContainerBounds */ null);
task.computeConfigResourceOverrides(inOutConfig, parentConfig, compatInsets);
assertEquals(largerLandscapeBounds, inOutConfig.windowConfiguration.getAppBounds());
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index ed3d5d5..ebdd556 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -8013,6 +8013,27 @@
KEY_SCAN_LIMITED_SERVICE_AFTER_VOLTE_FAILURE_BOOL =
KEY_PREFIX + "scan_limited_service_after_volte_failure_bool";
+ /**
+ * This config defines {@link ImsReasonInfo} code with which the emergency call
+ * shall be retried.
+ *
+ * <p>
+ * If the reason code is one of the following, the emergency call shall be retried
+ * regardless of this configuration.
+ * <ul>
+ * <li>{@link ImsReasonInfo#CODE_LOCAL_CALL_CS_RETRY_REQUIRED}</li>
+ * <li>{@link ImsReasonInfo#CODE_LOCAL_NOT_REGISTERED}</li>
+ * <li>{@link ImsReasonInfo#CODE_SIP_ALTERNATE_EMERGENCY_CALL}</li>
+ * </ul>
+ * <p>
+ *
+ * This config is empty by default.
+ *
+ * @hide
+ */
+ public static final String KEY_IMS_REASONINFO_CODE_TO_RETRY_EMERGENCY_INT_ARRAY =
+ KEY_PREFIX + "ims_reasoninfo_code_to_retry_emergency_int_array";
+
private static PersistableBundle getDefaults() {
PersistableBundle defaults = new PersistableBundle();
defaults.putBoolean(KEY_RETRY_EMERGENCY_ON_IMS_PDN_BOOL, false);
@@ -8085,6 +8106,8 @@
defaults.putBoolean(KEY_START_QUICK_CROSS_STACK_REDIAL_TIMER_WHEN_REGISTERED_BOOL,
true);
defaults.putBoolean(KEY_SCAN_LIMITED_SERVICE_AFTER_VOLTE_FAILURE_BOOL, false);
+ defaults.putIntArray(KEY_IMS_REASONINFO_CODE_TO_RETRY_EMERGENCY_INT_ARRAY,
+ new int[0]);
return defaults;
}
@@ -9836,7 +9859,7 @@
* An integer key holds the time interval for refreshing or re-querying the satellite
* entitlement status from the entitlement server to ensure it is the latest.
*
- * The default value is 30 days (1 month).
+ * The default value is 7 days.
*/
@FlaggedApi(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
public static final String KEY_SATELLITE_ENTITLEMENT_STATUS_REFRESH_DAYS_INT =
@@ -11008,7 +11031,7 @@
CellSignalStrengthLte.USE_RSRP);
sDefaults.putBoolean(KEY_REMOVE_SATELLITE_PLMN_IN_MANUAL_NETWORK_SCAN_BOOL, true);
sDefaults.putBoolean(KEY_OVERRIDE_WFC_ROAMING_MODE_WHILE_USING_NTN_BOOL, true);
- sDefaults.putInt(KEY_SATELLITE_ENTITLEMENT_STATUS_REFRESH_DAYS_INT, 30);
+ sDefaults.putInt(KEY_SATELLITE_ENTITLEMENT_STATUS_REFRESH_DAYS_INT, 7);
sDefaults.putBoolean(KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, false);
sDefaults.putString(KEY_SATELLITE_ENTITLEMENT_APP_NAME_STRING, "androidSatmode");
sDefaults.putBoolean(KEY_DISABLE_DUN_APN_WHILE_ROAMING_WITH_PRESET_APN_BOOL, false);
diff --git a/wifi/tests/Android.bp b/wifi/tests/Android.bp
index 5a0f742..1d3e4bd 100644
--- a/wifi/tests/Android.bp
+++ b/wifi/tests/Android.bp
@@ -39,7 +39,7 @@
"androidx.test.core",
"frameworks-base-testutils",
"guava",
- "mockito-target-minus-junit4",
+ "mockito-target-extended-minus-junit4",
"truth",
],
@@ -48,6 +48,12 @@
"android.test.base",
],
+ // Required by Extended Mockito
+ jni_libs: [
+ "libdexmakerjvmtiagent",
+ "libstaticjvmtiagent",
+ ],
+
test_suites: [
"general-tests",
],
diff --git a/wifi/tests/AndroidManifest.xml b/wifi/tests/AndroidManifest.xml
index 18986fc..66056e5 100644
--- a/wifi/tests/AndroidManifest.xml
+++ b/wifi/tests/AndroidManifest.xml
@@ -18,7 +18,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.net.wifi.nonupdatable.test">
- <application>
+ <application android:debuggable="true">
<uses-library android:name="android.test.runner"/>
<activity android:label="WifiTestDummyLabel"
android:name="WifiTestDummyName"