Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2fe3ffa3 authored by shawnlin's avatar shawnlin
Browse files

Attach navigation bar to app during quick switching (2/N)

- Create a new method in StatusBar to enable/disable nav bar luma
  sampling.
- Modify the IRcentsAnimationController.detachNavigationBarFromApp() API
  to notify the server side whether we should run the fade-in animation
  or not.
- Don't let fixed rotation animation control the navigation when it's
  controlled by recents animation and vice versa.
- Don't attach nav bar when it's in split screen mode and in landscape.
- Translate the nav bar surface to match the secondary app's bounds in
  split screen mode in portrait.

Bug: 139273001
Test: atest RecentsAnimationControllerTest CommandQueueTest
Change-Id: I06dc2dd0655bc8a2e6ad03808576e55294a322e8
parent e1ca2891
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -142,7 +142,13 @@ interface IRecentsAnimationController {
     *
     * The system reparents the leash of navigation bar to the app when the recents animation starts
     * and Launcher should call this method to let system restore the navigation bar to its
     * original position when the quick switch gesture is finished.
     * original position when the quick switch gesture is finished and will run the fade-in
     * animation If {@param moveHomeToTop} is {@code true}. Otherwise, restore the navigtation bar
     * without animation.
     *
     * @param moveHomeToTop if {@code true}, the home activity should be moved to the top.
     *                      Otherwise, the home activity is hidden and the user is returned to the
     *                      app.
     */
    void detachNavigationBarFromApp();
    void detachNavigationBarFromApp(boolean moveHomeToTop);
}
+8 −0
Original line number Diff line number Diff line
@@ -257,4 +257,12 @@ oneway interface IStatusBar
     * file descriptor passed in.
     */
     void passThroughShellCommand(in String[] args, in ParcelFileDescriptor pfd);

    /**
     * Enables/disables the navigation bar luma sampling.
     *
     * @param displayId the id of the display to notify.
     * @param enable {@code true} if enable, otherwise set to {@code false}.
     */
    void setNavigationBarLumaSamplingEnabled(int displayId, boolean enable);
}
+3 −3
Original line number Diff line number Diff line
@@ -16,11 +16,11 @@

package com.android.systemui.shared.system;

import android.window.TaskSnapshot;
import android.graphics.Rect;
import android.os.RemoteException;
import android.util.Log;
import android.view.IRecentsAnimationController;
import android.window.TaskSnapshot;

import com.android.systemui.shared.recents.model.ThumbnailData;

@@ -141,9 +141,9 @@ public class RecentsAnimationControllerCompat {
    /**
     * @see IRecentsAnimationController#detachNavigationBarFromApp
     */
    public void detachNavigationBarFromApp() {
    public void detachNavigationBarFromApp(boolean moveHomeToTop) {
        try {
            mAnimationController.detachNavigationBarFromApp();
            mAnimationController.detachNavigationBarFromApp(moveHomeToTop);
        } catch (RemoteException e) {
            Log.e(TAG, "Failed to detach the navigation bar from app", e);
        }
+8 −0
Original line number Diff line number Diff line
@@ -212,6 +212,14 @@ public class NavigationBarController implements Callbacks,
        createNavigationBar(display, null /* savedState */, null /* result */);
    }

    @Override
    public void setNavigationBarLumaSamplingEnabled(int displayId, boolean enable) {
        final NavigationBarView navigationBarView = getNavigationBarView(displayId);
        if (navigationBarView != null) {
            navigationBarView.setNavigationBarLumaSamplingEnabled(enable);
        }
    }

    /**
     * Recreates the navigation bar for the given display.
     */
+8 −0
Original line number Diff line number Diff line
@@ -1397,4 +1397,12 @@ public class NavigationBarView extends FrameLayout implements
    private final Consumer<Rect> mPipListener = bounds -> post(() -> {
        mEdgeBackGestureHandler.setPipStashExclusionBounds(bounds);
    });

    void setNavigationBarLumaSamplingEnabled(boolean enable) {
        if (enable) {
            mRegionSamplingHelper.start(mSamplingBounds);
        } else {
            mRegionSamplingHelper.stop();
        }
    }
}
Loading