Hide launcher when freeform tasks are visible

This CL introduces a new controller to manage the visibility of the
launcher workspace when desktop mode is active and freeform tasks
are visible.

This controller will be notified when the sysui state flag related
to freeform task visibility is changed.

The controller will modify the workspace visibility as well as
the flags on the activity indicating if it's been paused / resumed
based on freeform tasks being visible or not.

Bug: 245569277
Test: manual -  enable desktop mode and open some freeform tasks
             => observe that the contents of launcher is hidden and
                taskbar shows
             -  remove all of the freeform tasks
             => observe that the contents of launcher reappears along
                with the hotseat.
Change-Id: I378ab97b40cbb954a06f4e2426b195efddad905c
This commit is contained in:
Mady Mellor
2022-09-14 15:17:21 -07:00
parent 41235d529b
commit 9a90c2d521
8 changed files with 166 additions and 7 deletions

View File

@@ -196,8 +196,7 @@ public abstract class BaseActivity extends Activity implements AppLauncher,
@Override
protected void onResume() {
addActivityFlags(ACTIVITY_STATE_RESUMED | ACTIVITY_STATE_USER_ACTIVE);
removeActivityFlags(ACTIVITY_STATE_USER_WILL_BE_ACTIVE);
setResumed();
super.onResume();
}
@@ -228,7 +227,7 @@ public abstract class BaseActivity extends Activity implements AppLauncher,
@Override
protected void onPause() {
removeActivityFlags(ACTIVITY_STATE_RESUMED | ACTIVITY_STATE_DEFERRED_RESUMED);
setPaused();
super.onPause();
// Reset the overridden sysui flags used for the task-swipe launch animation, we do this
@@ -260,6 +259,21 @@ public abstract class BaseActivity extends Activity implements AppLauncher,
return (mActivityFlags & ACTIVITY_STATE_RESUMED) != 0;
}
/**
* Sets the activity to appear as paused.
*/
public void setPaused() {
removeActivityFlags(ACTIVITY_STATE_RESUMED | ACTIVITY_STATE_DEFERRED_RESUMED);
}
/**
* Sets the activity to appear as resumed.
*/
public void setResumed() {
addActivityFlags(ACTIVITY_STATE_RESUMED | ACTIVITY_STATE_USER_ACTIVE);
removeActivityFlags(ACTIVITY_STATE_USER_WILL_BE_ACTIVE);
}
public boolean isUserActive() {
return (mActivityFlags & ACTIVITY_STATE_USER_ACTIVE) != 0;
}