Clean up null check for mBackNavigationController

Only need to check when calling startBackNavigation.

Bug: 131727607
Test: build/flash
Change-Id: Ib6b92a4019070bc711e7a1ea9462eaf2d404df42
This commit is contained in:
wilsonshih
2022-10-19 19:52:26 +08:00
parent df86b40c33
commit 0488e47548
4 changed files with 13 additions and 23 deletions

View File

@@ -460,7 +460,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
KeyguardController mKeyguardController;
private final ClientLifecycleManager mLifecycleManager;
@Nullable
final BackNavigationController mBackNavigationController;
private TaskChangeNotificationController mTaskChangeNotificationController;
@@ -847,8 +846,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
mTaskOrganizerController = mWindowOrganizerController.mTaskOrganizerController;
mTaskFragmentOrganizerController =
mWindowOrganizerController.mTaskFragmentOrganizerController;
mBackNavigationController = BackNavigationController.isEnabled()
? new BackNavigationController() : null;
mBackNavigationController = new BackNavigationController();
}
public void onSystemReady() {
@@ -1031,9 +1029,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
mLockTaskController.setWindowManager(wm);
mTaskSupervisor.setWindowManager(wm);
mRootWindowContainer.setWindowManager(wm);
if (mBackNavigationController != null) {
mBackNavigationController.setWindowManager(wm);
}
mBackNavigationController.setWindowManager(wm);
}
}
@@ -1852,9 +1848,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
IWindowFocusObserver observer, BackAnimationAdapter adapter) {
mAmInternal.enforceCallingPermission(START_TASKS_FROM_RECENTS,
"startBackNavigation()");
if (mBackNavigationController == null) {
return null;
}
return mBackNavigationController.startBackNavigation(observer, adapter);
}

View File

@@ -65,12 +65,12 @@ class BackNavigationController {
// TODO (b/241808055) Find a appropriate time to remove during refactor
// Execute back animation with legacy transition system. Temporary flag for easier debugging.
static final boolean ENABLE_SHELL_TRANSITIONS = WindowManagerService.sEnableShellTransitions;
/**
* Returns true if the back predictability feature is enabled
* true if the back predictability feature is enabled
*/
static boolean isEnabled() {
return SystemProperties.getInt("persist.wm.debug.predictive_back", 1) != 0;
}
static final boolean sPredictBackEnable =
SystemProperties.getBoolean("persist.wm.debug.predictive_back", true);
static boolean isScreenshotEnabled() {
return SystemProperties.getInt("persist.wm.debug.predictive_back_screenshot", 0) != 0;
@@ -88,6 +88,9 @@ class BackNavigationController {
@Nullable
BackNavigationInfo startBackNavigation(
IWindowFocusObserver observer, BackAnimationAdapter adapter) {
if (!sPredictBackEnable) {
return null;
}
final WindowManagerService wmService = mWindowManagerService;
mFocusObserver = observer;

View File

@@ -840,11 +840,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
if (recentsAnimationController != null) {
recentsAnimationController.checkAnimationReady(defaultDisplay.mWallpaperController);
}
final BackNavigationController backNavigationController =
mWmService.mAtmService.mBackNavigationController;
if (backNavigationController != null) {
backNavigationController.checkAnimationReady(defaultDisplay.mWallpaperController);
}
mWmService.mAtmService.mBackNavigationController
.checkAnimationReady(defaultDisplay.mWallpaperController);
for (int displayNdx = 0; displayNdx < mChildren.size(); ++displayNdx) {
final DisplayContent displayContent = mChildren.get(displayNdx);

View File

@@ -239,8 +239,7 @@ class WallpaperController {
private boolean isBackNavigationTarget(WindowState w) {
// The window is in animating by back navigation and set to show wallpaper.
final BackNavigationController controller = mService.mAtmService.mBackNavigationController;
return controller != null && controller.isWallpaperVisible(w);
return mService.mAtmService.mBackNavigationController.isWallpaperVisible(w);
}
/**
@@ -831,9 +830,7 @@ class WallpaperController {
// If there was a pending back navigation animation that would show wallpaper, start
// the animation due to it was skipped in previous surface placement.
if (mService.mAtmService.mBackNavigationController != null) {
mService.mAtmService.mBackNavigationController.startAnimation();
}
mService.mAtmService.mBackNavigationController.startAnimation();
return true;
}
return false;