From c46192200564cc4f6b8c6069d0b8c4e8b17bd356 Mon Sep 17 00:00:00 2001 From: Jernej Virag Date: Mon, 31 Jul 2023 12:10:16 +0200 Subject: 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 --- .../Shell/src/com/android/wm/shell/dagger/pip/Pip1Module.java | 2 -- .../Shell/src/com/android/wm/shell/dagger/pip/PipModule.java | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip1Module.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip1Module.java index d972f48b92fd..16c39601e0bf 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip1Module.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip1Module.java @@ -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, diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/PipModule.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/PipModule.java index 2ded4a32a9f3..04032bb17fec 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/PipModule.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/PipModule.java @@ -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; + } } } -- cgit v1.2.3-59-g8ed1b