Fix @Nullability mismatch with PipTransition

Most of the codebase injecting `PipTransition` expects a non-null object. Trying
to inject a null will outright crash. Moreover, nullability mismatch breaks
sysui-studio builds which actually properly typecheck this nullability.

This CL provides legacy transition until non-null pip2.PipTransition is available.

Bug: 293844330
Test: verified the sysui-studio build now builds and runs
Change-Id: I330ad86a70ddfbf0d08bd6d2ed408d6856ca3162
This commit is contained in:
Jernej Virag
2023-07-31 12:10:16 +02:00
parent 40383d7977
commit c461922005
2 changed files with 6 additions and 5 deletions

View File

@@ -16,7 +16,6 @@
package com.android.wm.shell.dagger.pip;
import android.annotation.Nullable;
import android.content.Context;
import android.os.Handler;
@@ -229,7 +228,6 @@ public abstract class Pip1Module {
@WMSingleton
@Provides
@Nullable
static PipTransition providePipTransition(Context context,
ShellInit shellInit, ShellTaskOrganizer shellTaskOrganizer, Transitions transitions,
PipAnimationController pipAnimationController, PipBoundsAlgorithm pipBoundsAlgorithm,

View File

@@ -36,10 +36,13 @@ import dagger.Provides;
public abstract class PipModule {
@WMSingleton
@Provides
@Nullable
static PipTransitionController providePipTransitionController(
com.android.wm.shell.pip.PipTransition legacyPipTransition,
com.android.wm.shell.pip2.PipTransition newPipTransition) {
return PipUtils.isPip2ExperimentEnabled() ? newPipTransition : legacyPipTransition;
@Nullable com.android.wm.shell.pip2.PipTransition newPipTransition) {
if (PipUtils.isPip2ExperimentEnabled() && newPipTransition != null) {
return newPipTransition;
} else {
return legacyPipTransition;
}
}
}