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

Commit 42b0ab32 authored by William Xiao's avatar William Xiao
Browse files

Remove lock delay on exiting edit mode activity

I no longer see a flash of the lock screen with the delay removed. The
delay is also causing a few other issues.

Bug: 346433377
Fix: 346433377
Bug: 344627152
Fix: 344627152
Bug: 325108777
Test: manually verified CUJs, see b/325108777 for video of current
      state
Flag: com.android.systemui.communal_hub
Change-Id: Id5c513a63d6607474357aa4bd5e32578064968ef
parent 1726f4db
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -70,8 +70,6 @@ constructor(

    private var shouldOpenWidgetPickerOnStart = false

    private var lockOnDestroy = false

    private val addWidgetActivityLauncher: ActivityResultLauncher<Intent> =
        registerForActivityResult(StartActivityForResult()) { result ->
            when (result.resultCode) {
@@ -97,8 +95,7 @@ constructor(
                                run { Log.w(TAG, "No AppWidgetProviderInfo found in result.") }
                            }
                        }
                    }
                        ?: run { Log.w(TAG, "No data in result.") }
                    } ?: run { Log.w(TAG, "No data in result.") }
                }
                else ->
                    Log.w(
@@ -160,9 +157,9 @@ constructor(

            // Wait for the current scene to be idle on communal.
            communalViewModel.isIdleOnCommunal.first { it }
            // Then finish the activity (this helps to avoid a flash of lockscreen when locking
            // in onDestroy()).
            lockOnDestroy = true

            // Lock to go back to the hub after exiting.
            lockNow()
            finish()
        }
    }
@@ -196,8 +193,6 @@ constructor(
    override fun onDestroy() {
        super.onDestroy()
        communalViewModel.setEditModeOpen(false)

        if (lockOnDestroy) lockNow()
    }

    private fun lockNow() {