Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34c0e692 authored by Coco Duan's avatar Coco Duan
Browse files

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
parent 4c2685cd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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,
+9 −2
Original line number Diff line number Diff line
@@ -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
                try {
                    checkNotNull(windowManagerService).lockNow(/* options */ null)
                    finish()
                } catch (e: RemoteException) {
                    Log.e(TAG, "Couldn't lock the device as WindowManager is dead.")
                }
            }
        )
    }