Revert "Support toggling Taskbar All Apps with 3P Launcher."

This reverts commit 176f186a6d.

Reason for revert: DroidMonitor: Potential culprit for http://b/331438065 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: Ie375277ad2f65199749f0211ab50037d4b37e664
Merged-In: Ie375277ad2f65199749f0211ab50037d4b37e664
This commit is contained in:
Liana Kazanova
2024-03-26 19:20:15 +00:00
committed by Brian Isganitis
parent 176f186a6d
commit 036a83cd99
7 changed files with 47 additions and 229 deletions
@@ -23,6 +23,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
import static com.android.launcher3.BaseActivity.EVENT_DESTROYED;
import static com.android.launcher3.Flags.enableUnfoldStateAnimation;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate;
import static com.android.launcher3.util.DisplayController.CHANGE_DENSITY;
@@ -68,7 +69,6 @@ import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.SettingsCache;
import com.android.launcher3.util.SimpleBroadcastReceiver;
import com.android.quickstep.AllAppsActionManager;
import com.android.quickstep.RecentsActivity;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TouchInteractionService;
@@ -158,8 +158,6 @@ public class TaskbarManager {
private final SimpleBroadcastReceiver mTaskbarBroadcastReceiver =
new SimpleBroadcastReceiver(this::showTaskbarFromBroadcast);
private final AllAppsActionManager mAllAppsActionManager;
private final Runnable mActivityOnDestroyCallback = new Runnable() {
@Override
public void run() {
@@ -214,14 +212,12 @@ public class TaskbarManager {
private Boolean mFolded;
@SuppressLint("WrongConstant")
public TaskbarManager(
TouchInteractionService service, AllAppsActionManager allAppsActionManager) {
public TaskbarManager(TouchInteractionService service) {
Display display =
service.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY);
mContext = service.createWindowContext(display,
ENABLE_TASKBAR_NAVBAR_UNIFICATION ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL,
null);
mAllAppsActionManager = allAppsActionManager;
mNavigationBarPanelContext = ENABLE_TASKBAR_NAVBAR_UNIFICATION
? service.createWindowContext(display, TYPE_NAVIGATION_BAR_PANEL, null)
: null;
@@ -295,10 +291,10 @@ public class TaskbarManager {
recreateTaskbar();
} else {
// Config change might be handled without re-creating the taskbar
if (dp != null && !isTaskbarEnabled(dp)) {
if (dp != null && !isTaskbarPresent(dp)) {
destroyExistingTaskbar();
} else {
if (dp != null && isTaskbarEnabled(dp)) {
if (dp != null && isTaskbarPresent(dp)) {
if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) {
// Re-initialize for screen size change? Should this be done
// by looking at screen-size change flag in configDiff in the
@@ -353,7 +349,7 @@ public class TaskbarManager {
}
DeviceProfile dp = mUserUnlocked ?
LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null;
if (dp == null || !isTaskbarEnabled(dp)) {
if (dp == null || !isTaskbarPresent(dp)) {
removeTaskbarRootViewFromWindow();
}
}
@@ -373,11 +369,20 @@ public class TaskbarManager {
* @param homeAllAppsIntent Intent used if Taskbar is not enabled or Launcher is resumed.
*/
public void toggleAllApps(Intent homeAllAppsIntent) {
if (mTaskbarActivityContext == null || mTaskbarActivityContext.canToggleHomeAllApps()) {
if (mTaskbarActivityContext == null) {
mContext.startActivity(homeAllAppsIntent);
} else {
mTaskbarActivityContext.toggleAllAppsSearch();
return;
}
if (mActivity != null
&& mActivity.isResumed()
&& !mActivity.isInState(OVERVIEW)
&& !(mActivity instanceof QuickstepLauncher l && l.areFreeformTasksVisible())) {
mContext.startActivity(homeAllAppsIntent);
return;
}
mTaskbarActivityContext.toggleAllAppsSearch();
}
/**
@@ -472,12 +477,9 @@ public class TaskbarManager {
DeviceProfile dp = mUserUnlocked ?
LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null;
// All Apps action is unrelated to navbar unification, so we only need to check DP.
mAllAppsActionManager.setTaskbarPresent(dp != null && dp.isTaskbarPresent);
destroyExistingTaskbar();
boolean isTaskbarEnabled = dp != null && isTaskbarEnabled(dp);
boolean isTaskbarEnabled = dp != null && isTaskbarPresent(dp);
debugWhyTaskbarNotDestroyed("recreateTaskbar: isTaskbarEnabled=" + isTaskbarEnabled
+ " [dp != null (i.e. mUserUnlocked)]=" + (dp != null)
+ " FLAG_HIDE_NAVBAR_WINDOW=" + ENABLE_TASKBAR_NAVBAR_UNIFICATION
@@ -542,7 +544,7 @@ public class TaskbarManager {
}
}
private static boolean isTaskbarEnabled(DeviceProfile deviceProfile) {
private static boolean isTaskbarPresent(DeviceProfile deviceProfile) {
return ENABLE_TASKBAR_NAVBAR_UNIFICATION || deviceProfile.isTaskbarPresent;
}