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

Commit 0bf56663 authored by Winson Chung's avatar Winson Chung
Browse files

Use context from root view to inflate children

- The display context doesn't copy the theme from the original,
  so we shouldn't use it to inflate other child views directly
- Revert previous temporary changes

Bug: 165014649
Test: atest -it android.server.wm.MultiDisplayKeyguardTests
Change-Id: Ifa55e2808a707e7b2127dc606564f338c809c960
parent 1faff19f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -458,10 +458,10 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        lp.windowAnimations = 0;
        lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC;

        LayoutInflater layoutInflater = LayoutInflater.from(mContext);
        NavigationBarFrame frame = (NavigationBarFrame) layoutInflater.inflate(
        NavigationBarFrame frame = (NavigationBarFrame) LayoutInflater.from(mContext).inflate(
                R.layout.navigation_bar_window, null);
        View barView = layoutInflater.inflate(R.layout.navigation_bar, frame);
        View barView = LayoutInflater.from(frame.getContext()).inflate(
                R.layout.navigation_bar, frame);
        barView.addOnAttachStateChangeListener(this);

        if (DEBUG) Log.v(TAG, "addNavigationBar: about to add " + barView);
+10 −23
Original line number Diff line number Diff line
@@ -330,8 +330,7 @@ public class NavigationBarView extends FrameLayout implements

        mOverviewProxyService = Dependency.get(OverviewProxyService.class);
        mFloatingRotationButton = new FloatingRotationButton(context);
        // TODO(165014649): Temporarily disable onboarding
        // mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService);
        mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService);
        mRotationButtonController = new RotationButtonController(mLightContext,
                mLightIconColor, mDarkIconColor,
                isGesturalMode ? mFloatingRotationButton : rotateSuggestionButton,
@@ -887,9 +886,7 @@ public class NavigationBarView extends FrameLayout implements
        mNavBarMode = mode;
        mBarTransitions.onNavigationModeChanged(mNavBarMode);
        mEdgeBackGestureHandler.onNavigationModeChanged(mNavBarMode);
        if (mRecentsOnboarding != null) {
        mRecentsOnboarding.onNavigationModeChanged(mNavBarMode);
        }

        if (isGesturalMode(mNavBarMode)) {
            mRegionSamplingHelper.start(mSamplingBounds);
@@ -905,10 +902,8 @@ public class NavigationBarView extends FrameLayout implements
    }

    void hideRecentsOnboarding() {
        if (mRecentsOnboarding != null) {
        mRecentsOnboarding.hide(true);
    }
    }

    @Override
    public void onFinishInflate() {
@@ -958,10 +953,8 @@ public class NavigationBarView extends FrameLayout implements
        super.onLayout(changed, left, top, right, bottom);

        notifyActiveTouchRegions();
        if (mRecentsOnboarding != null) {
        mRecentsOnboarding.setNavBarHeight(getMeasuredHeight());
    }
    }

    /**
     * Notifies the overview service of the active touch regions.
@@ -1122,9 +1115,7 @@ public class NavigationBarView extends FrameLayout implements
        boolean uiCarModeChanged = updateCarMode();
        updateIcons(mTmpLastConfiguration);
        updateRecentsIcon();
        if (mRecentsOnboarding != null) {
        mRecentsOnboarding.onConfigurationChanged(mConfiguration);
        }
        if (uiCarModeChanged || mTmpLastConfiguration.densityDpi != mConfiguration.densityDpi
                || mTmpLastConfiguration.getLayoutDirection() != mConfiguration.getLayoutDirection()) {
            // If car mode or density changes, we need to reset the icons.
@@ -1214,14 +1205,12 @@ public class NavigationBarView extends FrameLayout implements
    }

    private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) {
        if (mRecentsOnboarding != null) {
        if (connectedToOverviewProxy) {
            mRecentsOnboarding.onConnectedToLauncher();
        } else {
            mRecentsOnboarding.onDisconnectedFromLauncher();
        }
    }
    }

    public void dump(PrintWriter pw) {
        final Rect r = new Rect();
@@ -1265,9 +1254,7 @@ public class NavigationBarView extends FrameLayout implements
            mNavigationInflaterView.dump(pw);
        }
        mContextualButtonGroup.dump(pw);
        if (mRecentsOnboarding != null) {
        mRecentsOnboarding.dump(pw);
        }
        mRegionSamplingHelper.dump(pw);
        mEdgeBackGestureHandler.dump(pw);
    }