diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-12-01 07:41:42 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-12-01 07:41:42 +0000 |
commit | b80270dc7c9d6e61771a700cb4da4f4a5841237f (patch) | |
tree | 97c044180fc16899ccfc52d816e6fe1ad23a24f3 | |
parent | 843acf763684ff719c5642661ec264f5ed038139 (diff) | |
parent | 27393bb410c084e4b369e04d492bc7f34a5019b3 (diff) | |
download | base-aml_tet_331412030.tar.gz |
Snap for 9355375 from 27393bb410c084e4b369e04d492bc7f34a5019b3 to mainline-tethering-releaseaml_tet_331511160aml_tet_331511000aml_tet_331412030
Change-Id: I54c3bc1de32105e3014eb19d82e58186e913a470
9 files changed, 91 insertions, 34 deletions
diff --git a/core/java/android/accounts/ChooseTypeAndAccountActivity.java b/core/java/android/accounts/ChooseTypeAndAccountActivity.java index f623295dee3e..6e02390bb711 100644 --- a/core/java/android/accounts/ChooseTypeAndAccountActivity.java +++ b/core/java/android/accounts/ChooseTypeAndAccountActivity.java @@ -402,7 +402,7 @@ public class ChooseTypeAndAccountActivity extends Activity mExistingAccounts = AccountManager.get(this).getAccountsForPackage(mCallingPackage, mCallingUid); intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK); - startActivityForResult(intent, REQUEST_ADD_ACCOUNT); + startActivityForResult(new Intent(intent), REQUEST_ADD_ACCOUNT); return; } } catch (OperationCanceledException e) { diff --git a/media/java/android/media/Image.java b/media/java/android/media/Image.java index 8a03afb77942..d6fe68253be6 100644 --- a/media/java/android/media/Image.java +++ b/media/java/android/media/Image.java @@ -86,8 +86,10 @@ public abstract class Image implements AutoCloseable { * * <p> * The format is one of the values from - * {@link android.graphics.ImageFormat ImageFormat}. The mapping between the - * formats and the planes is as follows: + * {@link android.graphics.ImageFormat ImageFormat}, + * {@link android.graphics.PixelFormat PixelFormat}, or + * {@link android.hardware.HardwareBuffer HardwareBuffer}. The mapping between the + * formats and the planes is as follows (any formats not listed will have 1 plane): * </p> * * <table> @@ -171,15 +173,18 @@ public abstract class Image implements AutoCloseable { * </tr> * <tr> * <td>{@link android.graphics.ImageFormat#YCBCR_P010 YCBCR_P010}</td> - * <td>1</td> + * <td>3</td> * <td>P010 is a 4:2:0 YCbCr semiplanar format comprised of a WxH Y plane - * followed by a Wx(H/2) CbCr plane. Each sample is represented by a 16-bit - * little-endian value, with the lower 6 bits set to zero. + * followed by a Wx(H/2) Cb and Cr planes. Each sample is represented by a 16-bit + * little-endian value, with the lower 6 bits set to zero. Since this is guaranteed to be + * a semi-planar format, the Cb plane can also be treated as an interleaved Cb/Cr plane. * </td> * </tr> * </table> * * @see android.graphics.ImageFormat + * @see android.graphics.PixelFormat + * @see android.hardware.HardwareBuffer */ public abstract int getFormat(); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 324c01959084..29f3e2ad10e5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -128,6 +128,8 @@ public class QSPanel extends LinearLayout implements Tunable { if (mUsingMediaPlayer) { mHorizontalLinearLayout = new RemeasuringLinearLayout(mContext); mHorizontalLinearLayout.setOrientation(LinearLayout.HORIZONTAL); + mHorizontalLinearLayout.setVisibility( + mUsingHorizontalLayout ? View.VISIBLE : View.GONE); mHorizontalLinearLayout.setClipChildren(false); mHorizontalLinearLayout.setClipToPadding(false); @@ -445,6 +447,8 @@ public class QSPanel extends LinearLayout implements Tunable { mMediaHostView = hostView; ViewGroup newParent = horizontal ? mHorizontalLinearLayout : this; ViewGroup currentParent = (ViewGroup) hostView.getParent(); + Log.d(getDumpableTag(), "Reattaching media host: " + horizontal + + ", current " + currentParent + ", new " + newParent); if (currentParent != newParent) { if (currentParent != null) { currentParent.removeView(hostView); @@ -461,6 +465,8 @@ public class QSPanel extends LinearLayout implements Tunable { ? Math.max(mMediaTotalBottomMargin - getPaddingBottom(), 0) : 0; layoutParams.topMargin = mediaNeedsTopMargin() && !horizontal ? mMediaTopMargin : 0; + // Call setLayoutParams explicitly to ensure that requestLayout happens + hostView.setLayoutParams(layoutParams); } } @@ -589,6 +595,7 @@ public class QSPanel extends LinearLayout implements Tunable { void setUsingHorizontalLayout(boolean horizontal, ViewGroup mediaHostView, boolean force) { if (horizontal != mUsingHorizontalLayout || force) { + Log.d(getDumpableTag(), "setUsingHorizontalLayout: " + horizontal + ", " + force); mUsingHorizontalLayout = horizontal; ViewGroup newParent = horizontal ? mHorizontalContentContainer : this; switchAllContentToParent(newParent, mTileLayout); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java index 918c6be582e7..a15cffd4f7ad 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java @@ -21,7 +21,6 @@ import static com.android.systemui.media.dagger.MediaModule.QS_PANEL; import static com.android.systemui.qs.QSPanel.QS_SHOW_BRIGHTNESS; import static com.android.systemui.qs.dagger.QSFragmentModule.QS_USING_MEDIA_PLAYER; -import android.content.res.Configuration; import android.view.MotionEvent; import android.view.View; @@ -63,17 +62,6 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> { private boolean mGridContentVisible = true; - private final QSPanel.OnConfigurationChangedListener mOnConfigurationChangedListener = - new QSPanel.OnConfigurationChangedListener() { - @Override - public void onConfigurationChange(Configuration newConfig) { - mView.updateResources(); - if (mView.isListening()) { - refreshAllTiles(); - } - } - }; - private View.OnTouchListener mTileLayoutTouchListener = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { @@ -131,7 +119,6 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> { if (mView.isListening()) { refreshAllTiles(); } - mView.addOnConfigurationChangedListener(mOnConfigurationChangedListener); switchTileLayout(true); mBrightnessMirrorHandler.onQsPanelAttached(); @@ -148,11 +135,18 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> { @Override protected void onViewDetached() { mTunerService.removeTunable(mView); - mView.removeOnConfigurationChangedListener(mOnConfigurationChangedListener); mBrightnessMirrorHandler.onQsPanelDettached(); super.onViewDetached(); } + @Override + protected void onConfigurationChanged() { + mView.updateResources(); + if (mView.isListening()) { + refreshAllTiles(); + } + } + /** */ public void setVisibility(int visibility) { mView.setVisibility(visibility); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java index ec61ea6fffa8..9e1c0034f55a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java @@ -88,11 +88,13 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr public void onConfigurationChange(Configuration newConfig) { mShouldUseSplitNotificationShade = LargeScreenUtils.shouldUseSplitNotificationShade(getResources()); - onConfigurationChanged(); + mQSLogger.logOnConfigurationChanged(mLastOrientation, newConfig.orientation, + mView.getDumpableTag()); if (newConfig.orientation != mLastOrientation) { mLastOrientation = newConfig.orientation; switchTileLayout(false); } + onConfigurationChanged(); } }; @@ -164,6 +166,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr mHost.addCallback(mQSHostCallback); setTiles(); mLastOrientation = getResources().getConfiguration().orientation; + mQSLogger.logOnViewAttached(mLastOrientation, mView.getDumpableTag()); switchTileLayout(true); mDumpManager.registerDumpable(mView.getDumpableTag(), this); @@ -171,6 +174,7 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr @Override protected void onViewDetached() { + mQSLogger.logOnViewDetached(mLastOrientation, mView.getDumpableTag()); mView.removeOnConfigurationChangedListener(mOnConfigurationChangedListener); 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. */ boolean horizontal = shouldUseHorizontalLayout(); if (horizontal != mUsingHorizontalLayout || force) { + mQSLogger.logSwitchTileLayout(horizontal, mUsingHorizontalLayout, force, + mView.getDumpableTag()); mUsingHorizontalLayout = horizontal; mView.setUsingHorizontalLayout(mUsingHorizontalLayout, mMediaHost.getHostView(), force); updateMediaDisappearParameters(); @@ -402,6 +408,8 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr } if (mMediaHost != null) { pw.println(" media bounds: " + mMediaHost.getCurrentBounds()); + pw.println(" horizontal layout: " + mUsingHorizontalLayout); + pw.println(" last orientation: " + mLastOrientation); } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java index 833573dd3873..8ca7b2770b99 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java @@ -44,14 +44,6 @@ import javax.inject.Named; @QSScope public class QuickQSPanelController extends QSPanelControllerBase<QuickQSPanel> { - private final QSPanel.OnConfigurationChangedListener mOnConfigurationChangedListener = - newConfig -> { - int newMaxTiles = getResources().getInteger(R.integer.quick_qs_panel_max_tiles); - if (newMaxTiles != mView.getNumQuickTiles()) { - setMaxTiles(newMaxTiles); - } - }; - private final boolean mUsingCollapsedLandscapeMedia; @Inject @@ -95,13 +87,11 @@ public class QuickQSPanelController extends QSPanelControllerBase<QuickQSPanel> @Override protected void onViewAttached() { super.onViewAttached(); - mView.addOnConfigurationChangedListener(mOnConfigurationChangedListener); } @Override protected void onViewDetached() { super.onViewDetached(); - mView.removeOnConfigurationChangedListener(mOnConfigurationChangedListener); } private void setMaxTiles(int parseNumTiles) { @@ -111,6 +101,10 @@ public class QuickQSPanelController extends QSPanelControllerBase<QuickQSPanel> @Override protected void onConfigurationChanged() { + int newMaxTiles = getResources().getInteger(R.integer.quick_qs_panel_max_tiles); + if (newMaxTiles != mView.getNumQuickTiles()) { + setMaxTiles(newMaxTiles); + } updateMediaExpansion(); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/logging/QSLogger.kt b/packages/SystemUI/src/com/android/systemui/qs/logging/QSLogger.kt index 86ef85824eb0..87aa06dfb6f4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/logging/QSLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/logging/QSLogger.kt @@ -128,6 +128,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 { return when (state) { Tile.STATE_ACTIVE -> "active" diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java index c127a6b87da7..3cad2a005882 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerBaseTest.java @@ -224,7 +224,9 @@ public class QSPanelControllerBaseTest extends SysuiTestCase { + " Tile records:\n" + " " + mockTileString + "\n" + " " + mockTileViewString + "\n" - + " media bounds: null\n"; + + " media bounds: null\n" + + " horizontal layout: false\n" + + " last orientation: 0\n"; assertEquals(expected, w.getBuffer().toString()); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QuickQSPanelControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/QuickQSPanelControllerTest.kt index 1f28210acc64..e98f2146d062 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/QuickQSPanelControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QuickQSPanelControllerTest.kt @@ -126,8 +126,7 @@ class QuickQSPanelControllerTest : SysuiTestCase() { @Test fun testMediaExpansionUpdatedWhenConfigurationChanged() { - // times(2) because both controller and base controller are registering their listeners - verify(quickQSPanel, times(2)).addOnConfigurationChangedListener(captor.capture()) + verify(quickQSPanel).addOnConfigurationChangedListener(captor.capture()) // verify that media starts in the expanded state by default verify(mediaHost).expansion = MediaHostState.EXPANDED |