summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apex/media/framework/java/android/media/MediaParser.java38
-rw-r--r--packages/Shell/src/com/android/shell/BugreportProgressService.java22
-rw-r--r--packages/SystemUI/res/values/dimens.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/DoubleLineTileLayout.kt75
-rw-r--r--services/core/java/com/android/server/policy/WindowManagerPolicy.java6
-rw-r--r--services/core/java/com/android/server/wm/DisplayPolicy.java11
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java1
7 files changed, 108 insertions, 46 deletions
diff --git a/apex/media/framework/java/android/media/MediaParser.java b/apex/media/framework/java/android/media/MediaParser.java
index edf25ae36ec9..e533b7a7d6f3 100644
--- a/apex/media/framework/java/android/media/MediaParser.java
+++ b/apex/media/framework/java/android/media/MediaParser.java
@@ -499,20 +499,58 @@ public final class MediaParser {
})
public @interface ParserName {}
+ /** Parser name returned by {@link #getParserName()} when no parser has been selected yet. */
public static final String PARSER_NAME_UNKNOWN = "android.media.mediaparser.UNKNOWN";
+ /**
+ * Parser for the Matroska container format, as defined in the <a
+ * href="https://matroska.org/technical/specs/">spec</a>.
+ */
public static final String PARSER_NAME_MATROSKA = "android.media.mediaparser.MatroskaParser";
+ /**
+ * Parser for fragmented files using the MP4 container format, as defined in ISO/IEC 14496-12.
+ */
public static final String PARSER_NAME_FMP4 = "android.media.mediaparser.FragmentedMp4Parser";
+ /**
+ * Parser for non-fragmented files using the MP4 container format, as defined in ISO/IEC
+ * 14496-12.
+ */
public static final String PARSER_NAME_MP4 = "android.media.mediaparser.Mp4Parser";
+ /** Parser for the MP3 container format, as defined in ISO/IEC 11172-3. */
public static final String PARSER_NAME_MP3 = "android.media.mediaparser.Mp3Parser";
+ /** Parser for the ADTS container format, as defined in ISO/IEC 13818-7. */
public static final String PARSER_NAME_ADTS = "android.media.mediaparser.AdtsParser";
+ /**
+ * Parser for the AC-3 container format, as defined in Digital Audio Compression Standard
+ * (AC-3).
+ */
public static final String PARSER_NAME_AC3 = "android.media.mediaparser.Ac3Parser";
+ /** Parser for the TS container format, as defined in ISO/IEC 13818-1. */
public static final String PARSER_NAME_TS = "android.media.mediaparser.TsParser";
+ /**
+ * Parser for the FLV container format, as defined in Adobe Flash Video File Format
+ * Specification.
+ */
public static final String PARSER_NAME_FLV = "android.media.mediaparser.FlvParser";
+ /** Parser for the OGG container format, as defined in RFC 3533. */
public static final String PARSER_NAME_OGG = "android.media.mediaparser.OggParser";
+ /** Parser for the PS container format, as defined in ISO/IEC 11172-1. */
public static final String PARSER_NAME_PS = "android.media.mediaparser.PsParser";
+ /**
+ * Parser for the WAV container format, as defined in Multimedia Programming Interface and Data
+ * Specifications.
+ */
public static final String PARSER_NAME_WAV = "android.media.mediaparser.WavParser";
+ /** Parser for the AMR container format, as defined in RFC 4867. */
public static final String PARSER_NAME_AMR = "android.media.mediaparser.AmrParser";
+ /**
+ * Parser for the AC-4 container format, as defined by Dolby AC-4: Audio delivery for
+ * Next-Generation Entertainment Services.
+ */
public static final String PARSER_NAME_AC4 = "android.media.mediaparser.Ac4Parser";
+ /**
+ * Parser for the FLAC container format, as defined in the <a
+ * href="https://xiph.org/flac/">spec</a>.
+ */
public static final String PARSER_NAME_FLAC = "android.media.mediaparser.FlacParser";
// MediaParser parameters.
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index bb6212818de5..68bd4071de05 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -754,7 +754,7 @@ public class BugreportProgressService extends Service {
!= (info.lastProgress.intValue() / LOG_PROGRESS_STEP))) {
Log.d(TAG, "Progress #" + info.id + ": " + percentageText);
}
- info.lastProgress = new AtomicInteger(progress);
+ info.lastProgress.set(progress);
sendForegroundabledNotification(info.id, builder.build());
}
@@ -1023,7 +1023,7 @@ public class BugreportProgressService extends Service {
}
Log.d(TAG, "Bugreport finished with title: " + info.getTitle()
+ " and shareDescription: " + info.shareDescription);
- info.finished = new AtomicBoolean(true);
+ info.finished.set(true);
synchronized (mLock) {
// Stop running on foreground, otherwise share notification cannot be dismissed.
@@ -1807,18 +1807,18 @@ public class BugreportProgressService extends Service {
* Current value of progress (in percentage) of the bugreport generation as
* displayed by the UI.
*/
- AtomicInteger progress = new AtomicInteger(0);
+ final AtomicInteger progress = new AtomicInteger(0);
/**
* Last value of progress (in percentage) of the bugreport generation for which
* system notification was updated.
*/
- AtomicInteger lastProgress = new AtomicInteger(0);
+ final AtomicInteger lastProgress = new AtomicInteger(0);
/**
* Time of the last progress update.
*/
- AtomicLong lastUpdate = new AtomicLong(System.currentTimeMillis());
+ final AtomicLong lastUpdate = new AtomicLong(System.currentTimeMillis());
/**
* Time of the last progress update when Parcel was created.
@@ -1838,7 +1838,7 @@ public class BugreportProgressService extends Service {
/**
* Whether dumpstate sent an intent informing it has finished.
*/
- AtomicBoolean finished = new AtomicBoolean(false);
+ final AtomicBoolean finished = new AtomicBoolean(false);
/**
* Whether the details entries have been added to the bugreport yet.
@@ -2073,8 +2073,8 @@ public class BugreportProgressService extends Service {
initialName = in.readString();
title = in.readString();
description = in.readString();
- progress = new AtomicInteger(in.readInt());
- lastUpdate = new AtomicLong(in.readLong());
+ progress.set(in.readInt());
+ lastUpdate.set(in.readLong());
formattedLastUpdate = in.readString();
bugreportFile = readFile(in);
@@ -2083,7 +2083,7 @@ public class BugreportProgressService extends Service {
screenshotFiles.add(readFile(in));
}
- finished = new AtomicBoolean(in.readInt() == 1);
+ finished.set(in.readInt() == 1);
screenshotCounter = in.readInt();
shareDescription = in.readString();
shareTitle = in.readString();
@@ -2155,8 +2155,8 @@ public class BugreportProgressService extends Service {
+ ") from " + info.progress.intValue() + " to " + progress);
}
}
- info.progress = new AtomicInteger(progress);
- info.lastUpdate = new AtomicLong(System.currentTimeMillis());
+ info.progress.set(progress);
+ info.lastUpdate.set(System.currentTimeMillis());
updateProgress(info);
}
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 23be78bd6a77..a9e5fa9cf4ae 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -477,6 +477,7 @@
<dimen name="qs_tile_height">106dp</dimen>
<dimen name="qs_tile_layout_margin_side">6dp</dimen>
<dimen name="qs_tile_margin_horizontal">18dp</dimen>
+ <dimen name="qs_tile_margin_horizontal_two_line">2dp</dimen>
<dimen name="qs_tile_margin_vertical">24dp</dimen>
<dimen name="qs_tile_margin_top_bottom">12dp</dimen>
<dimen name="qs_tile_margin_top_bottom_negative">-12dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/DoubleLineTileLayout.kt b/packages/SystemUI/src/com/android/systemui/qs/DoubleLineTileLayout.kt
index f710f7fc47e2..448531a132df 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/DoubleLineTileLayout.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/DoubleLineTileLayout.kt
@@ -25,13 +25,18 @@ import com.android.systemui.qs.TileLayout.exactly
class DoubleLineTileLayout(context: Context) : ViewGroup(context), QSPanel.QSTileLayout {
+ companion object {
+ private const val NUM_LINES = 2
+ }
+
protected val mRecords = ArrayList<QSPanel.TileRecord>()
private var _listening = false
private var smallTileSize = 0
private val twoLineHeight
- get() = smallTileSize * 2 + cellMarginVertical
+ get() = smallTileSize * NUM_LINES + cellMarginVertical * (NUM_LINES - 1)
private var cellMarginHorizontal = 0
private var cellMarginVertical = 0
+ private var tilesToShow = 0
init {
isFocusableInTouchMode = true
@@ -68,7 +73,7 @@ class DoubleLineTileLayout(context: Context) : ViewGroup(context), QSPanel.QSTil
override fun updateResources(): Boolean {
with(mContext.resources) {
smallTileSize = getDimensionPixelSize(R.dimen.qs_quick_tile_size)
- cellMarginHorizontal = getDimensionPixelSize(R.dimen.qs_tile_margin_horizontal)
+ cellMarginHorizontal = getDimensionPixelSize(R.dimen.qs_tile_margin_horizontal_two_line)
cellMarginVertical = getDimensionPixelSize(R.dimen.new_qs_vertical_margin)
}
requestLayout()
@@ -83,11 +88,12 @@ class DoubleLineTileLayout(context: Context) : ViewGroup(context), QSPanel.QSTil
}
}
- override fun getNumVisibleTiles() = mRecords.size
+ override fun getNumVisibleTiles() = tilesToShow
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
updateResources()
+ postInvalidate()
}
override fun onFinishInflate() {
@@ -95,39 +101,58 @@ class DoubleLineTileLayout(context: Context) : ViewGroup(context), QSPanel.QSTil
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
- var previousView: View = this
- var tiles = 0
mRecords.forEach {
- val tileView = it.tileView
- if (tileView.visibility != View.GONE) {
- tileView.updateAccessibilityOrder(previousView)
- previousView = tileView
- tiles++
- tileView.measure(exactly(smallTileSize), exactly(smallTileSize))
- }
+ it.tileView.measure(exactly(smallTileSize), exactly(smallTileSize))
}
val height = twoLineHeight
- val columns = tiles / 2
- val width = paddingStart + paddingEnd +
- columns * smallTileSize +
- (columns - 1) * cellMarginHorizontal
- setMeasuredDimension(width, height)
+ setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), height)
+ }
+
+ private fun calculateMaxColumns(availableWidth: Int): Int {
+ if (smallTileSize + cellMarginHorizontal == 0) {
+ return 0
+ } else {
+ return (availableWidth - smallTileSize) / (smallTileSize + cellMarginHorizontal) + 1
+ }
}
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
- val tiles = mRecords.filter { it.tileView.visibility != View.GONE }
- tiles.forEachIndexed {
- index, tile ->
- val column = index % (tiles.size / 2)
- val left = getLeftForColumn(column)
- val top = if (index < tiles.size / 2) 0 else getTopBottomRow()
- tile.tileView.layout(left, top, left + smallTileSize, top + smallTileSize)
+ val availableWidth = r - l - paddingLeft - paddingRight
+ val maxColumns = calculateMaxColumns(availableWidth)
+ val actualColumns = Math.min(maxColumns, mRecords.size / NUM_LINES)
+ if (actualColumns == 0) {
+ // No tileSize or horizontal margin
+ return
+ }
+ tilesToShow = actualColumns * NUM_LINES
+
+ val interTileSpace = if (actualColumns <= 2) {
+ // Extra "column" of padding to be distributed on each end
+ (availableWidth - actualColumns * smallTileSize) / actualColumns
+ } else {
+ (availableWidth - actualColumns * smallTileSize) / (actualColumns - 1)
+ }
+
+ for (index in 0 until mRecords.size) {
+ val tileView = mRecords[index].tileView
+ if (index >= tilesToShow) {
+ tileView.visibility = View.GONE
+ } else {
+ tileView.visibility = View.VISIBLE
+ if (index > 0) tileView.updateAccessibilityOrder(mRecords[index - 1].tileView)
+ val column = index % actualColumns
+ val left = getLeftForColumn(column, interTileSpace, actualColumns <= 2)
+ val top = if (index < actualColumns) 0 else getTopBottomRow()
+ tileView.layout(left, top, left + smallTileSize, top + smallTileSize)
+ }
}
}
- private fun getLeftForColumn(column: Int) = column * (smallTileSize + cellMarginHorizontal)
+ private fun getLeftForColumn(column: Int, interSpace: Int, sideMargin: Boolean): Int {
+ return (if (sideMargin) interSpace / 2 else 0) + column * (smallTileSize + interSpace)
+ }
private fun getTopBottomRow() = smallTileSize + cellMarginVertical
} \ No newline at end of file
diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
index 7eb3f01798c5..d89605a9ddbd 100644
--- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java
+++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
@@ -542,12 +542,6 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
void unregisterPointerEventListener(PointerEventListener listener, int displayId);
/**
- * Retrieves the {@param outBounds} from the stack matching the {@param windowingMode} and
- * {@param activityType}.
- */
- void getStackBounds(int windowingMode, int activityType, Rect outBounds);
-
- /**
* @return The currently active input method window.
*/
WindowState getInputMethodWindowLw();
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 367151cf0f79..221258e94cb2 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -3246,9 +3246,14 @@ public class DisplayPolicy {
mTopFullscreenOpaqueWindowState, mTopFullscreenOpaqueOrDimmingWindowState);
final int dockedAppearance = updateLightStatusBarAppearanceLw(0 /* vis */,
mTopDockedOpaqueWindowState, mTopDockedOpaqueOrDimmingWindowState);
- mService.getStackBounds(
- WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_STANDARD, mDockedStackBounds);
- final boolean inSplitScreen = !mDockedStackBounds.isEmpty();
+ final boolean inSplitScreen =
+ mService.mRoot.getDefaultDisplay().mTaskContainers.isSplitScreenModeActivated();
+ if (inSplitScreen) {
+ mService.getStackBounds(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_STANDARD,
+ mDockedStackBounds);
+ } else {
+ mDockedStackBounds.setEmpty();
+ }
mService.getStackBounds(inSplitScreen ? WINDOWING_MODE_SPLIT_SCREEN_SECONDARY
: WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_UNDEFINED, mNonDockedStackBounds);
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index ae668f19b162..dfaa0ec47155 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2780,7 +2780,6 @@ public class WindowManagerService extends IWindowManager.Stub
aspectRatio);
}
- @Override
public void getStackBounds(int windowingMode, int activityType, Rect bounds) {
synchronized (mGlobalLock) {
final ActivityStack stack = mRoot.getStack(windowingMode, activityType);