diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 37900fb134960..1306657ae403f 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -674,8 +674,9 @@ android:label="@string/controls_providers_title" android:theme="@style/Theme.ControlsManagement" android:showForAllUsers="true" - android:clearTaskOnLaunch="true" + android:finishOnTaskLaunch="true" android:excludeFromRecents="true" + android:launchMode="singleInstance" android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden" android:visibleToInstantApps="true"> @@ -683,6 +684,7 @@ diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 4912202f8c407..96b8c1c0490ca 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -2696,6 +2696,9 @@ All controls removed + + Changes not saved + The list of all controls could not be loaded. diff --git a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsAnimations.kt b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsAnimations.kt index 4ca47d1d41ba8..cad166d7cd9e0 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsAnimations.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsAnimations.kt @@ -76,6 +76,8 @@ object ControlsAnimations { allowEnterTransitionOverlap = true enterTransition = enterWindowTransition(view.getId()) exitTransition = exitWindowTransition(view.getId()) + reenterTransition = enterWindowTransition(view.getId()) + returnTransition = exitWindowTransition(view.getId()) } } @@ -86,6 +88,11 @@ object ControlsAnimations { showAnimation = false } } + + @OnLifecycleEvent(Lifecycle.Event.ON_STOP) + fun resetAnimation() { + view.translationY = 0f + } } } diff --git a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsEditingActivity.kt b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsEditingActivity.kt index 640c90d2ba597..4e9c550297c53 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsEditingActivity.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsEditingActivity.kt @@ -16,7 +16,6 @@ package com.android.systemui.controls.management -import android.app.ActivityOptions import android.content.ComponentName import android.content.Intent import android.os.Bundle @@ -70,10 +69,6 @@ class ControlsEditingActivity @Inject constructor( } } - override fun onBackPressed() { - finish() - } - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -102,6 +97,23 @@ class ControlsEditingActivity @Inject constructor( currentUserTracker.stopTracking() } + override fun onBackPressed() { + globalActionsComponent.handleShowGlobalActionsMenu() + animateExitAndFinish() + } + + private fun animateExitAndFinish() { + val rootView = requireViewById(R.id.controls_management_root) + ControlsAnimations.exitAnimation( + rootView, + object : Runnable { + override fun run() { + finish() + } + } + ).start() + } + private fun bindViews() { setContentView(R.layout.controls_management) @@ -124,35 +136,13 @@ class ControlsEditingActivity @Inject constructor( } private fun bindButtons() { - requireViewById