diff options
| author | 2023-12-12 22:42:16 +0000 | |
|---|---|---|
| committer | 2023-12-15 17:21:18 +0000 | |
| commit | 34c0e6927e0ac12ed535ea44548ad13bb629f045 (patch) | |
| tree | c986039950720e33d487cb306f5b24d5fc3dd0e2 | |
| parent | 4c2685cd05b3fc62e95b9c6cc74281d8201acd45 (diff) | |
Reshow glanceable hub after exiting the edit mode
- Lock the device to reshow glanceable hub after exiting the edit
  mode as users are asked to unlock the device before entering edit
  mode. And as we are on Communal scene already, there is no need
  to do scene transition.
- Fixed a bug in CommunalContainer that currentScene always remains
  as Blank scene. It solves that scene transition layout not actually
  showing the updated disired scene from the viewModel.
Bug: b/315154364
Test: manually
Flag: ACONFIG com.android.systemui.communal_hub DEVELOPMENT
Change-Id: I6f97521aa149e93ec054d5caac565d27577a4add
2 files changed, 10 insertions, 3 deletions
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 d83f3aae1ace..249b3e14ec72 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 @@ -74,7 +74,7 @@ fun CommunalContainer(  ) {      val currentScene: SceneKey by          viewModel.currentScene -            .transform<CommunalSceneKey, SceneKey> { value -> value.toTransitionSceneKey() } +            .transform { value -> emit(value.toTransitionSceneKey()) }              .collectAsState(TransitionSceneKey.Blank)      val sceneTransitionLayoutState = remember { SceneTransitionLayoutState(currentScene) }      // Don't show hub mode UI if keyguard is present. This is important since we're in the shade, 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 573a748b4290..887b18cfe4c9 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivity.kt @@ -19,7 +19,9 @@ package com.android.systemui.communal.widgets  import android.appwidget.AppWidgetProviderInfo  import android.content.Intent  import android.os.Bundle +import android.os.RemoteException  import android.util.Log +import android.view.IWindowManager  import androidx.activity.ComponentActivity  import androidx.activity.result.ActivityResultLauncher  import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult @@ -34,6 +36,7 @@ class EditWidgetsActivity  constructor(      private val communalViewModel: CommunalEditModeViewModel,      private val communalInteractor: CommunalInteractor, +    private var windowManagerService: IWindowManager? = null,  ) : ComponentActivity() {      companion object {          /** @@ -77,8 +80,12 @@ constructor(                  )              },              onEditDone = { -                // TODO(b/315154364): in a separate change, lock the device and transition to GH -                finish() +                try { +                    checkNotNull(windowManagerService).lockNow(/* options */ null) +                    finish() +                } catch (e: RemoteException) { +                    Log.e(TAG, "Couldn't lock the device as WindowManager is dead.") +                }              }          )      }  |