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

Commit 02a19b14 authored by Maryam Dehaini's avatar Maryam Dehaini Committed by Jainam Shah
Browse files

Fix caption visibility for car window decoration

Test: open apps with and without caption visible
Bug: 375252977
Bug: 404642416
Flag: com.android.window.flags.enable_desktop_app_handle_animation
Change-Id: I51dc76737803898c2ebf728380a18bc82bc282a8
parent 34f9f07e
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -89,9 +89,6 @@ public class CarWindowDecoration extends WindowDecoration<WindowDecorLinearLayou
        updateRelayoutParams(mRelayoutParams, taskInfo, isCaptionVisible);

        relayout(mRelayoutParams, startT, finishT, wct, mRootView, mResult);
        if (DesktopModeFlags.ENABLE_DESKTOP_APP_HANDLE_ANIMATION.isTrue()) {
            setCaptionVisibility(isCaptionVisible);
        }
        // After this line, mTaskInfo is up-to-date and should be used instead of taskInfo
        mBgExecutor.execute(() -> mTaskOrganizer.applyTransaction(wct));

@@ -100,20 +97,24 @@ public class CarWindowDecoration extends WindowDecoration<WindowDecorLinearLayou
            // Nothing is set up in this case including the decoration surface.
            return;
        }

        if (mRootView != mResult.mRootView) {
            mRootView = mResult.mRootView;
            setupRootView(mResult.mRootView, mClickListener);
        }
    }

    private void setCaptionVisibility(boolean visible) {
        if (mRootView == null) {
            return;
        if (DesktopModeFlags.ENABLE_DESKTOP_APP_HANDLE_ANIMATION.isTrue()) {
            setCaptionVisibility(mRootView, mRelayoutParams.mIsCaptionVisible);
        }
    }

    private void setCaptionVisibility(@NonNull View rootView, boolean visible) {
        final int v = visible ? View.VISIBLE : View.GONE;
        final View captionView = mRootView.findViewById(getCaptionViewId());
        final View captionView = rootView.findViewById(getCaptionViewId());
        if (captionView != null) {
            captionView.setVisibility(v);
        }
    }

    @Override
    @NonNull