mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Merge "Do not recreate taskbar due to unestimated bounds" into main
This commit is contained in:
@@ -25,6 +25,9 @@ import static com.android.launcher3.BaseActivity.EVENT_DESTROYED;
|
||||
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;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_TASKBAR_PINNING;
|
||||
import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;
|
||||
@@ -55,7 +58,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.statemanager.StatefulActivity;
|
||||
@@ -134,7 +136,17 @@ public class TaskbarManager {
|
||||
* We use WindowManager's ComponentCallbacks() for internal UI changes (similar to an Activity)
|
||||
* which comes via a different channel
|
||||
*/
|
||||
private final OnIDPChangeListener mIdpChangeListener = c -> recreateTaskbar();
|
||||
private final RecreationListener mRecreationListener = new RecreationListener();
|
||||
|
||||
private class RecreationListener implements DisplayController.DisplayInfoChangeListener {
|
||||
@Override
|
||||
public void onDisplayInfoChanged(Context context, DisplayController.Info info, int flags) {
|
||||
if ((flags & (CHANGE_DENSITY | CHANGE_NAVIGATION_MODE
|
||||
| CHANGE_TASKBAR_PINNING)) != 0) {
|
||||
recreateTaskbar();
|
||||
}
|
||||
}
|
||||
}
|
||||
private final SettingsCache.OnChangeListener mOnSettingsChangeListener = c -> recreateTaskbar();
|
||||
|
||||
private boolean mUserUnlocked = false;
|
||||
@@ -355,7 +367,7 @@ public class TaskbarManager {
|
||||
*/
|
||||
public void onUserUnlocked() {
|
||||
mUserUnlocked = true;
|
||||
LauncherAppState.getIDP(mContext).addOnChangeListener(mIdpChangeListener);
|
||||
DisplayController.INSTANCE.get(mContext).addChangeListener(mRecreationListener);
|
||||
recreateTaskbar();
|
||||
addTaskbarRootViewToWindow();
|
||||
}
|
||||
@@ -553,7 +565,7 @@ public class TaskbarManager {
|
||||
() -> mTaskbarBroadcastReceiver.unregisterReceiverSafely(mContext));
|
||||
destroyExistingTaskbar();
|
||||
if (mUserUnlocked) {
|
||||
LauncherAppState.getIDP(mContext).removeOnChangeListener(mIdpChangeListener);
|
||||
DisplayController.INSTANCE.get(mContext).removeChangeListener(mRecreationListener);
|
||||
}
|
||||
SettingsCache.INSTANCE.get(mContext)
|
||||
.unregister(USER_SETUP_COMPLETE_URI, mOnSettingsChangeListener);
|
||||
|
||||
Reference in New Issue
Block a user