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

Commit 0fbca56f authored by Tarandeep Singh's avatar Tarandeep Singh Committed by Android (Google) Code Review
Browse files

Merge "Revert "Make settings themed apps have light nav"" into oc-mr1-dev

parents d1a012fa 4efdd567
Loading
Loading
Loading
Loading
+6 −37
Original line number Original line Diff line number Diff line
@@ -17,9 +17,6 @@
package com.android.internal.policy;
package com.android.internal.policy;


import android.graphics.Outline;
import android.graphics.Outline;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.LayerDrawable;
import android.util.Pair;
import android.view.ViewOutlineProvider;
import android.view.ViewOutlineProvider;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo;
import com.android.internal.R;
import com.android.internal.R;
@@ -1106,8 +1103,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
            boolean navBarToLeftEdge = isNavBarToLeftEdge(mLastBottomInset, mLastLeftInset);
            boolean navBarToLeftEdge = isNavBarToLeftEdge(mLastBottomInset, mLastLeftInset);
            int navBarSize = getNavBarSize(mLastBottomInset, mLastRightInset, mLastLeftInset);
            int navBarSize = getNavBarSize(mLastBottomInset, mLastRightInset, mLastLeftInset);
            updateColorViewInt(mNavigationColorViewState, sysUiVisibility,
            updateColorViewInt(mNavigationColorViewState, sysUiVisibility,
                    mWindow.mNavigationBarColor, mWindow.mNavigationBarDividerColor, navBarSize,
                    mWindow.mNavigationBarColor, navBarSize, navBarToRightEdge || navBarToLeftEdge,
                    navBarToRightEdge || navBarToLeftEdge, navBarToLeftEdge,
                    navBarToLeftEdge,
                    0 /* sideInset */, animate && !disallowAnimate, false /* force */);
                    0 /* sideInset */, animate && !disallowAnimate, false /* force */);


            boolean statusBarNeedsRightInset = navBarToRightEdge
            boolean statusBarNeedsRightInset = navBarToRightEdge
@@ -1117,7 +1114,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
            int statusBarSideInset = statusBarNeedsRightInset ? mLastRightInset
            int statusBarSideInset = statusBarNeedsRightInset ? mLastRightInset
                    : statusBarNeedsLeftInset ? mLastLeftInset : 0;
                    : statusBarNeedsLeftInset ? mLastLeftInset : 0;
            updateColorViewInt(mStatusColorViewState, sysUiVisibility,
            updateColorViewInt(mStatusColorViewState, sysUiVisibility,
                    calculateStatusBarColor(), 0, mLastTopInset,
                    calculateStatusBarColor(), mLastTopInset,
                    false /* matchVertical */, statusBarNeedsLeftInset, statusBarSideInset,
                    false /* matchVertical */, statusBarNeedsLeftInset, statusBarSideInset,
                    animate && !disallowAnimate,
                    animate && !disallowAnimate,
                    mForceWindowDrawsStatusBarBackground);
                    mForceWindowDrawsStatusBarBackground);
@@ -1204,7 +1201,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
     * @param state the color view to update.
     * @param state the color view to update.
     * @param sysUiVis the current systemUiVisibility to apply.
     * @param sysUiVis the current systemUiVisibility to apply.
     * @param color the current color to apply.
     * @param color the current color to apply.
     * @param dividerColor the current divider color to apply.
     * @param size the current size in the non-parent-matching dimension.
     * @param size the current size in the non-parent-matching dimension.
     * @param verticalBar if true the view is attached to a vertical edge, otherwise to a
     * @param verticalBar if true the view is attached to a vertical edge, otherwise to a
     *                    horizontal edge,
     *                    horizontal edge,
@@ -1212,7 +1208,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
     * @param animate if true, the change will be animated.
     * @param animate if true, the change will be animated.
     */
     */
    private void updateColorViewInt(final ColorViewState state, int sysUiVis, int color,
    private void updateColorViewInt(final ColorViewState state, int sysUiVis, int color,
            int dividerColor, int size, boolean verticalBar, boolean seascape, int sideMargin,
            int size, boolean verticalBar, boolean seascape, int sideMargin,
            boolean animate, boolean force) {
            boolean animate, boolean force) {
        state.present = state.attributes.isPresent(sysUiVis, mWindow.getAttributes().flags, force);
        state.present = state.attributes.isPresent(sysUiVis, mWindow.getAttributes().flags, force);
        boolean show = state.attributes.isVisible(state.present, color,
        boolean show = state.attributes.isVisible(state.present, color,
@@ -1231,7 +1227,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        if (view == null) {
        if (view == null) {
            if (showView) {
            if (showView) {
                state.view = view = new View(mContext);
                state.view = view = new View(mContext);
                setColor(view, color, dividerColor, verticalBar, seascape);
                view.setBackgroundColor(color);
                view.setTransitionName(state.attributes.transitionName);
                view.setTransitionName(state.attributes.transitionName);
                view.setId(state.attributes.id);
                view.setId(state.attributes.id);
                visibilityChanged = true;
                visibilityChanged = true;
@@ -1266,7 +1262,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                view.setLayoutParams(lp);
                view.setLayoutParams(lp);
            }
            }
            if (showView) {
            if (showView) {
                setColor(view, color, dividerColor, verticalBar, seascape);
                view.setBackgroundColor(color);
            }
            }
        }
        }
        if (visibilityChanged) {
        if (visibilityChanged) {
@@ -1299,33 +1295,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        state.color = color;
        state.color = color;
    }
    }


    private static void setColor(View v, int color, int dividerColor, boolean verticalBar,
            boolean seascape) {
        if (dividerColor != 0) {
            final Pair<Boolean, Boolean> dir = (Pair<Boolean, Boolean>) v.getTag();
            if (dir == null || dir.first != verticalBar || dir.second != seascape) {
                final int size = Math.round(
                        TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1,
                                v.getContext().getResources().getDisplayMetrics()));
                // Use an inset to make the divider line on the side that faces the app.
                final InsetDrawable d = new InsetDrawable(new ColorDrawable(color),
                        verticalBar && !seascape ? size : 0,
                        !verticalBar ? size : 0,
                        verticalBar && seascape ? size : 0, 0);
                v.setBackground(new LayerDrawable(new Drawable[] {
                        new ColorDrawable(dividerColor), d }));
                v.setTag(new Pair<>(verticalBar, seascape));
            } else {
                final LayerDrawable d = (LayerDrawable) v.getBackground();
                final InsetDrawable inset = ((InsetDrawable) d.getDrawable(0));
                ((ColorDrawable) inset.getDrawable()).setColor(dividerColor);
                ((ColorDrawable) d.getDrawable(1)).setColor(color);
            }
        } else {
            v.setBackgroundColor(color);
        }
    }

    private void updateColorViewTranslations() {
    private void updateColorViewTranslations() {
        // Put the color views back in place when they get moved off the screen
        // Put the color views back in place when they get moved off the screen
        // due to the the ViewRootImpl panning.
        // due to the the ViewRootImpl panning.
+0 −7
Original line number Original line Diff line number Diff line
@@ -233,7 +233,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
    private int mTextColor = 0;
    private int mTextColor = 0;
    int mStatusBarColor = 0;
    int mStatusBarColor = 0;
    int mNavigationBarColor = 0;
    int mNavigationBarColor = 0;
    int mNavigationBarDividerColor = 0;
    private boolean mForcedStatusBarColor = false;
    private boolean mForcedStatusBarColor = false;
    private boolean mForcedNavigationBarColor = false;
    private boolean mForcedNavigationBarColor = false;


@@ -2433,8 +2432,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
        }
        }
        if (!mForcedNavigationBarColor) {
        if (!mForcedNavigationBarColor) {
            mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColor, 0xFF000000);
            mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColor, 0xFF000000);
            mNavigationBarDividerColor = a.getColor(R.styleable.Window_navigationBarDividerColor,
                    0x00000000);
        }
        }


        WindowManager.LayoutParams params = getAttributes();
        WindowManager.LayoutParams params = getAttributes();
@@ -2456,10 +2453,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            decor.setSystemUiVisibility(
            decor.setSystemUiVisibility(
                    decor.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
                    decor.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        }
        }
        if (a.getBoolean(R.styleable.Window_windowLightNavigationBar, false)) {
            decor.setSystemUiVisibility(
                    decor.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
        }


        if (mAlwaysReadCloseOnTouchAttr || getContext().getApplicationInfo().targetSdkVersion
        if (mAlwaysReadCloseOnTouchAttr || getContext().getApplicationInfo().targetSdkVersion
                >= android.os.Build.VERSION_CODES.HONEYCOMB) {
                >= android.os.Build.VERSION_CODES.HONEYCOMB) {
+0 −19
Original line number Original line Diff line number Diff line
@@ -2055,14 +2055,6 @@
             Corresponds to {@link android.view.Window#setNavigationBarColor(int)}. -->
             Corresponds to {@link android.view.Window#setNavigationBarColor(int)}. -->
        <attr name="navigationBarColor" format="color" />
        <attr name="navigationBarColor" format="color" />


        <!-- @hide
             Shows 1dp line of the specified color between the navigation bar and the app content.
             <p>For this to take effect, the window must be drawing the system bar backgrounds with
             {@link android.R.attr#windowDrawsSystemBarBackgrounds} and the navigation bar must not
               have been requested to be translucent with
             {@link android.R.attr#windowTranslucentNavigation}. -->
        <attr name="navigationBarDividerColor" format="color" />

        <!-- The duration, in milliseconds, of the window background fade duration
        <!-- The duration, in milliseconds, of the window background fade duration
             when transitioning into or away from an Activity when called with an
             when transitioning into or away from an Activity when called with an
             Activity Transition. Corresponds to
             Activity Transition. Corresponds to
@@ -2095,17 +2087,6 @@
             {@link android.R.attr#windowBackground}.
             {@link android.R.attr#windowBackground}.
             -->
             -->
        <attr name="windowSplashscreenContent" format="reference" />
        <attr name="windowSplashscreenContent" format="reference" />

        <!-- @hide
             If set, the navigation bar will be drawn such that it is compatible with a light
             navigation bar background.
             <p>For this to take effect, the window must be drawing the system bar backgrounds with
             {@link android.R.attr#windowDrawsSystemBarBackgrounds} and the navigation bar must not
             have been requested to be translucent with
             {@link android.R.attr#windowTranslucentNavigation}.
             Corresponds to setting {@link android.view.View#SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR} on
             the decor view. -->
        <attr name="windowLightNavigationBar" format="boolean" />
    </declare-styleable>
    </declare-styleable>


    <!-- The set of attributes that describe a AlertDialog's theme. -->
    <!-- The set of attributes that describe a AlertDialog's theme. -->
+0 −5
Original line number Original line Diff line number Diff line
@@ -745,11 +745,6 @@ easier.
        <item name="colorSecondary">@color/secondary_device_default_settings_light</item>
        <item name="colorSecondary">@color/secondary_device_default_settings_light</item>
        <item name="colorAccent">@color/accent_device_default_light</item>
        <item name="colorAccent">@color/accent_device_default_light</item>
        <item name="colorEdgeEffect">@android:color/black</item>
        <item name="colorEdgeEffect">@android:color/black</item>

        <!-- Add white nav bar with divider that matches material -->
        <item name="navigationBarDividerColor">#1f000000</item>
        <item name="navigationBarColor">@android:color/white</item>
        <item name="windowLightNavigationBar">true</item>
    </style>
    </style>


    <!-- @hide DeviceDefault theme for a window that should use Settings theme colors
    <!-- @hide DeviceDefault theme for a window that should use Settings theme colors