Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlsActivity.kt +29 −4 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import android.os.Bundle import android.os.RemoteException import android.service.dreams.IDreamManager import android.view.View import android.view.ViewGroup import android.view.WindowInsets Loading @@ -40,11 +42,13 @@ import javax.inject.Inject */ class ControlsActivity @Inject constructor( private val uiController: ControlsUiController, private val broadcastDispatcher: BroadcastDispatcher private val broadcastDispatcher: BroadcastDispatcher, private val dreamManager: IDreamManager, ) : ComponentActivity() { private lateinit var parent: ViewGroup private lateinit var broadcastReceiver: BroadcastReceiver private var mExitToDream: Boolean = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Loading Loading @@ -81,17 +85,36 @@ class ControlsActivity @Inject constructor( parent = requireViewById<ViewGroup>(R.id.global_actions_controls) parent.alpha = 0f uiController.show(parent, { finish() }, this) uiController.show(parent, { finishOrReturnToDream() }, this) ControlsAnimations.enterAnimation(parent).start() } override fun onBackPressed() { override fun onResume() { super.onResume() mExitToDream = intent.getBooleanExtra(ControlsUiController.EXIT_TO_DREAM, false) } fun finishOrReturnToDream() { if (mExitToDream) { try { mExitToDream = false dreamManager.dream() return } catch (e: RemoteException) { // Fall through } } finish() } override fun onBackPressed() { finishOrReturnToDream() } override fun onStop() { super.onStop() mExitToDream = false uiController.hide() } Loading @@ -106,7 +129,8 @@ class ControlsActivity @Inject constructor( broadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { val action = intent.getAction() if (Intent.ACTION_SCREEN_OFF.equals(action)) { if (action == Intent.ACTION_SCREEN_OFF || action == Intent.ACTION_DREAMING_STARTED) { finish() } } Loading @@ -114,6 +138,7 @@ class ControlsActivity @Inject constructor( val filter = IntentFilter() filter.addAction(Intent.ACTION_SCREEN_OFF) filter.addAction(Intent.ACTION_DREAMING_STARTED) broadcastDispatcher.registerReceiver(broadcastReceiver, filter) } } packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt +1 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ interface ControlsUiController { companion object { public const val TAG = "ControlsUiController" public const val EXTRA_ANIMATE = "extra_animate" public const val EXIT_TO_DREAM = "extra_exit_to_dream" } fun show(parent: ViewGroup, onDismiss: Runnable, activityContext: Context) Loading packages/SystemUI/src/com/android/systemui/dreams/complication/DreamHomeControlsComplication.java +2 −1 Original line number Diff line number Diff line Loading @@ -210,7 +210,8 @@ public class DreamHomeControlsComplication implements Complication { final Intent intent = new Intent(mContext, ControlsActivity.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK) .putExtra(ControlsUiController.EXTRA_ANIMATE, true); .putExtra(ControlsUiController.EXTRA_ANIMATE, true) .putExtra(ControlsUiController.EXIT_TO_DREAM, true); final ActivityLaunchAnimator.Controller controller = v != null ? ActivityLaunchAnimator.Controller.fromView(v, null /* cujType */) Loading Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlsActivity.kt +29 −4 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import android.os.Bundle import android.os.RemoteException import android.service.dreams.IDreamManager import android.view.View import android.view.ViewGroup import android.view.WindowInsets Loading @@ -40,11 +42,13 @@ import javax.inject.Inject */ class ControlsActivity @Inject constructor( private val uiController: ControlsUiController, private val broadcastDispatcher: BroadcastDispatcher private val broadcastDispatcher: BroadcastDispatcher, private val dreamManager: IDreamManager, ) : ComponentActivity() { private lateinit var parent: ViewGroup private lateinit var broadcastReceiver: BroadcastReceiver private var mExitToDream: Boolean = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Loading Loading @@ -81,17 +85,36 @@ class ControlsActivity @Inject constructor( parent = requireViewById<ViewGroup>(R.id.global_actions_controls) parent.alpha = 0f uiController.show(parent, { finish() }, this) uiController.show(parent, { finishOrReturnToDream() }, this) ControlsAnimations.enterAnimation(parent).start() } override fun onBackPressed() { override fun onResume() { super.onResume() mExitToDream = intent.getBooleanExtra(ControlsUiController.EXIT_TO_DREAM, false) } fun finishOrReturnToDream() { if (mExitToDream) { try { mExitToDream = false dreamManager.dream() return } catch (e: RemoteException) { // Fall through } } finish() } override fun onBackPressed() { finishOrReturnToDream() } override fun onStop() { super.onStop() mExitToDream = false uiController.hide() } Loading @@ -106,7 +129,8 @@ class ControlsActivity @Inject constructor( broadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { val action = intent.getAction() if (Intent.ACTION_SCREEN_OFF.equals(action)) { if (action == Intent.ACTION_SCREEN_OFF || action == Intent.ACTION_DREAMING_STARTED) { finish() } } Loading @@ -114,6 +138,7 @@ class ControlsActivity @Inject constructor( val filter = IntentFilter() filter.addAction(Intent.ACTION_SCREEN_OFF) filter.addAction(Intent.ACTION_DREAMING_STARTED) broadcastDispatcher.registerReceiver(broadcastReceiver, filter) } }
packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt +1 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ interface ControlsUiController { companion object { public const val TAG = "ControlsUiController" public const val EXTRA_ANIMATE = "extra_animate" public const val EXIT_TO_DREAM = "extra_exit_to_dream" } fun show(parent: ViewGroup, onDismiss: Runnable, activityContext: Context) Loading
packages/SystemUI/src/com/android/systemui/dreams/complication/DreamHomeControlsComplication.java +2 −1 Original line number Diff line number Diff line Loading @@ -210,7 +210,8 @@ public class DreamHomeControlsComplication implements Complication { final Intent intent = new Intent(mContext, ControlsActivity.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK) .putExtra(ControlsUiController.EXTRA_ANIMATE, true); .putExtra(ControlsUiController.EXTRA_ANIMATE, true) .putExtra(ControlsUiController.EXIT_TO_DREAM, true); final ActivityLaunchAnimator.Controller controller = v != null ? ActivityLaunchAnimator.Controller.fromView(v, null /* cujType */) Loading