Merge "Fix memory leak in TimeBase.mObservers list."
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 2df7042..ae42882 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,8 +1,7 @@
[Hook Scripts]
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
- -fw core/java/android/
+ -fw core/
graphics/java/android
- core/tests/coretests/src/android/
packages/PrintRecommendationService/
packages/PrintSpooler/
packages/PackageInstaller/
diff --git a/apct-tests/perftests/core/src/android/app/ResourcesPerfTest.java b/apct-tests/perftests/core/src/android/app/ResourcesPerfTest.java
new file mode 100644
index 0000000..9cdeb48
--- /dev/null
+++ b/apct-tests/perftests/core/src/android/app/ResourcesPerfTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2018 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 android.app;
+
+import static org.junit.Assert.fail;
+
+import android.content.res.AssetManager;
+import android.content.res.Resources;
+import android.content.res.XmlResourceParser;
+import android.perftests.utils.BenchmarkState;
+import android.perftests.utils.PerfStatusReporter;
+import android.support.test.filters.LargeTest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+
+/**
+ * Benchmarks for {@link android.content.res.Resources}.
+ */
+@LargeTest
+public class ResourcesPerfTest {
+ @Rule
+ public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
+
+ private AssetManager mAsset;
+ private Resources mRes;
+
+ private int mTextId;
+ private int mColorId;
+ private int mIntegerId;
+ private int mLayoutId;
+
+ @Before
+ public void setUp() {
+ mAsset = new AssetManager();
+ mAsset.addAssetPath("/system/framework/framework-res.apk");
+ mRes = new Resources(mAsset, null, null);
+
+ mTextId = mRes.getIdentifier("cancel", "string", "android");
+ mColorId = mRes.getIdentifier("transparent", "color", "android");
+ mIntegerId = mRes.getIdentifier("config_shortAnimTime", "integer", "android");
+ mLayoutId = mRes.getIdentifier("two_line_list_item", "layout", "android");
+ }
+
+ @After
+ public void tearDown() {
+ mAsset.close();
+ }
+
+ @Test
+ public void getText() {
+ final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ while (state.keepRunning()) {
+ mRes.getText(mTextId);
+ }
+ }
+
+ @Test
+ public void getColor() {
+ final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ while (state.keepRunning()) {
+ mRes.getColor(mColorId, null);
+ }
+ }
+
+ @Test
+ public void getInteger() {
+ final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ while (state.keepRunning()) {
+ mRes.getInteger(mIntegerId);
+ }
+ }
+
+ @Test
+ public void getLayoutAndTravese() {
+ final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ while (state.keepRunning()) {
+ try (XmlResourceParser parser = mRes.getLayout(mLayoutId)) {
+ while (parser.next() != XmlPullParser.END_DOCUMENT) {
+ // Walk the entire tree
+ }
+ } catch (IOException | XmlPullParserException exception) {
+ fail("Parsing of the layout failed. Something is really broken");
+ }
+ }
+ }
+}
diff --git a/api/current.txt b/api/current.txt
index d70d1e7..c236186 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1323,7 +1323,7 @@
field public static final int targetName = 16843853; // 0x101044d
field public static final int targetPackage = 16842785; // 0x1010021
field public static final int targetProcesses = 16844097; // 0x1010541
- field public static final int targetSandboxVersion = 16844108; // 0x101054c
+ field public static final deprecated int targetSandboxVersion = 16844108; // 0x101054c
field public static final int targetSdkVersion = 16843376; // 0x1010270
field public static final int taskAffinity = 16842770; // 0x1010012
field public static final int taskCloseEnterAnimation = 16842942; // 0x10100be
diff --git a/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp b/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
index 0615c74..2a89c920 100644
--- a/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
+++ b/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
@@ -75,18 +75,13 @@
} else return BAD_VALUE;
// expect part 2 starts with "type"
if (stripPrefix(&record[2], "type")) {
- // expect the rest of part 2 has number of (pageBlockOrder + 2) parts
// An example looks like:
// header line: type 0 1 2 3 4 5 6 7 8 9 10
// record line: Unmovable 426 279 226 1 1 1 0 0 2 2 0
- // The pageBlockOrder = 10 and it's zero-indexed. so total parts
- // are 10 + 1(zero-indexed) + 1(the type part) = 12.
record_t pageCounts = parseRecord(record[2]);
- int pageCountsSize = pageBlockOrder + 2;
- if ((int)pageCounts.size() != pageCountsSize) return BAD_VALUE;
proto.write(PageTypeInfoProto::MigrateType::TYPE, pageCounts[0]);
- for (auto i=1; i<pageCountsSize; i++) {
+ for (size_t i=1; i<pageCounts.size(); i++) {
proto.write(PageTypeInfoProto::MigrateType::FREE_PAGES_COUNT, toInt(pageCounts[i]));
}
} else return BAD_VALUE;
@@ -125,4 +120,4 @@
fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
return NO_ERROR;
-}
\ No newline at end of file
+}
diff --git a/cmds/incident_helper/testdata/pagetypeinfo.txt b/cmds/incident_helper/testdata/pagetypeinfo.txt
index d45ddc4..c65b5a1 100644
--- a/cmds/incident_helper/testdata/pagetypeinfo.txt
+++ b/cmds/incident_helper/testdata/pagetypeinfo.txt
@@ -1,5 +1,5 @@
-Page block order: 10
-Pages per block: 1024
+Page block order: 9
+Pages per block: 512
Free pages count per migrate type at order 0 1 2 3 4 5 6 7 8 9 10
Node 0, zone DMA, type Unmovable 426 279 226 1 1 1 0 0 2 2 0
diff --git a/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp b/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp
index 9bad7be..5688681 100644
--- a/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp
+++ b/cmds/incident_helper/tests/PageTypeInfoParser_test.cpp
@@ -54,8 +54,8 @@
PageTypeInfoParser parser;
PageTypeInfoProto expected;
- expected.set_page_block_order(10);
- expected.set_pages_per_block(1024);
+ expected.set_page_block_order(9);
+ expected.set_pages_per_block(512);
PageTypeInfoProto::MigrateType* mt1 = expected.add_migrate_types();
mt1->set_node(0);
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 54d383a..b4e9ad1 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -1982,7 +1982,7 @@
String str = sa.getNonConfigurationString(
com.android.internal.R.styleable.AndroidManifest_sharedUserId, 0);
if (str != null && str.length() > 0) {
- String nameError = validateName(str, true, false);
+ String nameError = validateName(str, true, true);
if (nameError != null && !"android".equals(pkg.packageName)) {
outError[0] = "<manifest> specifies bad sharedUserId name \""
+ str + "\": " + nameError;
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 60e4ce2..d027fd9 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -1249,7 +1249,9 @@
* <p>If this device is the largest or only camera device with a given facing, then this
* position will be <code>(0, 0, 0)</code>; a camera device with a lens optical center located 3 cm
* from the main sensor along the +X axis (to the right from the user's perspective) will
- * report <code>(0.03, 0, 0)</code>.</p>
+ * report <code>(0.03, 0, 0)</code>. Note that this means that, for many computer vision
+ * applications, the position needs to be negated to convert it to a translation from the
+ * camera to the origin.</p>
* <p>To transform a pixel coordinates between two cameras facing the same direction, first
* the source camera {@link CameraCharacteristics#LENS_DISTORTION android.lens.distortion} must be corrected for. Then the source
* camera {@link CameraCharacteristics#LENS_INTRINSIC_CALIBRATION android.lens.intrinsicCalibration} needs to be applied, followed by the
@@ -1261,7 +1263,8 @@
* <p>To compare this against a real image from the destination camera, the destination camera
* image then needs to be corrected for radial distortion before comparison or sampling.</p>
* <p>When {@link CameraCharacteristics#LENS_POSE_REFERENCE android.lens.poseReference} is GYROSCOPE, then this position is relative to
- * the center of the primary gyroscope on the device.</p>
+ * the center of the primary gyroscope on the device. The axis definitions are the same as
+ * with PRIMARY_CAMERA.</p>
* <p><b>Units</b>: Meters</p>
* <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
*
@@ -1293,13 +1296,15 @@
* </code></pre>
* <p>which can then be combined with the camera pose rotation
* <code>R</code> and translation <code>t</code> ({@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation} and
- * {@link CameraCharacteristics#LENS_POSE_TRANSLATION android.lens.poseTranslation}, respective) to calculate the
+ * {@link CameraCharacteristics#LENS_POSE_TRANSLATION android.lens.poseTranslation}, respectively) to calculate the
* complete transform from world coordinates to pixel
* coordinates:</p>
- * <pre><code>P = [ K 0 * [ R t
- * 0 1 ] 0 1 ]
+ * <pre><code>P = [ K 0 * [ R -Rt
+ * 0 1 ] 0 1 ]
* </code></pre>
- * <p>and with <code>p_w</code> being a point in the world coordinate system
+ * <p>(Note the negation of poseTranslation when mapping from camera
+ * to world coordinates, and multiplication by the rotation).</p>
+ * <p>With <code>p_w</code> being a point in the world coordinate system
* and <code>p_s</code> being a point in the camera active pixel array
* coordinate system, and with the mapping including the
* homogeneous division by z:</p>
@@ -1321,6 +1326,13 @@
* activeArraySize rectangle), to determine the final pixel
* coordinate of the world point for processed (non-RAW)
* output buffers.</p>
+ * <p>For camera devices, the center of pixel <code>(x,y)</code> is located at
+ * coordinate <code>(x + 0.5, y + 0.5)</code>. So on a device with a
+ * precorrection active array of size <code>(10,10)</code>, the valid pixel
+ * indices go from <code>(0,0)-(9,9)</code>, and an perfectly-built camera would
+ * have an optical center at the exact center of the pixel grid, at
+ * coordinates <code>(5.0, 5.0)</code>, which is the top-left corner of pixel
+ * <code>(5,5)</code>.</p>
* <p><b>Units</b>:
* Pixels in the
* {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index aca77a5..0c3fe77 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -2522,7 +2522,7 @@
* outputs will crop horizontally (pillarbox), and 16:9
* streams will match exactly. These additional crops will
* be centered within the crop region.</p>
- * <p>If the coordinate system is android.sensor.info.activeArraysSize, the width and height
+ * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, the width and height
* of the crop region cannot be set to be smaller than
* <code>floor( activeArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> and
* <code>floor( activeArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, respectively.</p>
@@ -2863,8 +2863,14 @@
new Key<Integer>("android.statistics.lensShadingMapMode", int.class);
/**
- * <p>A control for selecting whether OIS position information is included in output
- * result metadata.</p>
+ * <p>A control for selecting whether optical stabilization (OIS) position
+ * information is included in output result metadata.</p>
+ * <p>Since optical image stabilization generally involves motion much faster than the duration
+ * of individualq image exposure, multiple OIS samples can be included for a single capture
+ * result. For example, if the OIS reporting operates at 200 Hz, a typical camera operating
+ * at 30fps may have 6-7 OIS samples per capture result. This information can be combined
+ * with the rolling shutter skew to account for lens motion during image exposure in
+ * post-processing algorithms.</p>
* <p><b>Possible values:</b>
* <ul>
* <li>{@link #STATISTICS_OIS_DATA_MODE_OFF OFF}</li>
@@ -3264,14 +3270,28 @@
* any correction at all would slow down capture rate. Every output stream will have a
* similar amount of enhancement applied.</p>
* <p>The correction only applies to processed outputs such as YUV, JPEG, or DEPTH16; it is not
- * applied to any RAW output. Metadata coordinates such as face rectangles or metering
- * regions are also not affected by correction.</p>
+ * applied to any RAW output.</p>
* <p>This control will be on by default on devices that support this control. Applications
* disabling distortion correction need to pay extra attention with the coordinate system of
* metering regions, crop region, and face rectangles. When distortion correction is OFF,
* metadata coordinates follow the coordinate system of
* {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}. When distortion is not OFF, metadata
- * coordinates follow the coordinate system of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p>
+ * coordinates follow the coordinate system of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}. The
+ * camera device will map these metadata fields to match the corrected image produced by the
+ * camera device, for both capture requests and results. However, this mapping is not very
+ * precise, since rectangles do not generally map to rectangles when corrected. Only linear
+ * scaling between the active array and precorrection active array coordinates is
+ * performed. Applications that require precise correction of metadata need to undo that
+ * linear scaling, and apply a more complete correction that takes into the account the app's
+ * own requirements.</p>
+ * <p>The full list of metadata that is affected in this way by distortion correction is:</p>
+ * <ul>
+ * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li>
+ * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li>
+ * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li>
+ * <li>{@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}</li>
+ * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li>
+ * </ul>
* <p><b>Possible values:</b>
* <ul>
* <li>{@link #DISTORTION_CORRECTION_MODE_OFF OFF}</li>
@@ -3282,10 +3302,15 @@
* {@link CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES android.distortionCorrection.availableModes}</p>
* <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
*
+ * @see CaptureRequest#CONTROL_AE_REGIONS
+ * @see CaptureRequest#CONTROL_AF_REGIONS
+ * @see CaptureRequest#CONTROL_AWB_REGIONS
* @see CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES
* @see CameraCharacteristics#LENS_DISTORTION
+ * @see CaptureRequest#SCALER_CROP_REGION
* @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
* @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
+ * @see CaptureResult#STATISTICS_FACES
* @see #DISTORTION_CORRECTION_MODE_OFF
* @see #DISTORTION_CORRECTION_MODE_FAST
* @see #DISTORTION_CORRECTION_MODE_HIGH_QUALITY
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index d003f9a..5836288 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -2852,7 +2852,9 @@
* <p>If this device is the largest or only camera device with a given facing, then this
* position will be <code>(0, 0, 0)</code>; a camera device with a lens optical center located 3 cm
* from the main sensor along the +X axis (to the right from the user's perspective) will
- * report <code>(0.03, 0, 0)</code>.</p>
+ * report <code>(0.03, 0, 0)</code>. Note that this means that, for many computer vision
+ * applications, the position needs to be negated to convert it to a translation from the
+ * camera to the origin.</p>
* <p>To transform a pixel coordinates between two cameras facing the same direction, first
* the source camera {@link CameraCharacteristics#LENS_DISTORTION android.lens.distortion} must be corrected for. Then the source
* camera {@link CameraCharacteristics#LENS_INTRINSIC_CALIBRATION android.lens.intrinsicCalibration} needs to be applied, followed by the
@@ -2864,7 +2866,8 @@
* <p>To compare this against a real image from the destination camera, the destination camera
* image then needs to be corrected for radial distortion before comparison or sampling.</p>
* <p>When {@link CameraCharacteristics#LENS_POSE_REFERENCE android.lens.poseReference} is GYROSCOPE, then this position is relative to
- * the center of the primary gyroscope on the device.</p>
+ * the center of the primary gyroscope on the device. The axis definitions are the same as
+ * with PRIMARY_CAMERA.</p>
* <p><b>Units</b>: Meters</p>
* <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
*
@@ -2896,13 +2899,15 @@
* </code></pre>
* <p>which can then be combined with the camera pose rotation
* <code>R</code> and translation <code>t</code> ({@link CameraCharacteristics#LENS_POSE_ROTATION android.lens.poseRotation} and
- * {@link CameraCharacteristics#LENS_POSE_TRANSLATION android.lens.poseTranslation}, respective) to calculate the
+ * {@link CameraCharacteristics#LENS_POSE_TRANSLATION android.lens.poseTranslation}, respectively) to calculate the
* complete transform from world coordinates to pixel
* coordinates:</p>
- * <pre><code>P = [ K 0 * [ R t
- * 0 1 ] 0 1 ]
+ * <pre><code>P = [ K 0 * [ R -Rt
+ * 0 1 ] 0 1 ]
* </code></pre>
- * <p>and with <code>p_w</code> being a point in the world coordinate system
+ * <p>(Note the negation of poseTranslation when mapping from camera
+ * to world coordinates, and multiplication by the rotation).</p>
+ * <p>With <code>p_w</code> being a point in the world coordinate system
* and <code>p_s</code> being a point in the camera active pixel array
* coordinate system, and with the mapping including the
* homogeneous division by z:</p>
@@ -2924,6 +2929,13 @@
* activeArraySize rectangle), to determine the final pixel
* coordinate of the world point for processed (non-RAW)
* output buffers.</p>
+ * <p>For camera devices, the center of pixel <code>(x,y)</code> is located at
+ * coordinate <code>(x + 0.5, y + 0.5)</code>. So on a device with a
+ * precorrection active array of size <code>(10,10)</code>, the valid pixel
+ * indices go from <code>(0,0)-(9,9)</code>, and an perfectly-built camera would
+ * have an optical center at the exact center of the pixel grid, at
+ * coordinates <code>(5.0, 5.0)</code>, which is the top-left corner of pixel
+ * <code>(5,5)</code>.</p>
* <p><b>Units</b>:
* Pixels in the
* {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}
@@ -3188,7 +3200,7 @@
* outputs will crop horizontally (pillarbox), and 16:9
* streams will match exactly. These additional crops will
* be centered within the crop region.</p>
- * <p>If the coordinate system is android.sensor.info.activeArraysSize, the width and height
+ * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, the width and height
* of the crop region cannot be set to be smaller than
* <code>floor( activeArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> and
* <code>floor( activeArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, respectively.</p>
@@ -4077,8 +4089,14 @@
new Key<Integer>("android.statistics.lensShadingMapMode", int.class);
/**
- * <p>A control for selecting whether OIS position information is included in output
- * result metadata.</p>
+ * <p>A control for selecting whether optical stabilization (OIS) position
+ * information is included in output result metadata.</p>
+ * <p>Since optical image stabilization generally involves motion much faster than the duration
+ * of individualq image exposure, multiple OIS samples can be included for a single capture
+ * result. For example, if the OIS reporting operates at 200 Hz, a typical camera operating
+ * at 30fps may have 6-7 OIS samples per capture result. This information can be combined
+ * with the rolling shutter skew to account for lens motion during image exposure in
+ * post-processing algorithms.</p>
* <p><b>Possible values:</b>
* <ul>
* <li>{@link #STATISTICS_OIS_DATA_MODE_OFF OFF}</li>
@@ -4112,11 +4130,15 @@
/**
* <p>An array of shifts of OIS samples, in x direction.</p>
* <p>The array contains the amount of shifts in x direction, in pixels, based on OIS samples.
- * A positive value is a shift from left to right in active array coordinate system. For
- * example, if the optical center is (1000, 500) in active array coordinates, a shift of
- * (3, 0) puts the new optical center at (1003, 500).</p>
+ * A positive value is a shift from left to right in the pre-correction active array
+ * coordinate system. For example, if the optical center is (1000, 500) in pre-correction
+ * active array coordinates, a shift of (3, 0) puts the new optical center at (1003, 500).</p>
* <p>The number of shifts must match the number of timestamps in
* android.statistics.oisTimestamps.</p>
+ * <p>The OIS samples are not affected by whether lens distortion correction is enabled (on
+ * supporting devices). They are always reported in pre-correction active array coordinates,
+ * since the scaling of OIS shifts would depend on the specific spot on the sensor the shift
+ * is needed.</p>
* <p><b>Units</b>: Pixels in active array.</p>
* <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
* @hide
@@ -4127,11 +4149,15 @@
/**
* <p>An array of shifts of OIS samples, in y direction.</p>
* <p>The array contains the amount of shifts in y direction, in pixels, based on OIS samples.
- * A positive value is a shift from top to bottom in active array coordinate system. For
- * example, if the optical center is (1000, 500) in active array coordinates, a shift of
- * (0, 5) puts the new optical center at (1000, 505).</p>
+ * A positive value is a shift from top to bottom in pre-correction active array coordinate
+ * system. For example, if the optical center is (1000, 500) in active array coordinates, a
+ * shift of (0, 5) puts the new optical center at (1000, 505).</p>
* <p>The number of shifts must match the number of timestamps in
* android.statistics.oisTimestamps.</p>
+ * <p>The OIS samples are not affected by whether lens distortion correction is enabled (on
+ * supporting devices). They are always reported in pre-correction active array coordinates,
+ * since the scaling of OIS shifts would depend on the specific spot on the sensor the shift
+ * is needed.</p>
* <p><b>Units</b>: Pixels in active array.</p>
* <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
* @hide
@@ -4140,15 +4166,21 @@
new Key<float[]>("android.statistics.oisYShifts", float[].class);
/**
- * <p>An array of OIS samples.</p>
+ * <p>An array of optical stabilization (OIS) position samples.</p>
* <p>Each OIS sample contains the timestamp and the amount of shifts in x and y direction,
* in pixels, of the OIS sample.</p>
- * <p>A positive value for a shift in x direction is a shift from left to right in active array
- * coordinate system. For example, if the optical center is (1000, 500) in active array
- * coordinates, a shift of (3, 0) puts the new optical center at (1003, 500).</p>
- * <p>A positive value for a shift in y direction is a shift from top to bottom in active array
- * coordinate system. For example, if the optical center is (1000, 500) in active array
- * coordinates, a shift of (0, 5) puts the new optical center at (1000, 505).</p>
+ * <p>A positive value for a shift in x direction is a shift from left to right in the
+ * pre-correction active array coordinate system. For example, if the optical center is
+ * (1000, 500) in pre-correction active array coordinates, a shift of (3, 0) puts the new
+ * optical center at (1003, 500).</p>
+ * <p>A positive value for a shift in y direction is a shift from top to bottom in
+ * pre-correction active array coordinate system. For example, if the optical center is
+ * (1000, 500) in active array coordinates, a shift of (0, 5) puts the new optical center at
+ * (1000, 505).</p>
+ * <p>The OIS samples are not affected by whether lens distortion correction is enabled (on
+ * supporting devices). They are always reported in pre-correction active array coordinates,
+ * since the scaling of OIS shifts would depend on the specific spot on the sensor the shift
+ * is needed.</p>
* <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
*/
@PublicKey
@@ -4578,14 +4610,28 @@
* any correction at all would slow down capture rate. Every output stream will have a
* similar amount of enhancement applied.</p>
* <p>The correction only applies to processed outputs such as YUV, JPEG, or DEPTH16; it is not
- * applied to any RAW output. Metadata coordinates such as face rectangles or metering
- * regions are also not affected by correction.</p>
+ * applied to any RAW output.</p>
* <p>This control will be on by default on devices that support this control. Applications
* disabling distortion correction need to pay extra attention with the coordinate system of
* metering regions, crop region, and face rectangles. When distortion correction is OFF,
* metadata coordinates follow the coordinate system of
* {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}. When distortion is not OFF, metadata
- * coordinates follow the coordinate system of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</p>
+ * coordinates follow the coordinate system of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}. The
+ * camera device will map these metadata fields to match the corrected image produced by the
+ * camera device, for both capture requests and results. However, this mapping is not very
+ * precise, since rectangles do not generally map to rectangles when corrected. Only linear
+ * scaling between the active array and precorrection active array coordinates is
+ * performed. Applications that require precise correction of metadata need to undo that
+ * linear scaling, and apply a more complete correction that takes into the account the app's
+ * own requirements.</p>
+ * <p>The full list of metadata that is affected in this way by distortion correction is:</p>
+ * <ul>
+ * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li>
+ * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li>
+ * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li>
+ * <li>{@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}</li>
+ * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li>
+ * </ul>
* <p><b>Possible values:</b>
* <ul>
* <li>{@link #DISTORTION_CORRECTION_MODE_OFF OFF}</li>
@@ -4596,10 +4642,15 @@
* {@link CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES android.distortionCorrection.availableModes}</p>
* <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
*
+ * @see CaptureRequest#CONTROL_AE_REGIONS
+ * @see CaptureRequest#CONTROL_AF_REGIONS
+ * @see CaptureRequest#CONTROL_AWB_REGIONS
* @see CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES
* @see CameraCharacteristics#LENS_DISTORTION
+ * @see CaptureRequest#SCALER_CROP_REGION
* @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
* @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
+ * @see CaptureResult#STATISTICS_FACES
* @see #DISTORTION_CORRECTION_MODE_OFF
* @see #DISTORTION_CORRECTION_MODE_FAST
* @see #DISTORTION_CORRECTION_MODE_HIGH_QUALITY
diff --git a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java
index 5423ca9..8822f71 100644
--- a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java
+++ b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java
@@ -781,6 +781,7 @@
CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE ,
CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE ,
CameraCharacteristics.SENSOR_INFO_PIXEL_ARRAY_SIZE ,
+ CameraCharacteristics.SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE ,
CameraCharacteristics.SENSOR_INFO_TIMESTAMP_SOURCE ,
CameraCharacteristics.SENSOR_ORIENTATION ,
CameraCharacteristics.STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES ,
@@ -941,11 +942,12 @@
// Use the largest jpeg size (by area) for both active array and pixel array
Size largestJpegSize = getLargestSupportedJpegSizeByArea(p);
/*
- * sensor.info.activeArraySize
+ * sensor.info.activeArraySize, and preCorrectionActiveArraySize
*/
{
Rect activeArrayRect = ParamsUtils.createRect(largestJpegSize);
m.set(SENSOR_INFO_ACTIVE_ARRAY_SIZE, activeArrayRect);
+ m.set(SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE, activeArrayRect);
}
/*
diff --git a/core/java/android/security/net/config/ManifestConfigSource.java b/core/java/android/security/net/config/ManifestConfigSource.java
index 79115a5..b885e72 100644
--- a/core/java/android/security/net/config/ManifestConfigSource.java
+++ b/core/java/android/security/net/config/ManifestConfigSource.java
@@ -75,7 +75,7 @@
// should use the network security config.
boolean usesCleartextTraffic =
(mApplicationInfo.flags & ApplicationInfo.FLAG_USES_CLEARTEXT_TRAFFIC) != 0
- && mApplicationInfo.targetSandboxVersion < 2;
+ && !mApplicationInfo.isInstantApp();
source = new DefaultConfigSource(usesCleartextTraffic, mApplicationInfo);
}
mConfigSource = source;
diff --git a/core/java/android/security/net/config/NetworkSecurityConfig.java b/core/java/android/security/net/config/NetworkSecurityConfig.java
index 52f48ef..57068fa 100644
--- a/core/java/android/security/net/config/NetworkSecurityConfig.java
+++ b/core/java/android/security/net/config/NetworkSecurityConfig.java
@@ -185,7 +185,7 @@
.addCertificatesEntryRef(
new CertificatesEntryRef(SystemCertificateSource.getInstance(), false));
final boolean cleartextTrafficPermitted = info.targetSdkVersion < Build.VERSION_CODES.P
- && info.targetSandboxVersion < 2;
+ && !info.isInstantApp();
builder.setCleartextTrafficPermitted(cleartextTrafficPermitted);
// Applications targeting N and above must opt in into trusting the user added certificate
// store.
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 78e4204..b9f9e5e 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -854,7 +854,7 @@
}
/**
- * Set an observer to collect frame stats for each frame rendererd in this window.
+ * Set an observer to collect frame stats for each frame rendered in this window.
*
* Must be in hardware rendering mode.
*/
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 4c96c1b..74663c9 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -1358,7 +1358,10 @@
<!-- Specifies the target sandbox this app wants to use. Higher sandbox versions
will have increasing levels of security.
- <p>The default value of this attribute is <code>1</code>. -->
+ <p>The default value of this attribute is <code>1</code>.
+ <p>
+ @deprecated The security properties have been moved to
+ {@link android.os.Build.VERSION Build.VERSION} 27 and 28. -->
<attr name="targetSandboxVersion" format="integer" />
<!-- The user-visible SDK version (ex. 26) of the framework against which the application was
diff --git a/core/tests/benchmarks/src/android/content/res/ResourcesBenchmark.java b/core/tests/benchmarks/src/android/content/res/ResourcesBenchmark.java
deleted file mode 100644
index 426b0dc..0000000
--- a/core/tests/benchmarks/src/android/content/res/ResourcesBenchmark.java
+++ /dev/null
@@ -1,86 +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.
- */
-
-package android.content.res;
-
-import android.util.AttributeSet;
-import android.util.Xml;
-
-import com.android.internal.R;
-
-import org.xmlpull.v1.XmlPullParser;
-
-import com.google.caliper.AfterExperiment;
-import com.google.caliper.BeforeExperiment;
-
-public class ResourcesBenchmark {
-
- private AssetManager mAsset;
- private Resources mRes;
-
- private int mTextId;
- private int mColorId;
- private int mIntegerId;
- private int mLayoutId;
-
- @BeforeExperiment
- protected void setUp() {
- mAsset = new AssetManager();
- mAsset.addAssetPath("/system/framework/framework-res.apk");
- mRes = new Resources(mAsset, null, null);
-
- mTextId = mRes.getIdentifier("cancel", "string", "android");
- mColorId = mRes.getIdentifier("transparent", "color", "android");
- mIntegerId = mRes.getIdentifier("config_shortAnimTime", "integer", "android");
- mLayoutId = mRes.getIdentifier("two_line_list_item", "layout", "android");
- }
-
- @AfterExperiment
- protected void tearDown() {
- mAsset.close();
- }
-
- public void timeGetString(int reps) {
- for (int i = 0; i < reps; i++) {
- mRes.getText(mTextId);
- }
- }
-
- public void timeGetColor(int reps) {
- for (int i = 0; i < reps; i++) {
- mRes.getColor(mColorId, null);
- }
- }
-
- public void timeGetInteger(int reps) {
- for (int i = 0; i < reps; i++) {
- mRes.getInteger(mIntegerId);
- }
- }
-
- public void timeGetLayoutAndTraverse(int reps) throws Exception {
- for (int i = 0; i < reps; i++) {
- final XmlResourceParser parser = mRes.getLayout(mLayoutId);
- try {
- while (parser.next() != XmlPullParser.END_DOCUMENT) {
- // Walk the entire tree
- }
- } finally {
- parser.close();
- }
- }
- }
-}
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index 040601c..7325b85 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -2033,7 +2033,7 @@
if (fillColors instanceof GradientColor) {
mFillColors = fillColors;
fillGradient = ((GradientColor) fillColors).getShader();
- } else if (fillColors.isStateful()) {
+ } else if (fillColors.isStateful() || fillColors.canApplyTheme()) {
mFillColors = fillColors;
} else {
mFillColors = null;
@@ -2049,7 +2049,7 @@
if (strokeColors instanceof GradientColor) {
mStrokeColors = strokeColors;
strokeGradient = ((GradientColor) strokeColors).getShader();
- } else if (strokeColors.isStateful()) {
+ } else if (strokeColors.isStateful() || strokeColors.canApplyTheme()) {
mStrokeColors = strokeColors;
} else {
mStrokeColors = null;
diff --git a/packages/CarSystemUI/res/layout/car_top_navigation_bar.xml b/packages/CarSystemUI/res/layout/car_top_navigation_bar.xml
index 55d50a0..7b3333e 100644
--- a/packages/CarSystemUI/res/layout/car_top_navigation_bar.xml
+++ b/packages/CarSystemUI/res/layout/car_top_navigation_bar.xml
@@ -54,7 +54,7 @@
android:gravity="center_vertical|start"
android:minEms="4"
android:textAppearance="@style/TextAppearance.Car.Status"
- systemui:hvacAreaId="1"
+ systemui:hvacAreaId="49"
systemui:hvacMaxText="@string/hvac_max_text"
systemui:hvacMaxValue="@dimen/hvac_max_value"
systemui:hvacMinText="@string/hvac_min_text"
@@ -136,7 +136,7 @@
android:gravity="center_vertical|end"
android:minEms="4"
android:textAppearance="@style/TextAppearance.Car.Status"
- systemui:hvacAreaId="4"
+ systemui:hvacAreaId="68"
systemui:hvacMaxText="@string/hvac_max_text"
systemui:hvacMaxValue="@dimen/hvac_max_value"
systemui:hvacMinText="@string/hvac_min_text"
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/DashboardCategory.java b/packages/SettingsLib/src/com/android/settingslib/drawer/DashboardCategory.java
index 2e0a94c..cb21f87 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/DashboardCategory.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/DashboardCategory.java
@@ -31,19 +31,26 @@
/**
* Key used for placing external tiles.
*/
- public String key;
+ public final String key;
/**
* List of the category's children
*/
private List<Tile> mTiles = new ArrayList<>();
- public DashboardCategory() {
- // Empty
+ public DashboardCategory(String key) {
+ this.key = key;
}
DashboardCategory(Parcel in) {
- readFromParcel(in);
+ key = in.readString();
+
+ final int count = in.readInt();
+
+ for (int n = 0; n < count; n++) {
+ Tile tile = Tile.CREATOR.createFromParcel(in);
+ mTiles.add(tile);
+ }
}
/**
@@ -128,18 +135,6 @@
}
}
- public void readFromParcel(Parcel in) {
- key = in.readString();
-
- final int count = in.readInt();
-
- for (int n = 0; n < count; n++) {
- Tile tile = Tile.CREATOR.createFromParcel(in);
- mTiles.add(tile);
- }
- }
-
-
public static final Creator<DashboardCategory> CREATOR = new Creator<DashboardCategory>() {
public DashboardCategory createFromParcel(Parcel source) {
return new DashboardCategory(source);
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/Tile.java b/packages/SettingsLib/src/com/android/settingslib/drawer/Tile.java
index 18f94b7..3320433 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/Tile.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/Tile.java
@@ -60,12 +60,6 @@
public CharSequence summary;
/**
- * Whether the icon can be tinted. This should be set to true for monochrome (single-color)
- * icons that can be tinted to match the design.
- */
- public boolean isIconTintable;
-
- /**
* Intent to launch when the preference is selected.
*/
public Intent intent;
@@ -75,10 +69,7 @@
*/
public ArrayList<UserHandle> userHandle = new ArrayList<>();
- /**
- * Category in which the tile should be placed.
- */
- public String category;
+ private String mCategory;
/**
* Priority of the intent filter that created this tile, used for display ordering.
@@ -88,22 +79,23 @@
/**
* The metaData from the activity that defines this tile.
*/
- public Bundle metaData;
+ private Bundle mMetaData;
/**
* Optional key to use for this tile.
*/
public String key;
-
private final String mActivityPackage;
private final String mActivityName;
private ActivityInfo mActivityInfo;
- public Tile(ActivityInfo activityInfo) {
+ public Tile(ActivityInfo activityInfo, String category) {
mActivityInfo = activityInfo;
mActivityPackage = mActivityInfo.packageName;
mActivityName = mActivityInfo.name;
+ mMetaData = activityInfo.metaData;
+ mCategory = category;
}
@Override
@@ -128,11 +120,32 @@
for (int i = 0; i < N; i++) {
userHandle.get(i).writeToParcel(dest, flags);
}
- dest.writeString(category);
+ dest.writeString(mCategory);
dest.writeInt(priority);
- dest.writeBundle(metaData);
+ dest.writeBundle(mMetaData);
dest.writeString(key);
- dest.writeBoolean(isIconTintable);
+ }
+
+ /**
+ * Category in which the tile should be placed.
+ */
+ public String getCategory() {
+ return mCategory;
+ }
+
+ public void setCategory(String newCategoryKey) {
+ mCategory = newCategoryKey;
+ }
+
+ /**
+ * Priority of the intent filter that created this tile, used for display ordering.
+ */
+ public int getPriority() {
+ return 0;
+ }
+
+ public Bundle getMetaData() {
+ return mMetaData;
}
/**
@@ -141,17 +154,17 @@
* @attr ref android.R.styleable#PreferenceHeader_icon
*/
public Icon getIcon(Context context) {
- if (context == null || metaData == null) {
+ if (context == null || mMetaData == null) {
return null;
}
- int iconResId = metaData.getInt(META_DATA_PREFERENCE_ICON);
+ int iconResId = mMetaData.getInt(META_DATA_PREFERENCE_ICON);
// Set the icon
if (iconResId == 0) {
// Only fallback to activityinfo.icon if metadata does not contain ICON_URI.
// ICON_URI should be loaded in app UI when need the icon object. Handling IPC at this
// level is too complex because we don't have a strong threading contract for this class
- if (!metaData.containsKey(META_DATA_PREFERENCE_ICON_URI)) {
+ if (!mMetaData.containsKey(META_DATA_PREFERENCE_ICON_URI)) {
iconResId = getActivityInfo(context).icon;
}
}
@@ -162,6 +175,21 @@
}
}
+ /**
+ * Whether the icon can be tinted. This is true when icon needs to be monochrome (single-color)
+ */
+ public boolean isIconTintable(Context context) {
+ if (mMetaData != null
+ && mMetaData.containsKey(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE)) {
+ return mMetaData.getBoolean(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE);
+ }
+ final String pkgName = context.getPackageName();
+ // If this drawable is coming from outside Settings, tint it to match the color.
+ final ActivityInfo activityInfo = getActivityInfo(context);
+ return activityInfo != null
+ && !TextUtils.equals(pkgName, activityInfo.packageName);
+ }
+
Tile(Parcel in) {
mActivityPackage = in.readString();
mActivityName = in.readString();
@@ -174,11 +202,10 @@
for (int i = 0; i < N; i++) {
userHandle.add(UserHandle.CREATOR.createFromParcel(in));
}
- category = in.readString();
+ mCategory = in.readString();
priority = in.readInt();
- metaData = in.readBundle();
+ mMetaData = in.readBundle();
key = in.readString();
- isIconTintable = in.readBoolean();
}
private ActivityInfo getActivityInfo(Context context) {
@@ -205,8 +232,8 @@
};
public boolean isPrimaryProfileOnly() {
- String profile = metaData != null ?
- metaData.getString(META_DATA_KEY_PROFILE) : PROFILE_ALL;
+ String profile = mMetaData != null ?
+ mMetaData.getString(META_DATA_KEY_PROFILE) : PROFILE_ALL;
profile = (profile != null ? profile : PROFILE_ALL);
return TextUtils.equals(profile, PROFILE_PRIMARY);
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java b/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java
index 6b9a08e..7b54fe1 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/TileUtils.java
@@ -228,16 +228,16 @@
HashMap<String, DashboardCategory> categoryMap = new HashMap<>();
for (Tile tile : tiles) {
- DashboardCategory category = categoryMap.get(tile.category);
+ final String categoryKey = tile.getCategory();
+ DashboardCategory category = categoryMap.get(categoryKey);
if (category == null) {
- category = new DashboardCategory();
- category.key = tile.category;
+ category = new DashboardCategory(categoryKey);
if (category == null) {
- Log.w(LOG_TAG, "Couldn't find category " + tile.category);
+ Log.w(LOG_TAG, "Couldn't find category " + categoryKey);
continue;
}
- categoryMap.put(category.key, category);
+ categoryMap.put(categoryKey, category);
}
category.addTile(tile);
}
@@ -269,13 +269,13 @@
intent.setPackage(SETTING_PKG);
}
getTilesForIntent(context, user, intent, addedCache, defaultCategory, outTiles,
- usePriority, true);
+ usePriority);
}
public static void getTilesForIntent(
Context context, UserHandle user, Intent intent,
Map<Pair<String, String>, Tile> addedCache, String defaultCategory, List<Tile> outTiles,
- boolean usePriority, boolean checkCategory) {
+ boolean usePriority) {
PackageManager pm = context.getPackageManager();
List<ResolveInfo> results = pm.queryIntentActivitiesAsUser(intent,
PackageManager.GET_META_DATA, user.getIdentifier());
@@ -289,7 +289,7 @@
String categoryKey = defaultCategory;
// Load category
- if (checkCategory && ((metaData == null) || !metaData.containsKey(EXTRA_CATEGORY_KEY))
+ if ((metaData == null || !metaData.containsKey(EXTRA_CATEGORY_KEY))
&& categoryKey == null) {
Log.w(LOG_TAG, "Found " + resolved.activityInfo.name + " for intent "
+ intent + " missing metadata "
@@ -302,12 +302,10 @@
Pair<String, String> key = new Pair<>(activityInfo.packageName, activityInfo.name);
Tile tile = addedCache.get(key);
if (tile == null) {
- tile = new Tile(activityInfo);
+ tile = new Tile(activityInfo, categoryKey);
tile.intent = new Intent().setClassName(
activityInfo.packageName, activityInfo.name);
- tile.category = categoryKey;
tile.priority = usePriority ? resolved.priority : 0;
- tile.metaData = activityInfo.metaData;
updateTileData(context, tile, activityInfo, activityInfo.applicationInfo, pm);
if (DEBUG) Log.d(LOG_TAG, "Adding tile " + tile.title);
addedCache.put(key, tile);
@@ -325,31 +323,16 @@
private static boolean updateTileData(Context context, Tile tile,
ActivityInfo activityInfo, ApplicationInfo applicationInfo, PackageManager pm) {
if (applicationInfo.isSystemApp()) {
- boolean forceTintIcon = false;
CharSequence title = null;
String summary = null;
String keyHint = null;
- boolean isIconTintable = false;
// Get the activity's meta-data
try {
Resources res = pm.getResourcesForApplication(applicationInfo.packageName);
Bundle metaData = activityInfo.metaData;
- if (!context.getPackageName().equals(applicationInfo.packageName)) {
- isIconTintable = true;
- forceTintIcon = true;
- }
-
if (res != null && metaData != null) {
- if (metaData.containsKey(META_DATA_PREFERENCE_ICON_TINTABLE)) {
- if (forceTintIcon) {
- Log.w(LOG_TAG, "Ignoring icon tintable for " + activityInfo);
- } else {
- isIconTintable =
- metaData.getBoolean(META_DATA_PREFERENCE_ICON_TINTABLE);
- }
- }
if (metaData.containsKey(META_DATA_PREFERENCE_TITLE)) {
if (metaData.get(META_DATA_PREFERENCE_TITLE) instanceof Integer) {
title = res.getString(metaData.getInt(META_DATA_PREFERENCE_TITLE));
@@ -390,7 +373,6 @@
activityInfo.name);
// Suggest a key for this tile
tile.key = keyHint;
- tile.isIconTintable = isIconTintable;
return true;
}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileTest.java
index a9e5aae..d959657 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileTest.java
@@ -31,19 +31,19 @@
mActivityInfo = new ActivityInfo();
mActivityInfo.packageName = RuntimeEnvironment.application.getPackageName();
mActivityInfo.icon = R.drawable.ic_plus;
- mTile = new Tile(mActivityInfo);
- mTile.metaData = new Bundle();
+ mActivityInfo.metaData = new Bundle();
+ mTile = new Tile(mActivityInfo, "category");
}
@Test
public void isPrimaryProfileOnly_profilePrimary_shouldReturnTrue() {
- mTile.metaData.putString(META_DATA_KEY_PROFILE, PROFILE_PRIMARY);
+ mActivityInfo.metaData.putString(META_DATA_KEY_PROFILE, PROFILE_PRIMARY);
assertThat(mTile.isPrimaryProfileOnly()).isTrue();
}
@Test
public void isPrimaryProfileOnly_profileAll_shouldReturnFalse() {
- mTile.metaData.putString(META_DATA_KEY_PROFILE, PROFILE_ALL);
+ mActivityInfo.metaData.putString(META_DATA_KEY_PROFILE, PROFILE_ALL);
assertThat(mTile.isPrimaryProfileOnly()).isFalse();
}
@@ -54,27 +54,27 @@
@Test
public void isPrimaryProfileOnly_nullMetadata_shouldReturnFalse() {
- mTile.metaData = null;
+ mActivityInfo.metaData = null;
assertThat(mTile.isPrimaryProfileOnly()).isFalse();
}
@Test
public void getIcon_noContextOrMetadata_returnNull() {
- final Tile tile = new Tile(new ActivityInfo());
+ final Tile tile = new Tile(new ActivityInfo(), "category");
assertThat(tile.getIcon(null)).isNull();
assertThat(tile.getIcon(RuntimeEnvironment.application)).isNull();
}
@Test
public void getIcon_providedByUri_returnNull() {
- mTile.metaData.putString(META_DATA_PREFERENCE_ICON_URI, "content://foobar/icon");
+ mActivityInfo.metaData.putString(META_DATA_PREFERENCE_ICON_URI, "content://foobar/icon");
assertThat(mTile.getIcon(RuntimeEnvironment.application)).isNull();
}
@Test
public void getIcon_hasIconMetadata_returnIcon() {
- mTile.metaData.putInt(META_DATA_PREFERENCE_ICON, R.drawable.ic_info);
+ mActivityInfo.metaData.putInt(META_DATA_PREFERENCE_ICON, R.drawable.ic_info);
assertThat(mTile.getIcon(RuntimeEnvironment.application).getResId())
.isEqualTo(R.drawable.ic_info);
@@ -82,9 +82,39 @@
@Test
public void getIcon_noIconMetadata_returnActivityIcon() {
- mTile.metaData.putInt(META_DATA_PREFERENCE_ICON, 0);
+ mActivityInfo.metaData.putInt(META_DATA_PREFERENCE_ICON, 0);
assertThat(mTile.getIcon(RuntimeEnvironment.application).getResId())
.isEqualTo(mActivityInfo.icon);
}
+
+ @Test
+ public void isIconTintable_hasMetadata_shouldReturnIconTintableMetadata() {
+ final Tile tile = new Tile(mActivityInfo, "category");
+
+ mActivityInfo.metaData.putBoolean(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE, false);
+ assertThat(tile.isIconTintable(RuntimeEnvironment.application)).isFalse();
+
+ mActivityInfo.metaData.putBoolean(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE, true);
+ assertThat(tile.isIconTintable(RuntimeEnvironment.application)).isTrue();
+ }
+
+ @Test
+ public void isIconTintable_noIcon_shouldReturnFalse() {
+ final Tile tile = new Tile(mActivityInfo, "category");
+
+ assertThat(tile.isIconTintable(RuntimeEnvironment.application)).isFalse();
+ }
+
+ @Test
+ public void isIconTintable_noMetadata_shouldReturnPackageNameCheck() {
+ final Tile tile1 = new Tile(mActivityInfo, "category");
+ assertThat(tile1.isIconTintable(RuntimeEnvironment.application)).isFalse();
+
+ final ActivityInfo activityInfo = new ActivityInfo();
+ activityInfo.packageName = "blah";
+
+ final Tile tile2 = new Tile(activityInfo, "category");
+ assertThat(tile2.isIconTintable(RuntimeEnvironment.application)).isTrue();
+ }
}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileUtilsTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileUtilsTest.java
index 0b6acde..9fda8564 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileUtilsTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/drawer/TileUtilsTest.java
@@ -108,11 +108,10 @@
.thenReturn(info);
TileUtils.getTilesForIntent(mContext, UserHandle.CURRENT, intent, addedCache,
- null /* defaultCategory */, outTiles, false /* usePriority */,
- false /* checkCategory */);
+ null /* defaultCategory */, outTiles, false /* usePriority */);
assertThat(outTiles.size()).isEqualTo(1);
- assertThat(outTiles.get(0).category).isEqualTo(testCategory);
+ assertThat(outTiles.get(0).getCategory()).isEqualTo(testCategory);
}
@Test
@@ -129,8 +128,7 @@
.thenReturn(info);
TileUtils.getTilesForIntent(mContext, UserHandle.CURRENT, intent, addedCache,
- null /* defaultCategory */, outTiles, false /* usePriority */,
- false /* checkCategory */);
+ null /* defaultCategory */, outTiles, false /* usePriority */);
assertThat(outTiles.size()).isEqualTo(1);
assertThat(outTiles.get(0).key).isEqualTo(keyHint);
@@ -149,8 +147,7 @@
.thenReturn(info);
TileUtils.getTilesForIntent(mContext, UserHandle.CURRENT, intent, addedCache,
- null /* defaultCategory */, outTiles, false /* usePriority */,
- false /* checkCategory */);
+ null /* defaultCategory */, outTiles, false /* usePriority */);
assertThat(outTiles.isEmpty()).isTrue();
}
@@ -173,7 +170,7 @@
.thenReturn(info);
List<DashboardCategory> categoryList = TileUtils.getCategories(mContext, cache, testAction);
- assertThat(categoryList.get(0).getTile(0).category).isEqualTo(testCategory);
+ assertThat(categoryList.get(0).getTile(0).getCategory()).isEqualTo(testCategory);
}
@Test
@@ -209,8 +206,7 @@
.thenReturn(info);
TileUtils.getTilesForIntent(mContext, UserHandle.CURRENT, intent, addedCache,
- null /* defaultCategory */, outTiles, false /* usePriority */,
- false /* checkCategory */);
+ null /* defaultCategory */, outTiles, false /* usePriority */);
assertThat(outTiles.size()).isEqualTo(1);
assertThat(outTiles.get(0).title).isEqualTo("my title");
@@ -233,15 +229,13 @@
.thenReturn("my localized title");
TileUtils.getTilesForIntent(mContext, UserHandle.CURRENT, intent, addedCache,
- null /* defaultCategory */, outTiles, false /* usePriority */,
- false /* checkCategory */);
-
+ null /* defaultCategory */, outTiles, false /* usePriority */);
assertThat(outTiles.size()).isEqualTo(1);
assertThat(outTiles.get(0).title).isEqualTo("my localized title");
// Icon should be tintable because the tile is not from settings package, and
// "forceTintExternalIcon" is set
- assertThat(outTiles.get(0).isIconTintable).isTrue();
+ assertThat(outTiles.get(0).isIconTintable(mContext)).isTrue();
}
@Test
@@ -260,11 +254,9 @@
.thenReturn(info);
TileUtils.getTilesForIntent(mContext, UserHandle.CURRENT, intent, addedCache,
- null /* defaultCategory */, outTiles, false /* usePriority */,
- false /* checkCategory */);
+ null /* defaultCategory */, outTiles, false /* usePriority */);
- assertThat(outTiles.size()).isEqualTo(1);
- assertThat(outTiles.get(0).isIconTintable).isFalse();
+ assertThat(outTiles.get(0).isIconTintable(mContext)).isFalse();
}
@Test
@@ -283,11 +275,9 @@
.thenReturn(info);
TileUtils.getTilesForIntent(mContext, UserHandle.CURRENT, intent, addedCache,
- null /* defaultCategory */, outTiles, false /* usePriority */,
- false /* checkCategory */);
+ null /* defaultCategory */, outTiles, false /* usePriority */);
- assertThat(outTiles.size()).isEqualTo(1);
- assertThat(outTiles.get(0).isIconTintable).isTrue();
+ assertThat(outTiles.get(0).isIconTintable(mContext)).isTrue();
}
@Test
@@ -305,8 +295,7 @@
// Case 1: No provider associated with the uri specified.
TileUtils.getTilesForIntent(mContext, UserHandle.CURRENT, intent, addedCache,
- null /* defaultCategory */, outTiles, false /* usePriority */,
- false /* checkCategory */);
+ null /* defaultCategory */, outTiles, false /* usePriority */);
assertThat(outTiles.size()).isEqualTo(1);
assertThat(outTiles.get(0).getIcon(mContext).getResId()).isEqualTo(314159);
@@ -323,8 +312,7 @@
.thenReturn(mIContentProvider);
TileUtils.getTilesForIntent(mContext, UserHandle.CURRENT, intent, addedCache,
- null /* defaultCategory */, outTiles, false /* usePriority */,
- false /* checkCategory */);
+ null /* defaultCategory */, outTiles, false /* usePriority */);
assertThat(outTiles.size()).isEqualTo(1);
assertThat(outTiles.get(0).getIcon(mContext).getResId()).isEqualTo(314159);
@@ -345,8 +333,7 @@
.thenReturn(info);
TileUtils.getTilesForIntent(mContext, UserHandle.CURRENT, intent, addedCache,
- null /* defaultCategory */, outTiles, false /* usePriority */,
- false /* checkCategory */);
+ null /* defaultCategory */, outTiles, false /* usePriority */);
assertThat(outTiles.size()).isEqualTo(1);
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
index f13f489..f1b7eec 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
@@ -55,7 +55,6 @@
private Scroller mScroller;
private AnimatorSet mBounceAnimatorSet;
- private int mAnimatingToPage = -1;
private float mLastExpansion;
public PagedTileLayout(Context context, AttributeSet attrs) {
@@ -95,40 +94,16 @@
}
@Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- // Suppress all touch event during reveal animation.
- if (mAnimatingToPage != -1) {
- return true;
- }
- return super.onInterceptTouchEvent(ev);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- // Suppress all touch event during reveal animation.
- if (mAnimatingToPage != -1) {
- return true;
- }
- return super.onTouchEvent(ev);
- }
-
- @Override
public void computeScroll() {
if (!mScroller.isFinished() && mScroller.computeScrollOffset()) {
- scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
- float pageFraction = (float) getScrollX() / getWidth();
- int position = (int) pageFraction;
- float positionOffset = pageFraction - position;
- mOnPageChangeListener.onPageScrolled(position, positionOffset, getScrollX());
+ fakeDragBy(getScrollX() - mScroller.getCurrX());
// Keep on drawing until the animation has finished.
postInvalidateOnAnimation();
return;
- }
- if (mAnimatingToPage != -1) {
- setCurrentItem(mAnimatingToPage, true);
+ } else if (isFakeDragging()) {
+ endFakeDrag();
mBounceAnimatorSet.start();
setOffscreenPageLimit(1);
- mAnimatingToPage = -1;
}
super.computeScroll();
}
@@ -287,7 +262,7 @@
}
public void startTileReveal(Set<String> tileSpecs, final Runnable postAnimation) {
- if (tileSpecs.isEmpty() || mPages.size() < 2 || getScrollX() != 0) {
+ if (tileSpecs.isEmpty() || mPages.size() < 2 || getScrollX() != 0 || !beginFakeDrag()) {
// Do not start the reveal animation unless there are tiles to animate, multiple
// TilePages available and the user has not already started dragging.
return;
@@ -305,6 +280,7 @@
if (bounceAnims.isEmpty()) {
// All tileSpecs are on the first page. Nothing to do.
// TODO: potentially show a bounce animation for first page QS tiles
+ endFakeDrag();
return;
}
@@ -317,10 +293,10 @@
postAnimation.run();
}
});
- mAnimatingToPage = lastPageNumber;
- setOffscreenPageLimit(mAnimatingToPage); // Ensure the page to reveal has been inflated.
- mScroller.startScroll(getScrollX(), getScrollY(), getWidth() * mAnimatingToPage, 0,
- REVEAL_SCROLL_DURATION_MILLIS);
+ setOffscreenPageLimit(lastPageNumber); // Ensure the page to reveal has been inflated.
+ int dx = getWidth() * lastPageNumber;
+ mScroller.startScroll(getScrollX(), getScrollY(), isLayoutRtl() ? -dx : dx, 0,
+ REVEAL_SCROLL_DURATION_MILLIS);
postInvalidateOnAnimation();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java
index 894ea62..f48c3f5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ButtonDispatcher.java
@@ -134,6 +134,9 @@
((ButtonInterface) mViews.get(i)).setImageDrawable(mImageDrawable);
}
}
+ if (mImageDrawable != null) {
+ mImageDrawable.setCallback(mCurrentView);
+ }
}
public void setVisibility(int visibility) {
@@ -266,6 +269,9 @@
public void setCurrentView(View currentView) {
mCurrentView = currentView.findViewById(mId);
+ if (mImageDrawable != null) {
+ mImageDrawable.setCallback(mCurrentView);
+ }
}
public void setVertical(boolean vertical) {
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 9c0e110..acbb67c 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -701,6 +701,7 @@
public int addAccessibilityInteractionConnection(IWindow windowToken,
IAccessibilityInteractionConnection connection, String packageName,
int userId) throws RemoteException {
+ final int windowId;
synchronized (mLock) {
// We treat calls from a profile as if made by its parent as profiles
// share the accessibility state of the parent. The call below
@@ -713,7 +714,7 @@
packageName = mSecurityPolicy.resolveValidReportedPackageLocked(
packageName, UserHandle.getCallingAppId(), resolvedUserId);
- final int windowId = sNextWindowId++;
+ windowId = sNextWindowId++;
// If the window is from a process that runs across users such as
// the system UI or the system we add it to the global state that
// is shared across users.
@@ -741,8 +742,10 @@
+ " and token: " + windowToken.asBinder());
}
}
- return windowId;
}
+ WindowManagerInternal wm = LocalServices.getService(WindowManagerInternal.class);
+ wm.computeWindowsForAccessibility();
+ return windowId;
}
@Override
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 48d554c..a660040 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -3620,8 +3620,7 @@
mPendingStarts.remove(startSeq);
app.pendingStart = false;
forceStopPackageLocked(app.info.packageName, UserHandle.getAppId(app.uid),
- false, false, true, false, false,
- UserHandle.getUserId(app.userId), "start failure");
+ false, false, true, false, false, app.userId, "start failure");
}
}
});
@@ -3637,8 +3636,7 @@
Slog.e(TAG, "Failure starting process " + app.processName, e);
app.pendingStart = false;
forceStopPackageLocked(app.info.packageName, UserHandle.getAppId(app.uid),
- false, false, true, false, false,
- UserHandle.getUserId(app.userId), "start failure");
+ false, false, true, false, false, app.userId, "start failure");
}
return app.pid > 0;
}
@@ -6019,10 +6017,9 @@
}
// We deprecated Build.SERIAL and it is not accessible to
- // apps that target the v2 security sandbox and to apps that
- // target APIs higher than O MR1. Since access to the serial
+ // Instant Apps and target APIs higher than O MR1. Since access to the serial
// is now behind a permission we push down the value.
- final String buildSerial = (appInfo.targetSandboxVersion < 2
+ final String buildSerial = (!appInfo.isInstantApp()
&& appInfo.targetSdkVersion < Build.VERSION_CODES.P)
? sTheRealBuildSerial : Build.UNKNOWN;
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 3d6b3fb..bfa45e1 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -17293,13 +17293,6 @@
"Instant app package must target at least O");
return;
}
- if (pkg.applicationInfo.targetSandboxVersion != 2) {
- Slog.w(TAG, "Instant app package " + pkg.packageName
- + " does not target targetSandboxVersion 2");
- res.setError(INSTALL_FAILED_INSTANT_APP_INVALID,
- "Instant app package must use targetSandboxVersion 2");
- return;
- }
if (pkg.mSharedUserId != null) {
Slog.w(TAG, "Instant app package " + pkg.packageName
+ " may not declare sharedUserId.");
diff --git a/services/core/java/com/android/server/webkit/WebViewUpdater.java b/services/core/java/com/android/server/webkit/WebViewUpdater.java
index 3e72d981..f270715 100644
--- a/services/core/java/com/android/server/webkit/WebViewUpdater.java
+++ b/services/core/java/com/android/server/webkit/WebViewUpdater.java
@@ -504,20 +504,20 @@
private static boolean providerHasValidSignature(WebViewProviderInfo provider,
PackageInfo packageInfo, SystemInterface systemInterface) {
- if (systemInterface.systemIsDebuggable()) {
- return true;
- }
- // If no signature is declared, instead check whether the package is included in the
- // system.
- if (provider.signatures == null || provider.signatures.length == 0) {
- return packageInfo.applicationInfo.isSystemApp();
- }
+ // Skip checking signatures on debuggable builds, for development purposes.
+ if (systemInterface.systemIsDebuggable()) return true;
+
+ // Allow system apps to be valid providers regardless of signature.
+ if (packageInfo.applicationInfo.isSystemApp()) return true;
+
+ // We don't support packages with multiple signatures.
if (packageInfo.signatures.length != 1) return false;
- // Return whether the package signature matches any of the valid signatures
+ // If any of the declared signatures match the package signature, it's valid.
for (Signature signature : provider.signatures) {
if (signature.equals(packageInfo.signatures[0])) return true;
}
+
return false;
}
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index f0898c0..e449111 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -119,13 +119,13 @@
}
}
- public void performComputeChangedWindowsNotLocked() {
+ public void performComputeChangedWindowsNotLocked(boolean forceSend) {
WindowsForAccessibilityObserver observer = null;
synchronized (mService) {
observer = mWindowsForAccessibilityObserver;
}
if (observer != null) {
- observer.performComputeChangedWindowsNotLocked();
+ observer.performComputeChangedWindowsNotLocked(forceSend);
}
}
@@ -193,7 +193,7 @@
observer = mWindowsForAccessibilityObserver;
}
if (observer != null) {
- observer.performComputeChangedWindowsNotLocked();
+ observer.performComputeChangedWindowsNotLocked(false);
}
}
@@ -1011,12 +1011,12 @@
mHandler = new MyHandler(mService.mH.getLooper());
mRecurringAccessibilityEventsIntervalMillis = ViewConfiguration
.getSendRecurringAccessibilityEventsInterval();
- computeChangedWindows();
+ computeChangedWindows(true);
}
- public void performComputeChangedWindowsNotLocked() {
+ public void performComputeChangedWindowsNotLocked(boolean forceSend) {
mHandler.removeMessages(MyHandler.MESSAGE_COMPUTE_CHANGED_WINDOWS);
- computeChangedWindows();
+ computeChangedWindows(forceSend);
}
public void scheduleComputeChangedWindowsLocked() {
@@ -1026,7 +1026,12 @@
}
}
- public void computeChangedWindows() {
+ /**
+ * Check if windows have changed, and send them to the accessibilty subsystem if they have.
+ *
+ * @param forceSend Send the windows the accessibility even if they haven't changed.
+ */
+ public void computeChangedWindows(boolean forceSend) {
if (DEBUG) {
Slog.i(LOG_TAG, "computeChangedWindows()");
}
@@ -1171,36 +1176,38 @@
visibleWindows.clear();
addedWindows.clear();
- // We computed the windows and if they changed notify the client.
- if (mOldWindows.size() != windows.size()) {
- // Different size means something changed.
- windowsChanged = true;
- } else if (!mOldWindows.isEmpty() || !windows.isEmpty()) {
- // Since we always traverse windows from high to low layer
- // the old and new windows at the same index should be the
- // same, otherwise something changed.
- for (int i = 0; i < windowCount; i++) {
- WindowInfo oldWindow = mOldWindows.get(i);
- WindowInfo newWindow = windows.get(i);
- // We do not care for layer changes given the window
- // order does not change. This brings no new information
- // to the clients.
- if (windowChangedNoLayer(oldWindow, newWindow)) {
- windowsChanged = true;
- break;
+ if (!forceSend) {
+ // We computed the windows and if they changed notify the client.
+ if (mOldWindows.size() != windows.size()) {
+ // Different size means something changed.
+ windowsChanged = true;
+ } else if (!mOldWindows.isEmpty() || !windows.isEmpty()) {
+ // Since we always traverse windows from high to low layer
+ // the old and new windows at the same index should be the
+ // same, otherwise something changed.
+ for (int i = 0; i < windowCount; i++) {
+ WindowInfo oldWindow = mOldWindows.get(i);
+ WindowInfo newWindow = windows.get(i);
+ // We do not care for layer changes given the window
+ // order does not change. This brings no new information
+ // to the clients.
+ if (windowChangedNoLayer(oldWindow, newWindow)) {
+ windowsChanged = true;
+ break;
+ }
}
}
}
- if (windowsChanged) {
+ if (forceSend || windowsChanged) {
cacheWindows(windows);
}
}
// Now we do not hold the lock, so send the windows over.
- if (windowsChanged) {
+ if (forceSend || windowsChanged) {
if (DEBUG) {
- Log.i(LOG_TAG, "Windows changed:" + windows);
+ Log.i(LOG_TAG, "Windows changed or force sending:" + windows);
}
mCallback.onWindowsForAccessibilityChanged(windows);
} else {
@@ -1345,7 +1352,7 @@
public void handleMessage(Message message) {
switch (message.what) {
case MESSAGE_COMPUTE_CHANGED_WINDOWS: {
- computeChangedWindows();
+ computeChangedWindows(false);
} break;
}
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java
index 0c65518..90a763d 100644
--- a/services/core/java/com/android/server/wm/WindowManagerInternal.java
+++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java
@@ -410,7 +410,7 @@
public abstract boolean isDockedDividerResizing();
/**
- * Requests the window manager to recompute the windows for accessibility.
+ * Requests the window manager to resend the windows for accessibility.
*/
public abstract void computeWindowsForAccessibility();
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index ab735af..7441ab1 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -7422,7 +7422,7 @@
accessibilityController = mAccessibilityController;
}
if (accessibilityController != null) {
- accessibilityController.performComputeChangedWindowsNotLocked();
+ accessibilityController.performComputeChangedWindowsNotLocked(true);
}
}