Merge "Fixing out of order taskbar callbacks" into sc-v2-dev

This commit is contained in:
Sunny Goyal
2021-06-19 00:40:46 +00:00
committed by Android (Google) Code Review
3 changed files with 19 additions and 8 deletions

View File

@@ -132,7 +132,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
unbindService(mTisBinderConnection);
if (mTaskbarManager != null) {
mTaskbarManager.setLauncher(null);
mTaskbarManager.clearLauncher(this);
}
super.onDestroy();
}

View File

@@ -98,11 +98,11 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
@Override
protected void onDestroy() {
onLauncherResumedOrPaused(false);
mIconAlignmentForResumedState.finishAnimation();
mIconAlignmentForGestureState.finishAnimation();
mHotseatController.cleanup();
setTaskbarViewVisible(true);
mLauncher.getHotseat().setIconsAlpha(1f);
mLauncher.setTaskbarUIController(null);
}

View File

@@ -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);
}
}
}