Merge "Remove @Deprecated && @removed methods from DevicePolicyManager."
diff --git a/api/removed.txt b/api/removed.txt
index 3d750fb..7b1d241 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -95,10 +95,6 @@
package android.content.pm {
- public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
- field @Deprecated public String volumeUuid;
- }
-
public class PackageInfo implements android.os.Parcelable {
field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1
}
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 9bc5f80..f75cd23 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -783,8 +783,7 @@
*/
public float minAspectRatio;
- /** @removed */
- @Deprecated
+ /** @hide */
public String volumeUuid;
/**
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index ecd16dd..caa6a43 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -1554,7 +1554,10 @@
}
}
- public final static class HistoryItem implements Parcelable {
+ /**
+ * Battery history record.
+ */
+ public static final class HistoryItem {
public HistoryItem next;
// The time of this event in milliseconds, as per SystemClock.elapsedRealtime().
@@ -1789,16 +1792,10 @@
public HistoryItem() {
}
- public HistoryItem(long time, Parcel src) {
- this.time = time;
- numReadInts = 2;
+ public HistoryItem(Parcel src) {
readFromParcel(src);
}
- public int describeContents() {
- return 0;
- }
-
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(time);
int bat = (((int)cmd)&0xff)
@@ -1835,6 +1832,7 @@
public void readFromParcel(Parcel src) {
int start = src.dataPosition();
+ time = src.readLong();
int bat = src.readInt();
cmd = (byte)(bat&0xff);
batteryLevel = (byte)((bat>>8)&0xff);
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 4573084..88d0e85 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -3478,10 +3478,8 @@
if (deltaTimeToken < DELTA_TIME_ABS) {
cur.time += deltaTimeToken;
} else if (deltaTimeToken == DELTA_TIME_ABS) {
- cur.time = src.readLong();
- cur.numReadInts += 2;
- if (DEBUG) Slog.i(TAG, "READ DELTA: ABS time=" + cur.time);
cur.readFromParcel(src);
+ if (DEBUG) Slog.i(TAG, "READ DELTA: ABS time=" + cur.time);
return;
} else if (deltaTimeToken == DELTA_TIME_INT) {
int delta = src.readInt();
@@ -13459,9 +13457,8 @@
return;
}
mHistory = mHistoryEnd = mHistoryCache = null;
- long time;
- while (in.dataAvail() > 0 && (time=in.readLong()) >= 0) {
- HistoryItem rec = new HistoryItem(time, in);
+ while (in.dataAvail() > 0) {
+ HistoryItem rec = new HistoryItem(in);
addHistoryRecordLocked(rec);
}
}
diff --git a/core/jni/android_view_InputEventSender.cpp b/core/jni/android_view_InputEventSender.cpp
index 2542286..f90d1cf 100644
--- a/core/jni/android_view_InputEventSender.cpp
+++ b/core/jni/android_view_InputEventSender.cpp
@@ -141,6 +141,7 @@
event->getClassification(),
event->getXOffset(), event->getYOffset(),
event->getXPrecision(), event->getYPrecision(),
+ event->getRawXCursorPosition(), event->getRawYCursorPosition(),
event->getDownTime(), event->getHistoricalEventTime(i),
event->getPointerCount(), event->getPointerProperties(),
event->getHistoricalRawPointerCoords(0, i));
diff --git a/core/jni/android_view_MotionEvent.cpp b/core/jni/android_view_MotionEvent.cpp
index 50cff5c..8ddbe72 100644
--- a/core/jni/android_view_MotionEvent.cpp
+++ b/core/jni/android_view_MotionEvent.cpp
@@ -375,6 +375,7 @@
event->initialize(deviceId, source, displayId, action, 0, flags, edgeFlags, metaState,
buttonState, static_cast<MotionClassification>(classification),
xOffset, yOffset, xPrecision, yPrecision,
+ AMOTION_EVENT_INVALID_CURSOR_POSITION, AMOTION_EVENT_INVALID_CURSOR_POSITION,
downTimeNanos, eventTimeNanos, pointerCount, pointerProperties, rawPointerCoords);
return reinterpret_cast<jlong>(event);
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index dea8092..f25f93f 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -724,6 +724,10 @@
<!-- Allows an application to send SMS messages.
<p>Protection level: dangerous
+
+ <p> This is a hard restricted permission which cannot be held by an app until
+ the installer on record did not whitelist the permission. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
-->
<permission android:name="android.permission.SEND_SMS"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -734,6 +738,10 @@
<!-- Allows an application to receive SMS messages.
<p>Protection level: dangerous
+
+ <p> This is a hard restricted permission which cannot be held by an app until
+ the installer on record did not whitelist the permission. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
-->
<permission android:name="android.permission.RECEIVE_SMS"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -744,6 +752,10 @@
<!-- Allows an application to read SMS messages.
<p>Protection level: dangerous
+
+ <p> This is a hard restricted permission which cannot be held by an app until
+ the installer on record did not whitelist the permission. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
-->
<permission android:name="android.permission.READ_SMS"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -754,6 +766,10 @@
<!-- Allows an application to receive WAP push messages.
<p>Protection level: dangerous
+
+ <p> This is a hard restricted permission which cannot be held by an app until
+ the installer on record did not whitelist the permission. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
-->
<permission android:name="android.permission.RECEIVE_WAP_PUSH"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -763,7 +779,11 @@
android:protectionLevel="dangerous" />
<!-- Allows an application to monitor incoming MMS messages.
- <p>Protection level: dangerous
+ <p>Protection level: dangerous
+
+ <p> This is a hard restricted permission which cannot be held by an app until
+ the installer on record did not whitelist the permission. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
-->
<permission android:name="android.permission.RECEIVE_MMS"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -783,6 +803,11 @@
when the alert is first received, and to delay presenting the info
to the user until after the initial alert dialog is dismissed.
<p>Protection level: dangerous
+
+ <p> This is a hard restricted permission which cannot be held by an app until
+ the installer on record did not whitelist the permission. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
+
@hide Pending API council approval -->
<permission android:name="android.permission.READ_CELL_BROADCASTS"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -805,30 +830,35 @@
android:priority="900" />
<!-- Allows an application to read from external storage.
- <p>Any app that declares the {@link #WRITE_EXTERNAL_STORAGE} permission is implicitly
- granted this permission.</p>
- <p>This permission is enforced starting in API level 19. Before API level 19, this
- permission is not enforced and all apps still have access to read from external storage.
- You can test your app with the permission enforced by enabling <em>Protect USB
- storage</em> under Developer options in the Settings app on a device running Android 4.1 or
- higher.</p>
- <p>Also starting in API level 19, this permission is <em>not</em> required to
- read/write files in your application-specific directories returned by
- {@link android.content.Context#getExternalFilesDir} and
- {@link android.content.Context#getExternalCacheDir}.
- <p class="note"><strong>Note:</strong> If <em>both</em> your <a
- href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
- minSdkVersion}</a> and <a
- href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
- targetSdkVersion}</a> values are set to 3 or lower, the system implicitly
- grants your app this permission. If you don't need this permission, be sure your <a
- href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
- targetSdkVersion}</a> is 4 or higher.
- <p>Is this permission is not whitelisted for an app that targets an API level before
- {@link android.os.Build.VERSION_CODES#Q} this permission cannot be granted to apps.</p>
- <p>Is this permission is not whitelisted for an app that targets an API level
- {@link android.os.Build.VERSION_CODES#Q} or later the app will be forced into isolated storage.
- </p>
+ <p>Any app that declares the {@link #WRITE_EXTERNAL_STORAGE} permission is implicitly
+ granted this permission.</p>
+ <p>This permission is enforced starting in API level 19. Before API level 19, this
+ permission is not enforced and all apps still have access to read from external storage.
+ You can test your app with the permission enforced by enabling <em>Protect USB
+ storage</em> under Developer options in the Settings app on a device running Android 4.1 or
+ higher.</p>
+ <p>Also starting in API level 19, this permission is <em>not</em> required to
+ read/write files in your application-specific directories returned by
+ {@link android.content.Context#getExternalFilesDir} and
+ {@link android.content.Context#getExternalCacheDir}.
+ <p class="note"><strong>Note:</strong> If <em>both</em> your <a
+ href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+ minSdkVersion}</a> and <a
+ href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
+ targetSdkVersion}</a> values are set to 3 or lower, the system implicitly
+ grants your app this permission. If you don't need this permission, be sure your <a
+ href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
+ targetSdkVersion}</a> is 4 or higher.
+
+ <p> This is a soft restricted permission which cannot be held by an app it its
+ full form until the installer on record did not whitelist the permission.
+ Specifically, if the permission is whitelisted the holder app can access
+ external storage and the visual and aural media collections while if the
+ permission is not whitelisted the holder app can only access to the visual
+ and aural medial collections. Also the permission is immutably restricted
+ meaning that the whitelist state can be specified only at install time and
+ cannot change until the app is installed. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
-->
<permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -916,6 +946,10 @@
{@link #ACCESS_FINE_LOCATION}. Requesting this permission by itself doesn't give you
location access.
<p>Protection level: dangerous
+
+ <p> This is a hard restricted permission which cannot be held by an app until
+ the installer on record did not whitelist the permission. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
-->
<permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -958,6 +992,10 @@
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
targetSdkVersion}</a> is 16 or higher.</p>
<p>Protection level: dangerous
+
+ <p> This is a hard restricted permission which cannot be held by an app until
+ the installer on record did not whitelist the permission. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
-->
<permission android:name="android.permission.READ_CALL_LOG"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -978,6 +1016,10 @@
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
targetSdkVersion}</a> is 16 or higher.</p>
<p>Protection level: dangerous
+
+ <p> This is a hard restricted permission which cannot be held by an app until
+ the installer on record did not whitelist the permission. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
-->
<permission android:name="android.permission.WRITE_CALL_LOG"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -991,6 +1033,10 @@
abort the call altogether.
<p>Protection level: dangerous
+ <p> This is a hard restricted permission which cannot be held by an app until
+ the installer on record did not whitelist the permission. For more details see
+ {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
+
@deprecated Applications should use {@link android.telecom.CallRedirectionService} instead
of the {@link android.content.Intent#ACTION_NEW_OUTGOING_CALL} broadcast.
-->
diff --git a/media/java/android/media/MediaMetadataRetriever.java b/media/java/android/media/MediaMetadataRetriever.java
index 813e474..0346010 100644
--- a/media/java/android/media/MediaMetadataRetriever.java
+++ b/media/java/android/media/MediaMetadataRetriever.java
@@ -800,7 +800,7 @@
*/
public static final int METADATA_KEY_YEAR = 8;
/**
- * The metadata key to retrieve the playback duration of the data source.
+ * The metadata key to retrieve the playback duration (in ms) of the data source.
*/
public static final int METADATA_KEY_DURATION = 9;
/**
diff --git a/media/java/android/media/ThumbnailUtils.java b/media/java/android/media/ThumbnailUtils.java
index 534d63b..fb581b5 100644
--- a/media/java/android/media/ThumbnailUtils.java
+++ b/media/java/android/media/ThumbnailUtils.java
@@ -356,19 +356,21 @@
return ImageDecoder.decodeBitmap(ImageDecoder.createSource(raw), resizer);
}
- // Fall back to middle of video
final int width = Integer.parseInt(mmr.extractMetadata(METADATA_KEY_VIDEO_WIDTH));
final int height = Integer.parseInt(mmr.extractMetadata(METADATA_KEY_VIDEO_HEIGHT));
- final long duration = Long.parseLong(mmr.extractMetadata(METADATA_KEY_DURATION));
+ // Fall back to middle of video
+ // Note: METADATA_KEY_DURATION unit is in ms, not us.
+ final long thumbnailTimeUs =
+ Long.parseLong(mmr.extractMetadata(METADATA_KEY_DURATION)) * 1000 / 2;
// If we're okay with something larger than native format, just
// return a frame without up-scaling it
if (size.getWidth() > width && size.getHeight() > height) {
return Objects.requireNonNull(
- mmr.getFrameAtTime(duration / 2, OPTION_CLOSEST_SYNC));
+ mmr.getFrameAtTime(thumbnailTimeUs, OPTION_CLOSEST_SYNC));
} else {
return Objects.requireNonNull(
- mmr.getScaledFrameAtTime(duration / 2, OPTION_CLOSEST_SYNC,
+ mmr.getScaledFrameAtTime(thumbnailTimeUs, OPTION_CLOSEST_SYNC,
size.getWidth(), size.getHeight()));
}
} catch (RuntimeException e) {
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index a549870..7c24130 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -480,4 +480,10 @@
<!-- ThemePicker package name for overlaying icons. -->
<string name="themepicker_overlayable_package" translatable="false">com.android.wallpaper</string>
+ <!-- Default rounded corner curve (a Bezier). Must match (the curved path in) rounded.xml.
+ Note that while rounded.xml includes the entire path (including the horizontal and vertical
+ corner edges), this pulls out just the curve.
+ -->
+ <string name="config_rounded_mask" translatable="false">"M8,0C3.6,0,0,3.6,0,8"</string>
+
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/assist/ui/CircularCornerPathRenderer.java b/packages/SystemUI/src/com/android/systemui/assist/ui/CircularCornerPathRenderer.java
index 00346a3..e61e47a 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/ui/CircularCornerPathRenderer.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/ui/CircularCornerPathRenderer.java
@@ -16,6 +16,7 @@
package com.android.systemui.assist.ui;
+import android.content.Context;
import android.graphics.Path;
/**
@@ -29,12 +30,11 @@
private final int mWidth;
private final Path mPath = new Path();
- public CircularCornerPathRenderer(int cornerRadiusBottom, int cornerRadiusTop,
- int width, int height) {
- mCornerRadiusBottom = cornerRadiusBottom;
- mCornerRadiusTop = cornerRadiusTop;
- mHeight = height;
- mWidth = width;
+ public CircularCornerPathRenderer(Context context) {
+ mCornerRadiusBottom = DisplayUtils.getCornerRadiusBottom(context);
+ mCornerRadiusTop = DisplayUtils.getCornerRadiusTop(context);
+ mHeight = DisplayUtils.getHeight(context);
+ mWidth = DisplayUtils.getWidth(context);
}
@Override // CornerPathRenderer
diff --git a/packages/SystemUI/src/com/android/systemui/assist/ui/InvocationLightsView.java b/packages/SystemUI/src/com/android/systemui/assist/ui/InvocationLightsView.java
index 43e7045..bc782a7 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/ui/InvocationLightsView.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/ui/InvocationLightsView.java
@@ -247,13 +247,9 @@
* To render corners that aren't circular, override this method in a subclass.
*/
protected CornerPathRenderer createCornerPathRenderer(Context context) {
- int displayWidth = DisplayUtils.getWidth(context);
- int displayHeight = DisplayUtils.getHeight(context);
- int cornerRadiusBottom = DisplayUtils.getCornerRadiusBottom(context);
- int cornerRadiusTop = DisplayUtils.getCornerRadiusTop(context);
- return new CircularCornerPathRenderer(
- cornerRadiusBottom, cornerRadiusTop, displayWidth, displayHeight);
+ return new CircularCornerPathRenderer(context);
}
+
/**
* Receives an intensity from 0 (lightest) to 1 (darkest) and sets the handle color
* appropriately. Intention is to match the home handle color.
diff --git a/packages/SystemUI/src/com/android/systemui/assist/ui/PathSpecCornerPathRenderer.java b/packages/SystemUI/src/com/android/systemui/assist/ui/PathSpecCornerPathRenderer.java
new file mode 100644
index 0000000..2bad7fc
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/assist/ui/PathSpecCornerPathRenderer.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.assist.ui;
+
+import android.content.Context;
+import android.graphics.Matrix;
+import android.graphics.Path;
+import android.graphics.RectF;
+import android.util.Log;
+import android.util.PathParser;
+
+import com.android.systemui.R;
+
+/**
+ * Parses a path describing rounded corners from a string.
+ */
+public final class PathSpecCornerPathRenderer extends CornerPathRenderer {
+ private static final String TAG = "PathSpecCornerPathRenderer";
+
+ private final int mHeight;
+ private final int mWidth;
+ private final float mPathScale;
+ private final int mBottomCornerRadius;
+ private final int mTopCornerRadius;
+
+ private final Path mPath = new Path();
+ private final Path mRoundedPath;
+ private final Matrix mMatrix = new Matrix();
+
+ public PathSpecCornerPathRenderer(Context context) {
+ mWidth = DisplayUtils.getWidth(context);
+ mHeight = DisplayUtils.getHeight(context);
+
+ mBottomCornerRadius = DisplayUtils.getCornerRadiusBottom(context);
+ mTopCornerRadius = DisplayUtils.getCornerRadiusTop(context);
+
+ String pathData = context.getResources().getString(R.string.config_rounded_mask);
+ Path path = PathParser.createPathFromPathData(pathData);
+ if (path == null) {
+ Log.e(TAG, "No rounded corner path found!");
+ mRoundedPath = new Path();
+ } else {
+ mRoundedPath = path;
+
+ }
+
+ RectF bounds = new RectF();
+ mRoundedPath.computeBounds(bounds, true);
+
+ // we use this to scale the path such that the larger of its [width, height] is scaled to
+ // the corner radius (to account for asymmetric paths)
+ mPathScale = Math.min(
+ Math.abs(bounds.right - bounds.left),
+ Math.abs(bounds.top - bounds.bottom));
+ }
+
+ /**
+ * Scales and rotates each corner from the path specification to its correct position.
+ *
+ * Note: the rounded corners are passed in as the full shape (a curved triangle), but we only
+ * want the actual corner curve. Therefore we call getSegment to jump past the horizontal and
+ * vertical lines.
+ */
+ @Override
+ public Path getCornerPath(Corner corner) {
+ if (mRoundedPath.isEmpty()) {
+ return mRoundedPath;
+ }
+ int cornerRadius;
+ int rotateDegrees;
+ int translateX;
+ int translateY;
+ switch (corner) {
+ case TOP_LEFT:
+ cornerRadius = mTopCornerRadius;
+ rotateDegrees = 0;
+ translateX = 0;
+ translateY = 0;
+ break;
+ case TOP_RIGHT:
+ cornerRadius = mTopCornerRadius;
+ rotateDegrees = 90;
+ translateX = mWidth;
+ translateY = 0;
+ break;
+ case BOTTOM_RIGHT:
+ cornerRadius = mBottomCornerRadius;
+ rotateDegrees = 180;
+ translateX = mWidth;
+ translateY = mHeight;
+ break;
+ case BOTTOM_LEFT:
+ default:
+ cornerRadius = mBottomCornerRadius;
+ rotateDegrees = 270;
+ translateX = 0;
+ translateY = mHeight;
+ break;
+ }
+ mPath.reset();
+ mMatrix.reset();
+ mPath.addPath(mRoundedPath);
+
+ mMatrix.preScale(cornerRadius / mPathScale, cornerRadius / mPathScale);
+ mMatrix.postRotate(rotateDegrees);
+ mMatrix.postTranslate(translateX, translateY);
+ mPath.transform(mMatrix);
+ return mPath;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/assist/ui/PerimeterPathGuide.java b/packages/SystemUI/src/com/android/systemui/assist/ui/PerimeterPathGuide.java
index 65a9fcc..fb41b1c 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/ui/PerimeterPathGuide.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/ui/PerimeterPathGuide.java
@@ -102,7 +102,7 @@
* Sets the rotation.
*
* @param rotation one of Surface.ROTATION_0, Surface.ROTATION_90, Surface.ROTATION_180,
- * Surface.ROTATION_270
+ * Surface.ROTATION_270
*/
public void setRotation(int rotation) {
if (rotation != mRotation) {
@@ -229,14 +229,14 @@
- mDeviceWidthPx) / 2, (mDeviceWidthPx - mDeviceHeightPx) / 2);
}
- CircularCornerPathRenderer.Corner screenBottomLeft = getRotatedCorner(
- CircularCornerPathRenderer.Corner.BOTTOM_LEFT);
- CircularCornerPathRenderer.Corner screenBottomRight = getRotatedCorner(
- CircularCornerPathRenderer.Corner.BOTTOM_RIGHT);
- CircularCornerPathRenderer.Corner screenTopLeft = getRotatedCorner(
- CircularCornerPathRenderer.Corner.TOP_LEFT);
- CircularCornerPathRenderer.Corner screenTopRight = getRotatedCorner(
- CircularCornerPathRenderer.Corner.TOP_RIGHT);
+ CornerPathRenderer.Corner screenBottomLeft = getRotatedCorner(
+ CornerPathRenderer.Corner.BOTTOM_LEFT);
+ CornerPathRenderer.Corner screenBottomRight = getRotatedCorner(
+ CornerPathRenderer.Corner.BOTTOM_RIGHT);
+ CornerPathRenderer.Corner screenTopLeft = getRotatedCorner(
+ CornerPathRenderer.Corner.TOP_LEFT);
+ CornerPathRenderer.Corner screenTopRight = getRotatedCorner(
+ CornerPathRenderer.Corner.TOP_RIGHT);
mRegions[Region.BOTTOM_LEFT.ordinal()].path =
mCornerPathRenderer.getInsetPath(screenBottomLeft, mEdgeInset);
diff --git a/services/core/java/com/android/server/MmsServiceBroker.java b/services/core/java/com/android/server/MmsServiceBroker.java
index b6fa157..c0f10a3 100644
--- a/services/core/java/com/android/server/MmsServiceBroker.java
+++ b/services/core/java/com/android/server/MmsServiceBroker.java
@@ -37,6 +37,7 @@
import android.os.UserHandle;
import android.service.carrier.CarrierMessagingService;
import android.telephony.SmsManager;
+import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Slog;
@@ -331,7 +332,7 @@
@Override
public void sendMessage(int subId, String callingPkg, Uri contentUri,
String locationUrl, Bundle configOverrides, PendingIntent sentIntent)
- throws RemoteException {
+ throws RemoteException {
Slog.d(TAG, "sendMessage() by " + callingPkg);
mContext.enforceCallingPermission(Manifest.permission.SEND_SMS, "Send MMS message");
if (getAppOpsManager().noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
@@ -341,7 +342,8 @@
}
contentUri = adjustUriForUserAndGrantPermission(contentUri,
CarrierMessagingService.SERVICE_INTERFACE,
- Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ Intent.FLAG_GRANT_READ_URI_PERMISSION,
+ subId);
getServiceGuarded().sendMessage(subId, callingPkg, contentUri, locationUrl,
configOverrides, sentIntent);
}
@@ -360,7 +362,8 @@
}
contentUri = adjustUriForUserAndGrantPermission(contentUri,
CarrierMessagingService.SERVICE_INTERFACE,
- Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
+ Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION,
+ subId);
getServiceGuarded().downloadMessage(subId, callingPkg, locationUrl, contentUri,
configOverrides, downloadedIntent);
@@ -388,7 +391,7 @@
@Override
public Uri importMultimediaMessage(String callingPkg, Uri contentUri,
String messageId, long timestampSecs, boolean seen, boolean read)
- throws RemoteException {
+ throws RemoteException {
if (getAppOpsManager().noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(),
callingPkg) != AppOpsManager.MODE_ALLOWED) {
// Silently fail AppOps failure due to not being the default SMS app
@@ -496,12 +499,12 @@
* even if the caller is not in the primary user.
*
* @param contentUri The Uri to adjust
- * @param action The intent action used to find the associated carrier app
+ * @param action The intent action used to find the associated carrier app
* @param permission The permission to add
* @return The adjusted Uri containing the calling userId.
*/
private Uri adjustUriForUserAndGrantPermission(Uri contentUri, String action,
- int permission) {
+ int permission, int subId) {
final Intent grantIntent = new Intent();
grantIntent.setData(contentUri);
grantIntent.setFlags(permission);
@@ -521,9 +524,10 @@
// Grant permission for the carrier app.
Intent intent = new Intent(action);
TelephonyManager telephonyManager =
- (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
- List<String> carrierPackages = telephonyManager.getCarrierPackageNamesForIntent(
- intent);
+ (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+ List<String> carrierPackages =
+ telephonyManager.getCarrierPackageNamesForIntentAndPhone(
+ intent, SubscriptionManager.getPhoneId(subId));
if (carrierPackages != null && carrierPackages.size() == 1) {
LocalServices.getService(UriGrantsManagerInternal.class)
.grantUriPermissionFromIntent(callingUid, carrierPackages.get(0),
diff --git a/services/core/java/com/android/server/biometrics/face/FaceService.java b/services/core/java/com/android/server/biometrics/face/FaceService.java
index 72bac74..a38abdc 100644
--- a/services/core/java/com/android/server/biometrics/face/FaceService.java
+++ b/services/core/java/com/android/server/biometrics/face/FaceService.java
@@ -63,6 +63,7 @@
import com.android.server.biometrics.AuthenticationClient;
import com.android.server.biometrics.BiometricServiceBase;
import com.android.server.biometrics.BiometricUtils;
+import com.android.server.biometrics.ClientMonitor;
import com.android.server.biometrics.Constants;
import com.android.server.biometrics.EnumerateClient;
import com.android.server.biometrics.RemovalClient;
@@ -342,7 +343,16 @@
@Override // Binder call
public int revokeChallenge(IBinder token) {
checkPermission(MANAGE_BIOMETRIC);
- return startRevokeChallenge(token);
+ // TODO(b/137106905): Schedule binder calls in FaceService to avoid deadlocks.
+ if (getCurrentClient() == null) {
+ // if we aren't handling any other HIDL calls (mCurrentClient == null), revoke the
+ // challenge right away.
+ return startRevokeChallenge(token);
+ } else {
+ // postpone revoking the challenge until we finish processing the current HIDL call.
+ mRevokeChallengePending = true;
+ return Status.OK;
+ }
}
@Override // Binder call
@@ -812,6 +822,7 @@
@GuardedBy("this")
private IBiometricsFace mDaemon;
private UsageStats mUsageStats;
+ private boolean mRevokeChallengePending = false;
// One of the AuthenticationClient constants
private int mCurrentUserLockoutMode;
@@ -1041,6 +1052,15 @@
}
@Override
+ protected void removeClient(ClientMonitor client) {
+ super.removeClient(client);
+ if (mRevokeChallengePending) {
+ startRevokeChallenge(null);
+ mRevokeChallengePending = false;
+ }
+ }
+
+ @Override
public void onStart() {
super.onStart();
publishBinderService(Context.FACE_SERVICE, new FaceServiceWrapper());
@@ -1251,7 +1271,11 @@
return 0;
}
try {
- return daemon.revokeChallenge();
+ final int res = daemon.revokeChallenge();
+ if (res != Status.OK) {
+ Slog.e(TAG, "revokeChallenge returned " + res);
+ }
+ return res;
} catch (RemoteException e) {
Slog.e(TAG, "startRevokeChallenge failed", e);
}
diff --git a/services/core/java/com/android/server/pm/ApexManager.java b/services/core/java/com/android/server/pm/ApexManager.java
index 7e1bc79..2301e3f 100644
--- a/services/core/java/com/android/server/pm/ApexManager.java
+++ b/services/core/java/com/android/server/pm/ApexManager.java
@@ -29,6 +29,7 @@
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
+import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
import android.content.pm.PackageParser;
import android.os.RemoteException;
@@ -147,14 +148,10 @@
* @param childSessionIds if {@code sessionId} is a multi-package session, this should contain
* an array of identifiers of all the child sessions. Otherwise it should
* be an empty array.
- * @param apexInfoList this is an output parameter, which needs to be initialized by tha caller
- * and will be filled with a list of {@link ApexInfo} objects, each of which
- * contains metadata about one of the packages being submitted as part of
- * the session.
- * @return whether the submission of the session was successful.
+ * @throws PackageManagerException if call to apexd fails
*/
- abstract boolean submitStagedSession(
- int sessionId, @NonNull int[] childSessionIds, @NonNull ApexInfoList apexInfoList);
+ abstract ApexInfoList submitStagedSession(int sessionId, @NonNull int[] childSessionIds)
+ throws PackageManagerException;
/**
* Mark a staged session previously submitted using {@code submitStagedSession} as ready to be
@@ -388,13 +385,19 @@
}
@Override
- boolean submitStagedSession(
- int sessionId, @NonNull int[] childSessionIds, @NonNull ApexInfoList apexInfoList) {
+ ApexInfoList submitStagedSession(int sessionId, @NonNull int[] childSessionIds)
+ throws PackageManagerException {
try {
- return mApexService.submitStagedSession(sessionId, childSessionIds, apexInfoList);
+ final ApexInfoList apexInfoList = new ApexInfoList();
+ mApexService.submitStagedSession(sessionId, childSessionIds, apexInfoList);
+ return apexInfoList;
} catch (RemoteException re) {
Slog.e(TAG, "Unable to contact apexservice", re);
throw new RuntimeException(re);
+ } catch (Exception e) {
+ throw new PackageManagerException(
+ PackageInstaller.SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "apexd verification failed : " + e.getMessage());
}
}
@@ -566,9 +569,10 @@
}
@Override
- boolean submitStagedSession(int sessionId, int[] childSessionIds,
- ApexInfoList apexInfoList) {
- throw new UnsupportedOperationException();
+ ApexInfoList submitStagedSession(int sessionId, int[] childSessionIds)
+ throws PackageManagerException {
+ throw new PackageManagerException(PackageManager.INSTALL_FAILED_INTERNAL_ERROR,
+ "Device doesn't support updating APEX");
}
@Override
diff --git a/services/core/java/com/android/server/pm/StagingManager.java b/services/core/java/com/android/server/pm/StagingManager.java
index f9a0197..404b515 100644
--- a/services/core/java/com/android/server/pm/StagingManager.java
+++ b/services/core/java/com/android/server/pm/StagingManager.java
@@ -155,13 +155,10 @@
}
}
}
- final ApexInfoList apexInfoList = new ApexInfoList();
- boolean submittedToApexd = mApexManager.submitStagedSession(session.sessionId,
- childSessionsIds.toArray(), apexInfoList);
- if (!submittedToApexd) {
- throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
- "APEX staging failed, check logcat messages from apexd for more details.");
- }
+ // submitStagedSession will throw a PackageManagerException if apexd verification fails,
+ // which will be propagated to populate stagedSessionErrorMessage of this session.
+ final ApexInfoList apexInfoList = mApexManager.submitStagedSession(session.sessionId,
+ childSessionsIds.toArray());
final List<PackageInfo> result = new ArrayList<>();
for (ApexInfo newPackage : apexInfoList.apexInfos) {
final PackageInfo pkg;
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index 9908b36..b0f1e5d 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -1172,8 +1172,16 @@
return false;
}
final int displayId = display.getDisplayId();
- return displayId == DEFAULT_DISPLAY
- || mWindowManagerInternal.shouldShowSystemDecorOnDisplay(displayId);
+ if (displayId == DEFAULT_DISPLAY) {
+ return true;
+ }
+
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ return mWindowManagerInternal.shouldShowSystemDecorOnDisplay(displayId);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
}
void forEachDisplayConnector(Consumer<DisplayConnector> action) {
diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java
index 1d76a71..b1bc2197 100644
--- a/services/core/java/com/android/server/wm/DockedStackDividerController.java
+++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java
@@ -569,7 +569,6 @@
mMaximizeMeetFraction = getClipRevealMeetFraction(stack);
animDuration = (long) (mAnimationDuration * mMaximizeMeetFraction);
}
- mService.mAtmInternal.notifyDockedStackMinimizedChanged(minimizedDock);
final int size = mDockedStackListeners.beginBroadcast();
for (int i = 0; i < size; ++i) {
final IDockedStackListener listener = mDockedStackListeners.getBroadcastItem(i);
@@ -581,6 +580,9 @@
}
}
mDockedStackListeners.finishBroadcast();
+ // Only notify ATM after we update the remote listeners, otherwise it may trigger another
+ // minimize change, which would lead to an inversion of states send to the listeners
+ mService.mAtmInternal.notifyDockedStackMinimizedChanged(minimizedDock);
}
void notifyDockSideChanged(int newDockSide) {