Merge "Import translations. DO NOT MERGE" into nyc-dev
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index ac43bb7..203b825 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -745,6 +745,12 @@
Log.d(TAG, String.format("%d windowPositionLostRT RT, frameNr = %d",
System.identityHashCode(this), frameNumber));
}
+ IWindowSession session = mSession;
+ MyWindow window = mWindow;
+ if (session == null || window == null) {
+ // We got detached prior to receiving this, abort
+ return;
+ }
if (mRtHandlingPositionUpdates) {
mRtHandlingPositionUpdates = false;
// This callback will happen while the UI thread is blocked, so we can
@@ -757,7 +763,7 @@
"postion = [%d, %d, %d, %d]", System.identityHashCode(this),
mWinFrame.left, mWinFrame.top,
mWinFrame.right, mWinFrame.bottom));
- mSession.repositionChild(mWindow, mWinFrame.left, mWinFrame.top,
+ session.repositionChild(window, mWinFrame.left, mWinFrame.top,
mWinFrame.right, mWinFrame.bottom, frameNumber, mWinFrame);
} catch (RemoteException ex) {
Log.e(TAG, "Exception from relayout", ex);
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 5b0845c..71d1aaa 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -125,6 +125,77 @@
All video codecs support flexible YUV 4:2:0 buffers since {@link
android.os.Build.VERSION_CODES#LOLLIPOP_MR1}.
+ <h4>Accessing Raw Video ByteBuffers on Older Devices</h4>
+ <p>
+ Prior to {@link android.os.Build.VERSION_CODES#LOLLIPOP} and {@link Image} support, you need to
+ use the {@link MediaFormat#KEY_STRIDE} and {@link MediaFormat#KEY_SLICE_HEIGHT} output format
+ values to understand the layout of the raw output buffers.
+ <p class=note>
+ Note that on some devices the slice-height is advertised as 0. This could mean either that the
+ slice-height is the same as the frame height, or that the slice-height is the frame height
+ aligned to some value (usually a power of 2). Unfortunately, there is no way to tell the actual
+ slice height in this case. Furthermore, the vertical stride of the {@code U} plane in planar
+ formats is also not specified or defined, though usually it is half of the slice height.
+ <p>
+ The {@link MediaFormat#KEY_WIDTH} and {@link MediaFormat#KEY_HEIGHT} keys specify the size of the
+ video frames; however, for most encondings the video (picture) only occupies a portion of the
+ video frame. This is represented by the 'crop rectangle'.
+ <p>
+ You need to use the following keys to get the crop rectangle of raw output images from the
+ {@linkplain #getOutputFormat output format}. If these keys are not present, the video occupies the
+ entire video frame.The crop rectangle is understood in the context of the output frame
+ <em>before</em> applying any {@linkplain MediaFormat#KEY_ROTATION rotation}.
+ <table style="width: 0%">
+ <thead>
+ <tr>
+ <th>Format Key</th>
+ <th>Type</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{@code "crop-left"}</td>
+ <td>Integer</td>
+ <td>The left-coordinate (x) of the crop rectangle</td>
+ </tr><tr>
+ <td>{@code "crop-top"}</td>
+ <td>Integer</td>
+ <td>The top-coordinate (y) of the crop rectangle</td>
+ </tr><tr>
+ <td>{@code "crop-right"}</td>
+ <td>Integer</td>
+ <td>The right-coordinate (x) <strong>MINUS 1</strong> of the crop rectangle</td>
+ </tr><tr>
+ <td>{@code "crop-bottom"}</td>
+ <td>Integer</td>
+ <td>The bottom-coordinate (y) <strong>MINUS 1</strong> of the crop rectangle</td>
+ </tr><tr>
+ <td colspan=3>
+ The right and bottom coordinates can be understood as the coordinates of the right-most
+ valid column/bottom-most valid row of the cropped output image.
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <p>
+ The size of the video frame (before rotation) can be calculated as such:
+ <pre class=prettyprint>
+ MediaFormat format = decoder.getOutputFormat(…);
+ int width = format.getInteger(MediaFormat.KEY_WIDTH);
+ if (format.containsKey("crop-left") && format.containsKey("crop-right")) {
+ width = format.getInteger("crop-right") + 1 - format.getInteger("crop-left");
+ }
+ int height = format.getInteger(MediaFormat.KEY_HEIGHT);
+ if (format.containsKey("crop-top") && format.containsKey("crop-bottom")) {
+ height = format.getInteger("crop-bottom") + 1 - format.getInteger("crop-top");
+ }
+ </pre>
+ <p class=note>
+ Also note that the meaning of {@link BufferInfo#offset BufferInfo.offset} was not consistent across
+ devices. On some devices the offset pointed to the top-left pixel of the crop rectangle, while on
+ most devices it pointed to the top-left pixel of the entire frame.
+
<h3>States</h3>
<p>
During its life a codec conceptually exists in one of three states: Stopped, Executing or
diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java
index 33e3957..a2fd0aa 100644
--- a/media/java/android/media/MediaFormat.java
+++ b/media/java/android/media/MediaFormat.java
@@ -295,17 +295,19 @@
* Stride (or row increment) is the difference between the index of a pixel
* and that of the pixel directly underneath. For YUV 420 formats, the
* stride corresponds to the Y plane; the stride of the U and V planes can
- * be calculated based on the color format.
+ * be calculated based on the color format, though it is generally undefined
+ * and depends on the device and release.
* The associated value is an integer, representing number of bytes.
*/
public static final String KEY_STRIDE = "stride";
/**
* A key describing the plane height of a multi-planar (YUV) video bytebuffer layout.
- * Slice height (or plane height) is the number of rows that must be skipped to get
- * from the top of the Y plane to the top of the U plane in the bytebuffer. In essence
+ * Slice height (or plane height/vertical stride) is the number of rows that must be skipped
+ * to get from the top of the Y plane to the top of the U plane in the bytebuffer. In essence
* the offset of the U plane is sliceHeight * stride. The height of the U/V planes
- * can be calculated based on the color format.
+ * can be calculated based on the color format, though it is generally undefined
+ * and depends on the device and release.
* The associated value is an integer, representing number of rows.
*/
public static final String KEY_SLICE_HEIGHT = "slice-height";
diff --git a/media/java/android/media/MediaMuxer.java b/media/java/android/media/MediaMuxer.java
index 7117fbd..e481aa1 100644
--- a/media/java/android/media/MediaMuxer.java
+++ b/media/java/android/media/MediaMuxer.java
@@ -266,6 +266,121 @@
/**
* Adds a track with the specified format.
+ * <p>
+ * The following table summarizes support for specific format keys across android releases.
+ * Keys marked with '+:' are required.
+ *
+ * <table style="width: 0%">
+ * <thead>
+ * <tr>
+ * <th rowspan=2>OS Version(s)</th>
+ * <td colspan=3>{@code MediaFormat} keys used for</th>
+ * </tr><tr>
+ * <th>All Tracks</th>
+ * <th>Audio Tracks</th>
+ * <th>Video Tracks</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <td>{@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}</td>
+ * <td rowspan=7>+: {@link MediaFormat#KEY_MIME}</td>
+ * <td rowspan=3>+: {@link MediaFormat#KEY_SAMPLE_RATE},<br>
+ * +: {@link MediaFormat#KEY_CHANNEL_COUNT},<br>
+ * +: <strong>codec-specific data<sup>AAC</sup></strong></td>
+ * <td rowspan=5>+: {@link MediaFormat#KEY_WIDTH},<br>
+ * +: {@link MediaFormat#KEY_HEIGHT},<br>
+ * no {@code KEY_ROTATION},
+ * use {@link #setOrientationHint setOrientationHint()}<sup>.mp4</sup>,<br>
+ * +: <strong>codec-specific data<sup>AVC, MPEG4</sup></strong></td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#KITKAT}</td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#KITKAT_WATCH}</td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#LOLLIPOP}</td>
+ * <td rowspan=4>as above, plus<br>
+ * +: <strong>codec-specific data<sup>Vorbis & .webm</sup></strong></td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1}</td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#M}</td>
+ * <td>as above, plus<br>
+ * {@link MediaFormat#KEY_BIT_RATE}<sup>AAC</sup></td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#N}</td>
+ * <td>as above, plus<br>
+ * <!-- {link MediaFormat#KEY_MAX_BIT_RATE}<sup>AAC, MPEG4</sup>,<br> -->
+ * {@link MediaFormat#KEY_BIT_RATE}<sup>MPEG4</sup>,<br>
+ * {@link MediaFormat#KEY_HDR_STATIC_INFO}<sup>#, .webm</sup>,<br>
+ * {@link MediaFormat#KEY_COLOR_STANDARD}<sup>#</sup>,<br>
+ * {@link MediaFormat#KEY_COLOR_TRANSFER}<sup>#</sup>,<br>
+ * {@link MediaFormat#KEY_COLOR_RANGE}<sup>#</sup>,<br>
+ * +: <strong>codec-specific data<sup>HEVC</sup></strong>,<br>
+ * codec-specific data<sup>VP9</sup></td>
+ * </tr>
+ * <tr>
+ * <td colspan=4>
+ * <p class=note><strong>Notes:</strong><br>
+ * #: storing into container metadata.<br>
+ * .mp4, .webm…: for listed containers<br>
+ * MPEG4, AAC…: for listed codecs
+ * </td>
+ * </tr><tr>
+ * <td colspan=4>
+ * <p class=note>Note that the codec-specific data for the track must be specified using
+ * this method. Furthermore, codec-specific data must not be passed/specified via the
+ * {@link #writeSampleData writeSampleData()} call.
+ * </td>
+ * </tr>
+ * </tbody>
+ * </table>
+ *
+ * <p>
+ * The following table summarizes codec support for containers across android releases:
+ *
+ * <table style="width: 0%">
+ * <thead>
+ * <tr>
+ * <th rowspan=2>OS Version(s)</th>
+ * <td colspan=3>Codec support</th>
+ * </tr><tr>
+ * <th>{@linkplain OutputFormat#MUXER_OUTPUT_MPEG_4 MP4}</th>
+ * <th>{@linkplain OutputFormat#MUXER_OUTPUT_WEBM WEBM}</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <td>{@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}</td>
+ * <td rowspan=6>{@link MediaFormat#MIMETYPE_AUDIO_AAC AAC},<br>
+ * {@link MediaFormat#MIMETYPE_AUDIO_AMR_NB NB-AMR},<br>
+ * {@link MediaFormat#MIMETYPE_AUDIO_AMR_WB WB-AMR},<br>
+ * {@link MediaFormat#MIMETYPE_VIDEO_H263 H.263},<br>
+ * {@link MediaFormat#MIMETYPE_VIDEO_MPEG4 MPEG-4},<br>
+ * {@link MediaFormat#MIMETYPE_VIDEO_AVC AVC} (H.264)</td>
+ * <td rowspan=3>Not supported</td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#KITKAT}</td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#KITKAT_WATCH}</td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#LOLLIPOP}</td>
+ * <td rowspan=3>{@link MediaFormat#MIMETYPE_AUDIO_VORBIS Vorbis},<br>
+ * {@link MediaFormat#MIMETYPE_VIDEO_VP8 VP8}</td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1}</td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#M}</td>
+ * </tr><tr>
+ * <td>{@link android.os.Build.VERSION_CODES#N}</td>
+ * <td>as above, plus<br>
+ * {@link MediaFormat#MIMETYPE_VIDEO_HEVC HEVC} (H.265)</td>
+ * <td>as above, plus<br>
+ * {@link MediaFormat#MIMETYPE_VIDEO_VP9 VP9}</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ *
* @param format The media format for the track. This must not be an empty
* MediaFormat.
* @return The track index for this newly added track, and it should be used
diff --git a/packages/EasterEgg/res/drawable/food_bacon.xml b/packages/EasterEgg/res/drawable/food_bacon.xml
deleted file mode 100644
index 1df325c..0000000
--- a/packages/EasterEgg/res/drawable/food_bacon.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-Copyright (C) 2015 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="48dp"
- android:height="48dp"
- android:viewportWidth="48.0"
- android:viewportHeight="48.0">
- <path
- android:fillColor="#FF000000"
- android:pathData="M42.6,14.9c-0.8,0,-2.6,-1.3,-2.7,-1.6c-0.2,-0.2,-2.2,-0.9,-2.7,-2c-0.2,-0.4,-1.1,-3.4,-1.1,-3.4s0,0,-1.8,3 c-1.8,3,-4.3,3.1,-7.6,3c-3.3,-0.1,-3,3.4,-5.5,5.8c-2.5,2.4,-5.4,3,-9.6,2.5c-4.2,-0.6,-6.8,6.7,-6.8,6.7s1.5,0.5,2.5,0.5s2.5,1.2,3.3,5 c0.8,3.9,5.1,6.5,5.1,6.5s0.1,-6.3,1.2,-9.2c1.1,-2.9,6.4,-0.5,9.8,-1.3c3.4,-0.8,3.3,-4.8,4.2,-6.7c0.9,-1.9,3.9,-2.6,7.6,-3.4 C42.2,19.4,43.4,14.9,42.6,14.9z M13.4,30.7c-0.6,2.1,-0.6,1.7,-0.6,1.7s0,-2.6,0.8,-3.3c0.8,-0.6,4.8,-1,4.8,-1S14.1,28.6,13.4,30.7z M13.4,25.6c-1.5,0.8,-3,1.8,-3,1.8s-1.1,-1.7,1.1,-2.3c2.2,-0.6,9,0.6,10,-2.2c1,-2.6,3.8,-7.5,4.5,-7.1c-1.5,1.7,-3.1,7,-4.3,8.6 C20.8,25.7,14.9,24.8,13.4,25.6z M31.7,17.3c-2.1,0.9,-3.9,2.3,-5.3,5.7c-1.4,3.3,-3.5,2.7,-3.5,2.7c5.6,-5,3.2,-7.4,5.5,-8.4 c3.5,-1.5,2.6,0.2,4.8,-1.3c2.3,-1.6,3.1,-2.6,3.1,-2.6C36.4,13.4,34.1,16.3,31.7,17.3z"/>
-</vector>
diff --git a/packages/EasterEgg/res/drawable/food_chicken.xml b/packages/EasterEgg/res/drawable/food_chicken.xml
new file mode 100644
index 0000000..95b2fb5
--- /dev/null
+++ b/packages/EasterEgg/res/drawable/food_chicken.xml
@@ -0,0 +1,39 @@
+<!--
+Copyright (C) 2015 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M9,12v14h10V11H9z M11.7,16.3c-0.7,0,-1.3,-0.6,-1.3,-1.3s0.6,-1.3,1.3,-1.3S13,14.3,13,15S12.4,16.3,11.7,16.3z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M5.7,20.1l1.6,-3.0l-1.6,-3.0l4.4,3.0z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M19.0,6.0l-2.3,2.3l-2.7,-2.6l-2.7,2.6l-2.3,-2.3l0.0,4.0l10.0,0.0z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M9,25c0,8.3,6.7,15,15,15s15,-6.7,15,-15H9z M29.9,31.5h-11v-1h12L29.9,31.5z M31.9,29.5h-13v-1h14L31.9,29.5z M33.9,27.5 h-15v-1h16L33.9,27.5z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M27.0,38.6h2.0v6.0h-2.0z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M17.4,44.6l-2.1999998,0.0l4.4000006,-6.0l2.1999989,0.0z"/>
+</vector>
diff --git a/packages/EasterEgg/res/values/strings.xml b/packages/EasterEgg/res/values/strings.xml
index 074a864..a2440c7b 100644
--- a/packages/EasterEgg/res/values/strings.xml
+++ b/packages/EasterEgg/res/values/strings.xml
@@ -25,14 +25,14 @@
<item>Empty dish</item>
<item>Bits</item>
<item>Fish</item>
- <item>Bacon</item>
+ <item>Chicken</item>
<item>Treat</item>
</string-array>
<array name="food_icons">
<item>@drawable/food_dish</item>
<item>@drawable/food_bits</item>
<item>@drawable/food_sysuituna</item>
- <item>@drawable/food_bacon</item>
+ <item>@drawable/food_chicken</item>
<item>@drawable/food_donut</item>
</array>
<integer-array name="food_intervals">
@@ -45,8 +45,8 @@
<integer-array name="food_new_cat_prob">
<item>0</item>
<item>5</item>
- <item>25</item>
- <item>50</item>
- <item>75</item>
+ <item>35</item>
+ <item>65</item>
+ <item>90</item>
</integer-array>
</resources>