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

Unverified Commit b2a98be7 authored by Michael Bestas's avatar Michael Bestas
Browse files

Merge tag 'android-13.0.0_r83' into staging/lineage-20.0_merge-android-13.0.0_r83

Android 13.0.0 release 83

* tag 'android-13.0.0_r83':
  [RESTRICT AUTOMERGE] Disable NOTIFICATION_INLINE_REPLY_ANIMATION flag
  Fix padding in QSContainerImpl after re-inflation
  Dismiss lingering volume dialog
  Update config according to insets of status bar
  Keyguard: use transition state for syncing occlude [RESTRICT AUTOMERGE]
  Cancel current animation instead of candidate

Change-Id: I5e7da6ade442c4e81a6b88590b8628e638f1c2db
parents bff0ca9f 5c8d1d97
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ object Flags {
    // TODO(b/260335638): Tracking Bug
    @JvmField
    val NOTIFICATION_INLINE_REPLY_ANIMATION =
        releasedFlag(174148361, "notification_inline_reply_animation")
        unreleasedFlag(174148361, "notification_inline_reply_animation")

    val FILTER_UNSEEN_NOTIFS_ON_KEYGUARD =
        releasedFlag(254647461, "filter_unseen_notifs_on_keyguard", teamfood = true)
+6 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ public class NotificationsQuickSettingsContainer extends ConstraintLayout
    private Consumer<QS> mQSFragmentAttachedListener = qs -> {};
    private QS mQs;
    private View mQSContainer;
    private int mLastQSPaddingBottom;

    @Nullable
    private Consumer<Configuration> mConfigurationChangedListener;
@@ -75,6 +76,10 @@ public class NotificationsQuickSettingsContainer extends ConstraintLayout
        mQs = (QS) fragment;
        mQSFragmentAttachedListener.accept(mQs);
        mQSContainer = mQs.getView().findViewById(R.id.quick_settings_container);
        // We need to restore the bottom padding as the fragment may have been recreated due to
        // some special Configuration change, so we apply the last known padding (this will be
        // correct even if it has changed while the fragment was destroyed and re-created).
        setQSContainerPaddingBottom(mLastQSPaddingBottom);
    }

    @Override
@@ -101,6 +106,7 @@ public class NotificationsQuickSettingsContainer extends ConstraintLayout
    }

    public void setQSContainerPaddingBottom(int paddingBottom) {
        mLastQSPaddingBottom = paddingBottom;
        if (mQSContainer != null) {
            mQSContainer.setPadding(
                    mQSContainer.getPaddingLeft(),
+19 −5
Original line number Diff line number Diff line
@@ -452,6 +452,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,

    @Override
    public void destroy() {
        Log.d(TAG, "destroy() called");
        mController.removeCallback(mControllerCallbackH);
        mHandler.removeCallbacksAndMessages(null);
        mConfigurationController.removeCallback(this);
@@ -557,6 +558,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
    }

    private void initDialog(int lockTaskModeState) {
        Log.d(TAG, "initDialog: called!");
        mDialog = new CustomDialog(mContext);

        initDimens();
@@ -1524,7 +1526,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
    }

    protected void tryToRemoveCaptionsTooltip() {
        if (mHasSeenODICaptionsTooltip && mODICaptionsTooltipView != null) {
        if (mHasSeenODICaptionsTooltip && mODICaptionsTooltipView != null && mDialog != null) {
            ViewGroup container = mDialog.findViewById(R.id.volume_dialog_container);
            container.removeView(mODICaptionsTooltipView);
            mODICaptionsTooltipView = null;
@@ -1718,8 +1720,16 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,

        mHandler.removeMessages(H.DISMISS);
        mHandler.removeMessages(H.SHOW);
        if (mIsAnimatingDismiss) {
            Log.d(TAG, "dismissH: isAnimatingDismiss");

        boolean showingStateInconsistent = !mShowing && mDialog != null && mDialog.isShowing();
        // If incorrectly assuming dialog is not showing, continue and make the state consistent.
        if (showingStateInconsistent) {
            Log.d(TAG, "dismissH: volume dialog possible in inconsistent state:"
                    + "mShowing=" + mShowing + ", mDialog==null?" + (mDialog == null));
        }
        if (mIsAnimatingDismiss && !showingStateInconsistent) {
            Log.d(TAG, "dismissH: skipping dismiss because isAnimatingDismiss is true"
                    + " and showingStateInconsistent is false");
            Trace.endSection();
            return;
        }
@@ -1737,8 +1747,12 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
                .setDuration(mDialogHideAnimationDurationMs)
                .setInterpolator(new SystemUIInterpolators.LogAccelerateInterpolator())
                .withEndAction(() -> mHandler.postDelayed(() -> {
                    if (mController != null) {
                        mController.notifyVisible(false);
                    }
                    if (mDialog != null) {
                        mDialog.dismiss();
                    }
                    tryToRemoveCaptionsTooltip();
                    mExpanded = false;
                    if (mExpandRows != null) {
+97 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.shade

import android.testing.AndroidTestingRunner
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.test.filters.SmallTest
import com.android.systemui.R
import com.android.systemui.SysuiTestCase
import com.android.systemui.qs.QSFragment
import com.android.systemui.util.mockito.whenever
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.MockitoAnnotations

@SmallTest
@RunWith(AndroidTestingRunner::class)
class NotificationsQuickSettingsContainerTest : SysuiTestCase() {

    @Mock private lateinit var qsFrame: View
    @Mock private lateinit var stackScroller: View
    @Mock private lateinit var keyguardStatusBar: View
    @Mock private lateinit var qsFragment: QSFragment

    private lateinit var qsView: ViewGroup
    private lateinit var qsContainer: View

    private lateinit var underTest: NotificationsQuickSettingsContainer

    @Before
    fun setUp() {
        MockitoAnnotations.initMocks(this)

        underTest = NotificationsQuickSettingsContainer(context, null)

        setUpViews()
        underTest.onFinishInflate()
        underTest.onFragmentViewCreated("QS", qsFragment)
    }

    @Test
    fun qsContainerPaddingSetAgainAfterQsRecreated() {
        val padding = 100
        underTest.setQSContainerPaddingBottom(padding)

        assertThat(qsContainer.paddingBottom).isEqualTo(padding)

        // We reset the padding before "creating" a new QSFragment
        qsContainer.setPadding(0, 0, 0, 0)
        underTest.onFragmentViewCreated("QS", qsFragment)

        assertThat(qsContainer.paddingBottom).isEqualTo(padding)
    }

    private fun setUpViews() {
        qsView = FrameLayout(context)
        qsContainer = View(context)
        qsContainer.id = R.id.quick_settings_container
        qsView.addView(qsContainer)

        whenever(qsFrame.findViewById<View>(R.id.qs_frame)).thenReturn(qsFrame)
        whenever(stackScroller.findViewById<View>(R.id.notification_stack_scroller))
            .thenReturn(stackScroller)
        whenever(keyguardStatusBar.findViewById<View>(R.id.keyguard_header))
            .thenReturn(keyguardStatusBar)
        whenever(qsFragment.view).thenReturn(qsView)

        val layoutParams = ConstraintLayout.LayoutParams(0, 0)
        whenever(qsFrame.layoutParams).thenReturn(layoutParams)
        whenever(stackScroller.layoutParams).thenReturn(layoutParams)
        whenever(keyguardStatusBar.layoutParams).thenReturn(layoutParams)

        underTest.addView(qsFrame)
        underTest.addView(stackScroller)
        underTest.addView(keyguardStatusBar)
    }
}
+25 −1
Original line number Diff line number Diff line
@@ -2040,6 +2040,9 @@ public class DisplayPolicy {
             */
            final Rect mConfigFrame = new Rect();

            /** The count of insets sources when calculating this info. */
            int mLastInsetsSourceCount;

            private boolean mNeedUpdate = true;

            void update(DisplayContent dc, int rotation, int w, int h) {
@@ -2061,6 +2064,7 @@ public class DisplayPolicy {
                mNonDecorFrame.inset(mNonDecorInsets);
                mConfigFrame.set(displayFrame);
                mConfigFrame.inset(mConfigInsets);
                mLastInsetsSourceCount = dc.getDisplayPolicy().mInsetsSourceWindowsExceptIme.size();
                mNeedUpdate = false;
            }

@@ -2069,6 +2073,7 @@ public class DisplayPolicy {
                mConfigInsets.set(other.mConfigInsets);
                mNonDecorFrame.set(other.mNonDecorFrame);
                mConfigFrame.set(other.mConfigFrame);
                mLastInsetsSourceCount = other.mLastInsetsSourceCount;
                mNeedUpdate = false;
            }

@@ -2084,6 +2089,12 @@ public class DisplayPolicy {

        static final int DECOR_TYPES = Type.displayCutout() | Type.navigationBars();

        /**
         * The types that may affect display configuration. This excludes cutout because it is
         * known from display info.
         */
        static final int CONFIG_TYPES = Type.statusBars() | Type.navigationBars();

        private final DisplayContent mDisplayContent;
        private final Info[] mInfoForRotation = new Info[4];
        final Info mTmpInfo = new Info();
@@ -2123,7 +2134,20 @@ public class DisplayPolicy {
        final DecorInsets.Info newInfo = mDecorInsets.mTmpInfo;
        newInfo.update(mDisplayContent, rotation, dw, dh);
        final DecorInsets.Info currentInfo = getDecorInsetsInfo(rotation, dw, dh);
        if (newInfo.mNonDecorFrame.equals(currentInfo.mNonDecorFrame)) {
        if (newInfo.mConfigFrame.equals(currentInfo.mConfigFrame)) {
            // Even if the config frame is not changed in current rotation, it may change the
            // insets in other rotations if the source count is changed.
            if (newInfo.mLastInsetsSourceCount != currentInfo.mLastInsetsSourceCount) {
                for (int i = mDecorInsets.mInfoForRotation.length - 1; i >= 0; i--) {
                    if (i != rotation) {
                        final boolean flipSize = (i + rotation) % 2 == 1;
                        final int w = flipSize ? dh : dw;
                        final int h = flipSize ? dw : dh;
                        mDecorInsets.mInfoForRotation[i].update(mDisplayContent, i, w, h);
                    }
                }
                mDecorInsets.mInfoForRotation[rotation].set(newInfo);
            }
            return false;
        }
        mDecorInsets.invalidate();
Loading