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

Commit ed017560 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Dynamic density change handling" into nyc-dev

parents 3c58bedd 11c62e17
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1397,4 +1397,9 @@ public interface WindowManagerPolicy {
     *         is allowed, so for example, if DOCKED_RIGHT is not allowed, DOCKED_LEFT is allowed.
     */
    public boolean isDockSideAllowed(int dockSide);

    /**
     * Called when the configuration has changed, and it's safe to load new values from resources.
     */
    public void onConfigurationChanged();
}
+4 −6
Original line number Diff line number Diff line
@@ -34,8 +34,6 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
 * Controls the docked stack divider.
 */
public class Divider extends SystemUI {
    private static final String TAG = "Divider";
    private int mDividerWindowWidth;
    private DividerWindowManager mWindowManager;
    private DividerView mView;
    private DockDividerVisibilityListener mDockDividerVisibilityListener;
@@ -46,8 +44,6 @@ public class Divider extends SystemUI {
    @Override
    public void start() {
        mWindowManager = new DividerWindowManager(mContext);
        mDividerWindowWidth = mContext.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.docked_stack_divider_thickness);
        update(mContext.getResources().getConfiguration());
        putComponent(Divider.class, this);
        mDockDividerVisibilityListener = new DockDividerVisibilityListener();
@@ -70,9 +66,11 @@ public class Divider extends SystemUI {
        mView = (DividerView)
                LayoutInflater.from(mContext).inflate(R.layout.docked_stack_divider, null);
        mView.setVisibility(mVisible ? View.VISIBLE : View.INVISIBLE);
        final int size = mContext.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.docked_stack_divider_thickness);
        final boolean landscape = configuration.orientation == ORIENTATION_LANDSCAPE;
        final int width = landscape ? mDividerWindowWidth : MATCH_PARENT;
        final int height = landscape ? MATCH_PARENT : mDividerWindowWidth;
        final int width = landscape ? size : MATCH_PARENT;
        final int height = landscape ? MATCH_PARENT : size;
        mWindowManager.add(mView, width, height);
        mView.setWindowManager(mWindowManager);
    }
+13 −8
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ public class NavigationBarView extends LinearLayout {
    private Drawable mHomeDefaultIcon, mHomeCarModeIcon;
    private Drawable mRecentIcon;
    private Drawable mDockedIcon;
    private Drawable mImeIcon;
    private Drawable mMenuIcon;

    private NavigationBarGestureHelper mGestureHelper;
    private DeadZone mDeadZone;
@@ -270,7 +272,8 @@ public class NavigationBarView extends LinearLayout {
    }

    private void updateIcons(Context ctx, Configuration oldConfig, Configuration newConfig) {
        if (oldConfig.orientation != newConfig.orientation) {
        if (oldConfig.orientation != newConfig.orientation
                || oldConfig.densityDpi != newConfig.densityDpi) {
            mDockedIcon = ctx.getDrawable(R.drawable.ic_sysbar_docked);
        }
        if (oldConfig.densityDpi != newConfig.densityDpi) {
@@ -280,8 +283,10 @@ public class NavigationBarView extends LinearLayout {
            mBackAltLandIcon = mBackAltIcon;

            mHomeDefaultIcon = ctx.getDrawable(R.drawable.ic_sysbar_home);

            mRecentIcon = ctx.getDrawable(R.drawable.ic_sysbar_recent);
            mMenuIcon = ctx.getDrawable(R.drawable.ic_sysbar_menu);
            mImeIcon = ctx.getDrawable(R.drawable.ic_ime_switcher_default);

            updateCarModeIcons(ctx);
        }
    }
@@ -348,9 +353,11 @@ public class NavigationBarView extends LinearLayout {

        final boolean showImeButton = ((hints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0);
        getImeSwitchButton().setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE);
        getImeSwitchButton().setImageDrawable(mImeIcon);

        // Update menu button in case the IME state has changed.
        setMenuVisibility(mShowMenu, true);
        getMenuButton().setImageDrawable(mMenuIcon);

        setDisabledFlags(mDisabledFlags, true);
    }
@@ -595,14 +602,12 @@ public class NavigationBarView extends LinearLayout {
        super.onConfigurationChanged(newConfig);
        boolean uiCarModeChanged = updateCarMode(newConfig);
        updateTaskSwitchHelper();
        if (uiCarModeChanged) {
            // uiMode changed either from carmode or to carmode.
            // replace the nav bar button icons based on which mode
            // we are switching to.
            setNavigationIconHints(mNavigationIconHints, true);
        }
        updateIcons(getContext(), mConfiguration, newConfig);
        updateRecentsIcon();
        if (uiCarModeChanged || mConfiguration.densityDpi != newConfig.densityDpi) {
            // If car mode or density changes, we need to reset the icons.
            setNavigationIconHints(mNavigationIconHints, true);
        }
        mConfiguration.updateFrom(newConfig);
    }

+6 −2
Original line number Diff line number Diff line
@@ -3303,10 +3303,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    protected void loadDimens() {
        final Resources res = mContext.getResources();

        int oldBarHeight = mNaturalBarHeight;
        mNaturalBarHeight = res.getDimensionPixelSize(
                com.android.internal.R.dimen.status_bar_height);

        mMaxAllowedKeyguardNotifications = res.getInteger(R.integer.keyguard_max_notification_count);
        if (mStatusBarWindowManager != null && mNaturalBarHeight != oldBarHeight) {
            mStatusBarWindowManager.setBarHeight(mNaturalBarHeight);
        }
        mMaxAllowedKeyguardNotifications = res.getInteger(
                R.integer.keyguard_max_notification_count);

        if (DEBUG) Log.v(TAG, "updateResources");
    }
+5 −0
Original line number Diff line number Diff line
@@ -323,6 +323,11 @@ public class StatusBarWindowManager implements RemoteInputController.Callback {
        apply(mCurrentState);
    }

    public void setBarHeight(int barHeight) {
        mBarHeight = barHeight;
        apply(mCurrentState);
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("StatusBarWindowManager state:");
        pw.println(mCurrentState);
Loading