summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt4
-rw-r--r--api/system-current.txt3
-rw-r--r--api/test-current.txt1
-rw-r--r--core/java/android/app/DownloadManager.java20
-rw-r--r--core/java/android/content/pm/PackageManager.java17
-rw-r--r--core/java/android/os/StrictMode.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java14
7 files changed, 53 insertions, 12 deletions
diff --git a/api/current.txt b/api/current.txt
index 049f51e7ff7d..7cc873a03267 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -4622,8 +4622,8 @@ package android.app {
}
public class DownloadManager {
- method public long addCompletedDownload(String, String, boolean, String, String, long, boolean);
- method public long addCompletedDownload(String, String, boolean, String, String, long, boolean, android.net.Uri, android.net.Uri);
+ method @Deprecated public long addCompletedDownload(String, String, boolean, String, String, long, boolean);
+ method @Deprecated public long addCompletedDownload(String, String, boolean, String, String, long, boolean, android.net.Uri, android.net.Uri);
method public long enqueue(android.app.DownloadManager.Request);
method public static Long getMaxBytesOverMobile(android.content.Context);
method public String getMimeTypeForDownloadedFile(long);
diff --git a/api/system-current.txt b/api/system-current.txt
index 80412f18e1f9..2ce1ee15d98d 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1655,6 +1655,7 @@ package android.content.pm {
field public static final String FEATURE_TELEPHONY_CARRIERLOCK = "android.hardware.telephony.carrierlock";
field public static final int FLAG_PERMISSION_APPLY_RESTRICTION = 16384; // 0x4000
field public static final int FLAG_PERMISSION_GRANTED_BY_DEFAULT = 32; // 0x20
+ field public static final int FLAG_PERMISSION_GRANTED_BY_ROLE = 32768; // 0x8000
field public static final int FLAG_PERMISSION_POLICY_FIXED = 4; // 0x4
field public static final int FLAG_PERMISSION_RESTRICTION_INSTALLER_EXEMPT = 2048; // 0x800
field public static final int FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT = 4096; // 0x1000
@@ -1728,7 +1729,7 @@ package android.content.pm {
method public void onPermissionsChanged(int);
}
- @IntDef(prefix={"FLAG_PERMISSION_"}, value={android.content.pm.PackageManager.FLAG_PERMISSION_USER_SET, android.content.pm.PackageManager.FLAG_PERMISSION_USER_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_POLICY_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE, android.content.pm.PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT, android.content.pm.PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED, android.content.pm.PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED, android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT, android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT, android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_INSTALLER_EXEMPT, android.content.pm.PackageManager.FLAG_PERMISSION_APPLY_RESTRICTION}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface PackageManager.PermissionFlags {
+ @IntDef(prefix={"FLAG_PERMISSION_"}, value={android.content.pm.PackageManager.FLAG_PERMISSION_USER_SET, android.content.pm.PackageManager.FLAG_PERMISSION_USER_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_POLICY_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE, android.content.pm.PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, android.content.pm.PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT, android.content.pm.PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED, android.content.pm.PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_DENIED, android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT, android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT, android.content.pm.PackageManager.FLAG_PERMISSION_RESTRICTION_INSTALLER_EXEMPT, android.content.pm.PackageManager.FLAG_PERMISSION_APPLY_RESTRICTION, android.content.pm.PackageManager.FLAG_PERMISSION_GRANTED_BY_ROLE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface PackageManager.PermissionFlags {
}
public class PermissionGroupInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
diff --git a/api/test-current.txt b/api/test-current.txt
index 39020b43109c..77c3a94f1d10 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -712,6 +712,7 @@ package android.content.pm {
field public static final String FEATURE_ADOPTABLE_STORAGE = "android.software.adoptable_storage";
field public static final String FEATURE_FILE_BASED_ENCRYPTION = "android.software.file_based_encryption";
field public static final int FLAG_PERMISSION_APPLY_RESTRICTION = 16384; // 0x4000
+ field public static final int FLAG_PERMISSION_GRANTED_BY_ROLE = 32768; // 0x8000
field public static final int FLAG_PERMISSION_POLICY_FIXED = 4; // 0x4
field public static final int FLAG_PERMISSION_RESTRICTION_INSTALLER_EXEMPT = 2048; // 0x800
field public static final int FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT = 4096; // 0x1000
diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java
index 6073354219e5..6d035ddf70cb 100644
--- a/core/java/android/app/DownloadManager.java
+++ b/core/java/android/app/DownloadManager.java
@@ -1366,7 +1366,12 @@ public class DownloadManager {
* @param showNotification true if a notification is to be sent, false otherwise
* @return an ID for the download entry added to the downloads app, unique across the system
* This ID is used to make future calls related to this download.
+ *
+ * @deprecated Apps should instead contribute files to
+ * {@link android.provider.MediaStore.Downloads} collection to make them available to user
+ * as part of Downloads.
*/
+ @Deprecated
public long addCompletedDownload(String title, String description,
boolean isMediaScannerScannable, String mimeType, String path, long length,
boolean showNotification) {
@@ -1407,7 +1412,12 @@ public class DownloadManager {
* @param referer the HTTP Referer for the download
* @return an ID for the download entry added to the downloads app, unique across the system
* This ID is used to make future calls related to this download.
+ *
+ * @deprecated Apps should instead contribute files to
+ * {@link android.provider.MediaStore.Downloads} collection to make them available to user
+ * as part of Downloads.
*/
+ @Deprecated
public long addCompletedDownload(String title, String description,
boolean isMediaScannerScannable, String mimeType, String path, long length,
boolean showNotification, Uri uri, Uri referer) {
@@ -1426,8 +1436,13 @@ public class DownloadManager {
* {@link Environment#getExternalStoragePublicDirectory(String)} with
* {@link Environment#DIRECTORY_DOWNLOADS}).
*
+ * @deprecated Apps should instead contribute files to
+ * {@link android.provider.MediaStore.Downloads} collection to make them available to user
+ * as part of Downloads.
+ *
* {@hide}
*/
+ @Deprecated
public long addCompletedDownload(String title, String description,
boolean isMediaScannerScannable, String mimeType, String path, long length,
boolean showNotification, boolean allowWrite) {
@@ -1447,7 +1462,12 @@ public class DownloadManager {
* {@link Environment#DIRECTORY_DOWNLOADS}).
*
* {@hide}
+ *
+ * @deprecated Apps should instead contribute files to
+ * {@link android.provider.MediaStore.Downloads} collection to make them available to user
+ * as part of Downloads.
*/
+ @Deprecated
public long addCompletedDownload(String title, String description,
boolean isMediaScannerScannable, String mimeType, String path, long length,
boolean showNotification, boolean allowWrite, Uri uri, Uri referer) {
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 5f3e0570840a..a95e094ce54c 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -3143,6 +3143,14 @@ public abstract class PackageManager {
@SystemApi
public static final int FLAG_PERMISSION_APPLY_RESTRICTION = 1 << 14;
+ /**
+ * Permission flag: The permission is granted because the application holds a role.
+ *
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public static final int FLAG_PERMISSION_GRANTED_BY_ROLE = 1 << 15;
/**
* Permission flags: Bitwise or of all permission flags allowing an
@@ -3183,7 +3191,8 @@ public abstract class PackageManager {
| FLAG_PERMISSION_RESTRICTION_INSTALLER_EXEMPT
| FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT
| FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT
- | FLAG_PERMISSION_APPLY_RESTRICTION;
+ | FLAG_PERMISSION_APPLY_RESTRICTION
+ | FLAG_PERMISSION_GRANTED_BY_ROLE;
/**
* Injected activity in app that forwards user to setting activity of that app.
@@ -3947,7 +3956,8 @@ public abstract class PackageManager {
FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT,
FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT,
FLAG_PERMISSION_RESTRICTION_INSTALLER_EXEMPT,
- FLAG_PERMISSION_APPLY_RESTRICTION
+ FLAG_PERMISSION_APPLY_RESTRICTION,
+ FLAG_PERMISSION_GRANTED_BY_ROLE
})
@Retention(RetentionPolicy.SOURCE)
public @interface PermissionFlags {}
@@ -7030,7 +7040,8 @@ public abstract class PackageManager {
case FLAG_PERMISSION_RESTRICTION_INSTALLER_EXEMPT: return "RESTRICTION_INSTALLER_EXEMPT";
case FLAG_PERMISSION_RESTRICTION_SYSTEM_EXEMPT: return "RESTRICTION_SYSTEM_EXEMPT";
case FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT: return "RESTRICTION_UPGRADE_EXEMPT";
- case FLAG_PERMISSION_APPLY_RESTRICTION: return "FLAG_PERMISSION_APPLY_RESTRICTION";
+ case FLAG_PERMISSION_APPLY_RESTRICTION: return "APPLY_RESTRICTION";
+ case FLAG_PERMISSION_GRANTED_BY_ROLE: return "GRANTED_BY_ROLE";
default: return Integer.toString(flag);
}
}
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 94cca30d9e6c..c707ba839336 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -1284,13 +1284,15 @@ public final class StrictMode {
return oldPolicyMask;
}
- private static ThreadPolicy allowThreadViolations() {
+ /** @hide */
+ public static ThreadPolicy allowThreadViolations() {
ThreadPolicy oldPolicy = getThreadPolicy();
setThreadPolicyMask(0);
return oldPolicy;
}
- private static VmPolicy allowVmViolations() {
+ /** @hide */
+ public static VmPolicy allowVmViolations() {
VmPolicy oldPolicy = getVmPolicy();
sVmPolicy = VmPolicy.LAX;
return oldPolicy;
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 329d02959435..de86f3d8cfb4 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -29,6 +29,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.MoveCallback;
import android.os.Bundle;
import android.os.Handler;
+import android.os.StrictMode;
import android.os.UserHandle;
import android.os.storage.DiskInfo;
import android.os.storage.StorageEventListener;
@@ -639,11 +640,16 @@ public class StorageNotification extends SystemUI {
}
private PendingIntent buildBrowsePendingIntent(VolumeInfo vol) {
- final Intent intent = vol.buildBrowseIntentForUser(vol.getMountUserId());
+ final StrictMode.VmPolicy oldPolicy = StrictMode.allowVmViolations();
+ try {
+ final Intent intent = vol.buildBrowseIntentForUser(vol.getMountUserId());
- final int requestKey = vol.getId().hashCode();
- return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
- PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
+ final int requestKey = vol.getId().hashCode();
+ return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
+ PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
+ } finally {
+ StrictMode.setVmPolicy(oldPolicy);
+ }
}
private PendingIntent buildVolumeSettingsPendingIntent(VolumeInfo vol) {