mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Fixing out of order taskbar callbacks
OnCreate can come before onDestroy for a previous activity which can cause the callbacks for taskbar to get cleared Bug: 190170303 Test: Presubmit Change-Id: I48334605384d4604043a50ffc3d137f84575148a
This commit is contained in:
@@ -26,7 +26,7 @@ import android.content.Context;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.view.Display;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.launcher3.BaseQuickstepLauncher;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
@@ -103,14 +103,25 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets or clears a launcher to act as taskbar callback
|
||||
* Sets a launcher to act as taskbar callback
|
||||
*/
|
||||
public void setLauncher(@Nullable BaseQuickstepLauncher launcher) {
|
||||
public void setLauncher(@NonNull BaseQuickstepLauncher launcher) {
|
||||
mLauncher = launcher;
|
||||
if (mTaskbarActivityContext != null) {
|
||||
mTaskbarActivityContext.setUIController(mLauncher == null
|
||||
? TaskbarUIController.DEFAULT
|
||||
: new LauncherTaskbarUIController(launcher, mTaskbarActivityContext));
|
||||
mTaskbarActivityContext.setUIController(
|
||||
new LauncherTaskbarUIController(launcher, mTaskbarActivityContext));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears a previously set Launcher
|
||||
*/
|
||||
public void clearLauncher(@NonNull BaseQuickstepLauncher launcher) {
|
||||
if (mLauncher == launcher) {
|
||||
mLauncher = null;
|
||||
if (mTaskbarActivityContext != null) {
|
||||
mTaskbarActivityContext.setUIController(TaskbarUIController.DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user