mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 16:26:47 +00:00
Moving NavigationMode to display controller
Navigation mode affects display properties like bounds and most listeners already had a similar display listener. This will remove race conditions when managing the two events. Bug: 221961069 Test: Presubmit Change-Id: If7a22e006e6b969ecddf075001066809aa72995c
This commit is contained in:
@@ -21,6 +21,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
|
||||
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_DENSITY;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_SUPPORTED_BOUNDS;
|
||||
|
||||
import android.content.ComponentCallbacks;
|
||||
@@ -40,15 +41,12 @@ import androidx.annotation.Nullable;
|
||||
import com.android.launcher3.BaseQuickstepLauncher;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.statemanager.StatefulActivity;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.DisplayController.Info;
|
||||
import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.launcher3.util.SimpleBroadcastReceiver;
|
||||
import com.android.quickstep.RecentsActivity;
|
||||
import com.android.quickstep.SysUINavigationMode;
|
||||
import com.android.quickstep.SysUINavigationMode.Mode;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.TouchInteractionService;
|
||||
import com.android.systemui.unfold.UnfoldTransitionProgressProvider;
|
||||
@@ -59,8 +57,7 @@ import java.io.PrintWriter;
|
||||
/**
|
||||
* Class to manage taskbar lifecycle
|
||||
*/
|
||||
public class TaskbarManager implements DisplayController.DisplayInfoChangeListener,
|
||||
SysUINavigationMode.NavigationModeChangeListener {
|
||||
public class TaskbarManager implements DisplayController.DisplayInfoChangeListener {
|
||||
|
||||
private static final Uri USER_SETUP_COMPLETE_URI = Settings.Secure.getUriFor(
|
||||
Settings.Secure.USER_SETUP_COMPLETE);
|
||||
@@ -70,7 +67,6 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
|
||||
private final Context mContext;
|
||||
private final DisplayController mDisplayController;
|
||||
private final SysUINavigationMode mSysUINavigationMode;
|
||||
private final TaskbarNavButtonController mNavButtonController;
|
||||
private final SettingsCache.OnChangeListener mUserSetupCompleteListener;
|
||||
private final SettingsCache.OnChangeListener mNavBarKidsModeListener;
|
||||
@@ -89,14 +85,13 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
*/
|
||||
private final TaskbarSharedState mSharedState = new TaskbarSharedState();
|
||||
|
||||
private static final int CHANGE_FLAGS =
|
||||
CHANGE_ACTIVE_SCREEN | CHANGE_DENSITY | CHANGE_SUPPORTED_BOUNDS;
|
||||
private static final int CHANGE_FLAGS = CHANGE_ACTIVE_SCREEN | CHANGE_DENSITY
|
||||
| CHANGE_SUPPORTED_BOUNDS | CHANGE_NAVIGATION_MODE;
|
||||
|
||||
private boolean mUserUnlocked = false;
|
||||
|
||||
public TaskbarManager(TouchInteractionService service) {
|
||||
mDisplayController = DisplayController.INSTANCE.get(service);
|
||||
mSysUINavigationMode = SysUINavigationMode.INSTANCE.get(service);
|
||||
Display display =
|
||||
service.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY);
|
||||
mContext = service.createWindowContext(display, TYPE_NAVIGATION_BAR_PANEL, null);
|
||||
@@ -137,7 +132,6 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
mShutdownReceiver = new SimpleBroadcastReceiver(i -> destroyExistingTaskbar());
|
||||
|
||||
mDisplayController.addChangeListener(this);
|
||||
mSysUINavigationMode.addModeChangeListener(this);
|
||||
SettingsCache.INSTANCE.get(mContext).register(USER_SETUP_COMPLETE_URI,
|
||||
mUserSetupCompleteListener);
|
||||
SettingsCache.INSTANCE.get(mContext).register(NAV_BAR_KIDS_MODE,
|
||||
@@ -148,11 +142,6 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
recreateTaskbar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigationModeChanged(Mode newMode) {
|
||||
recreateTaskbar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayInfoChanged(Context context, Info info, int flags) {
|
||||
if ((flags & CHANGE_FLAGS) != 0) {
|
||||
@@ -301,7 +290,6 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
public void destroy() {
|
||||
destroyExistingTaskbar();
|
||||
mDisplayController.removeChangeListener(this);
|
||||
mSysUINavigationMode.removeModeChangeListener(this);
|
||||
SettingsCache.INSTANCE.get(mContext).unregister(USER_SETUP_COMPLETE_URI,
|
||||
mUserSetupCompleteListener);
|
||||
SettingsCache.INSTANCE.get(mContext).unregister(NAV_BAR_KIDS_MODE,
|
||||
|
||||
Reference in New Issue
Block a user