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

Commit 6f8c6947 authored by Beth Thibodeau's avatar Beth Thibodeau Committed by Automerger Merge Worker
Browse files

Merge "Initialize horizontal panel as GONE and add logs" into tm-qpr-dev am:...

Merge "Initialize horizontal panel as GONE and add logs" into tm-qpr-dev am: 1836acc9 am: ecde9fad

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19468407



Change-Id: I70d649128ab0f9a36925aa79a341fee7f8d18349
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b33d491a ecde9fad
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -128,6 +128,8 @@ public class QSPanel extends LinearLayout implements Tunable {
        if (mUsingMediaPlayer) {
        if (mUsingMediaPlayer) {
            mHorizontalLinearLayout = new RemeasuringLinearLayout(mContext);
            mHorizontalLinearLayout = new RemeasuringLinearLayout(mContext);
            mHorizontalLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
            mHorizontalLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
            mHorizontalLinearLayout.setVisibility(
                    mUsingHorizontalLayout ? View.VISIBLE : View.GONE);
            mHorizontalLinearLayout.setClipChildren(false);
            mHorizontalLinearLayout.setClipChildren(false);
            mHorizontalLinearLayout.setClipToPadding(false);
            mHorizontalLinearLayout.setClipToPadding(false);


@@ -445,6 +447,8 @@ public class QSPanel extends LinearLayout implements Tunable {
        mMediaHostView = hostView;
        mMediaHostView = hostView;
        ViewGroup newParent = horizontal ? mHorizontalLinearLayout : this;
        ViewGroup newParent = horizontal ? mHorizontalLinearLayout : this;
        ViewGroup currentParent = (ViewGroup) hostView.getParent();
        ViewGroup currentParent = (ViewGroup) hostView.getParent();
        Log.d(getDumpableTag(), "Reattaching media host: " + horizontal
                + ", current " + currentParent + ", new " + newParent);
        if (currentParent != newParent) {
        if (currentParent != newParent) {
            if (currentParent != null) {
            if (currentParent != null) {
                currentParent.removeView(hostView);
                currentParent.removeView(hostView);
@@ -589,6 +593,7 @@ public class QSPanel extends LinearLayout implements Tunable {


    void setUsingHorizontalLayout(boolean horizontal, ViewGroup mediaHostView, boolean force) {
    void setUsingHorizontalLayout(boolean horizontal, ViewGroup mediaHostView, boolean force) {
        if (horizontal != mUsingHorizontalLayout || force) {
        if (horizontal != mUsingHorizontalLayout || force) {
            Log.d(getDumpableTag(), "setUsingHorizontalLayout: " + horizontal + ", " + force);
            mUsingHorizontalLayout = horizontal;
            mUsingHorizontalLayout = horizontal;
            ViewGroup newParent = horizontal ? mHorizontalContentContainer : this;
            ViewGroup newParent = horizontal ? mHorizontalContentContainer : this;
            switchAllContentToParent(newParent, mTileLayout);
            switchAllContentToParent(newParent, mTileLayout);
+6 −0
Original line number Original line Diff line number Diff line
@@ -88,6 +88,8 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
                public void onConfigurationChange(Configuration newConfig) {
                public void onConfigurationChange(Configuration newConfig) {
                    mShouldUseSplitNotificationShade =
                    mShouldUseSplitNotificationShade =
                            LargeScreenUtils.shouldUseSplitNotificationShade(getResources());
                            LargeScreenUtils.shouldUseSplitNotificationShade(getResources());
                    mQSLogger.logOnConfigurationChanged(mLastOrientation, newConfig.orientation,
                            mView.getDumpableTag());
                    onConfigurationChanged();
                    onConfigurationChanged();
                    if (newConfig.orientation != mLastOrientation) {
                    if (newConfig.orientation != mLastOrientation) {
                        mLastOrientation = newConfig.orientation;
                        mLastOrientation = newConfig.orientation;
@@ -164,6 +166,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
        mHost.addCallback(mQSHostCallback);
        mHost.addCallback(mQSHostCallback);
        setTiles();
        setTiles();
        mLastOrientation = getResources().getConfiguration().orientation;
        mLastOrientation = getResources().getConfiguration().orientation;
        mQSLogger.logOnViewAttached(mLastOrientation, mView.getDumpableTag());
        switchTileLayout(true);
        switchTileLayout(true);


        mDumpManager.registerDumpable(mView.getDumpableTag(), this);
        mDumpManager.registerDumpable(mView.getDumpableTag(), this);
@@ -171,6 +174,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr


    @Override
    @Override
    protected void onViewDetached() {
    protected void onViewDetached() {
        mQSLogger.logOnViewDetached(mLastOrientation, mView.getDumpableTag());
        mView.removeOnConfigurationChangedListener(mOnConfigurationChangedListener);
        mView.removeOnConfigurationChangedListener(mOnConfigurationChangedListener);
        mHost.removeCallback(mQSHostCallback);
        mHost.removeCallback(mQSHostCallback);


@@ -325,6 +329,8 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
        /* Whether or not the panel currently contains a media player. */
        /* Whether or not the panel currently contains a media player. */
        boolean horizontal = shouldUseHorizontalLayout();
        boolean horizontal = shouldUseHorizontalLayout();
        if (horizontal != mUsingHorizontalLayout || force) {
        if (horizontal != mUsingHorizontalLayout || force) {
            mQSLogger.logSwitchTileLayout(horizontal, mUsingHorizontalLayout, force,
                    mView.getDumpableTag());
            mUsingHorizontalLayout = horizontal;
            mUsingHorizontalLayout = horizontal;
            mView.setUsingHorizontalLayout(mUsingHorizontalLayout, mMediaHost.getHostView(), force);
            mView.setUsingHorizontalLayout(mUsingHorizontalLayout, mMediaHost.getHostView(), force);
            updateMediaDisappearParameters();
            updateMediaDisappearParameters();
+48 −0
Original line number Original line Diff line number Diff line
@@ -155,6 +155,54 @@ class QSLogger @Inject constructor(
        })
        })
    }
    }


    fun logOnViewAttached(orientation: Int, containerName: String) {
        log(DEBUG, {
            str1 = containerName
            int1 = orientation
        }, {
            "onViewAttached: $str1 orientation $int1"
        })
    }

    fun logOnViewDetached(orientation: Int, containerName: String) {
        log(DEBUG, {
            str1 = containerName
            int1 = orientation
        }, {
            "onViewDetached: $str1 orientation $int1"
        })
    }

    fun logOnConfigurationChanged(
        lastOrientation: Int,
        newOrientation: Int,
        containerName: String
    ) {
        log(DEBUG, {
            str1 = containerName
            int1 = lastOrientation
            int2 = newOrientation
        }, {
            "configuration change: $str1 orientation was $int1, now $int2"
        })
    }

    fun logSwitchTileLayout(
        after: Boolean,
        before: Boolean,
        force: Boolean,
        containerName: String
    ) {
        log(DEBUG, {
            str1 = containerName
            bool1 = after
            bool2 = before
            bool3 = force
        }, {
            "change tile layout: $str1 horizontal=$bool1 (was $bool2), force? $bool3"
        })
    }

    private fun toStateString(state: Int): String {
    private fun toStateString(state: Int): String {
        return when (state) {
        return when (state) {
            Tile.STATE_ACTIVE -> "active"
            Tile.STATE_ACTIVE -> "active"