Merge "Handle onNullBinding" into qt-dev
diff --git a/api/current.txt b/api/current.txt
index b624946..661b9c6 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5335,6 +5335,7 @@
field public static final String EXTRA_TITLE = "android.title";
field public static final String EXTRA_TITLE_BIG = "android.title.big";
field public static final int FLAG_AUTO_CANCEL = 16; // 0x10
+ field public static final int FLAG_BUBBLE = 4096; // 0x1000
field public static final int FLAG_FOREGROUND_SERVICE = 64; // 0x40
field public static final int FLAG_GROUP_SUMMARY = 512; // 0x200
field @Deprecated public static final int FLAG_HIGH_PRIORITY = 128; // 0x80
@@ -9515,7 +9516,7 @@
method public static android.content.SyncAdapterType[] getSyncAdapterTypes();
method public static boolean getSyncAutomatically(android.accounts.Account, String);
method @Nullable public final String getType(@NonNull android.net.Uri);
- method @NonNull public final android.content.ContentResolver.TypeInfo getTypeInfo(@NonNull String);
+ method @NonNull public final android.content.ContentResolver.MimeTypeInfo getTypeInfo(@NonNull String);
method @Nullable public final android.net.Uri insert(@RequiresPermission.Write @NonNull android.net.Uri, @Nullable android.content.ContentValues);
method public static boolean isSyncActive(android.accounts.Account, String);
method public static boolean isSyncPending(android.accounts.Account, String);
@@ -9595,7 +9596,7 @@
field public static final int SYNC_OBSERVER_TYPE_SETTINGS = 1; // 0x1
}
- public static final class ContentResolver.TypeInfo {
+ public static final class ContentResolver.MimeTypeInfo {
method @NonNull public CharSequence getContentDescription();
method @NonNull public android.graphics.drawable.Icon getIcon();
method @NonNull public CharSequence getLabel();
@@ -38478,8 +38479,8 @@
public final class MediaStore {
ctor public MediaStore();
- method @NonNull public static java.util.Set<java.lang.String> getAllVolumeNames(@NonNull android.content.Context);
method @Nullable public static android.net.Uri getDocumentUri(@NonNull android.content.Context, @NonNull android.net.Uri);
+ method @NonNull public static java.util.Set<java.lang.String> getExternalVolumeNames(@NonNull android.content.Context);
method public static android.net.Uri getMediaScannerUri();
method @Nullable public static android.net.Uri getMediaUri(@NonNull android.content.Context, @NonNull android.net.Uri);
method @NonNull public static String getVersion(@NonNull android.content.Context);
@@ -38523,6 +38524,7 @@
field public static final String META_DATA_STILL_IMAGE_CAMERA_PREWARM_SERVICE = "android.media.still_image_camera_preview_service";
field public static final String UNKNOWN_STRING = "<unknown>";
field public static final String VOLUME_EXTERNAL = "external";
+ field public static final String VOLUME_EXTERNAL_PRIMARY = "external_primary";
field public static final String VOLUME_INTERNAL = "internal";
}
@@ -38771,6 +38773,7 @@
field public static final String RELATIVE_PATH = "relative_path";
field public static final String SIZE = "_size";
field public static final String TITLE = "title";
+ field public static final String VOLUME_NAME = "volume_name";
field public static final String WIDTH = "width";
}
diff --git a/api/removed.txt b/api/removed.txt
index fe3e866..70ff50e 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -514,6 +514,7 @@
public final class MediaStore {
method @Deprecated @NonNull public static android.net.Uri createPending(@NonNull android.content.Context, @NonNull android.provider.MediaStore.PendingParams);
+ method @Deprecated @NonNull public static java.util.Set<java.lang.String> getAllVolumeNames(@NonNull android.content.Context);
method @Deprecated @NonNull public static android.provider.MediaStore.PendingSession openPending(@NonNull android.content.Context, @NonNull android.net.Uri);
method @Deprecated @NonNull public static android.net.Uri setIncludeTrashed(@NonNull android.net.Uri);
method @Deprecated public static void trash(@NonNull android.content.Context, @NonNull android.net.Uri);
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index f7608f5..82d177a 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -3251,13 +3251,12 @@
INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
INSTALLER_ROLLBACK_SUCCESS = 15;
INSTALLER_ROLLBACK_FAILURE = 16;
- INSTALLER_ROLLBACK_CANCEL_STAGED_REMOVE_FROM_QUEUE = 17;
- INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_INITIATED = 18;
- INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_SUCCESS = 19;
- INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_FAILURE = 20;
- INSTALL_STAGED_CANCEL_REQUESTED = 21;
- INSTALL_STAGED_CANCEL_SUCCESS = 22;
- INSTALL_STAGED_CANCEL_FAILURE = 23;
+ INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
+ INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
+ INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
+ INSTALL_STAGED_CANCEL_REQUESTED = 20;
+ INSTALL_STAGED_CANCEL_SUCCESS = 21;
+ INSTALL_STAGED_CANCEL_FAILURE = 22;
}
optional State state = 6;
// Possible experiment ids for monitoring this push.
@@ -5748,13 +5747,12 @@
INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
INSTALLER_ROLLBACK_SUCCESS = 15;
INSTALLER_ROLLBACK_FAILURE = 16;
- INSTALLER_ROLLBACK_CANCEL_STAGED_REMOVE_FROM_QUEUE = 17;
- INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_INITIATED = 18;
- INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_SUCCESS = 19;
- INSTALLER_ROLLBACK_CANCEL_STAGED_DELETE_SESSION_FAILURE = 20;
- INSTALL_STAGED_CANCEL_REQUESTED = 21;
- INSTALL_STAGED_CANCEL_SUCCESS = 22;
- INSTALL_STAGED_CANCEL_FAILURE = 23;
+ INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
+ INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
+ INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
+ INSTALL_STAGED_CANCEL_REQUESTED = 20;
+ INSTALL_STAGED_CANCEL_SUCCESS = 21;
+ INSTALL_STAGED_CANCEL_FAILURE = 22;
}
optional Status status = 4;
}
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 0ab1a85..a90185c 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -618,9 +618,11 @@
public static final int FLAG_CAN_COLORIZE = 0x00000800;
/**
- * Bit to be bitswised-ored into the {@link #flags} field that should be
- * set if this notification can be shown as a bubble.
- * @hide
+ * Bit to be bitswised-ored into the {@link #flags} field that should be set if this
+ * notification is showing as a bubble. This will be set by the system if it is determined
+ * that your notification is allowed to be a bubble.
+ *
+ * @see {@link Notification.Builder#setBubbleMetadata(BubbleMetadata)}
*/
public static final int FLAG_BUBBLE = 0x00001000;
@@ -3578,9 +3580,9 @@
* <p>This data will be ignored unless the notification is posted to a channel that
* allows {@link NotificationChannel#canBubble() bubbles}.</p>
*
- * <b>Notifications with a valid and allowed bubble metadata will display in collapsed state
- * outside of the notification shade on unlocked devices. When a user interacts with the
- * collapsed state, the bubble intent will be invoked and displayed.</b>
+ * <p>Notifications allowed to bubble that have valid bubble metadata will display in
+ * collapsed state outside of the notification shade on unlocked devices. When a user
+ * interacts with the collapsed state, the bubble intent will be invoked and displayed.</p>
*/
@NonNull
public Builder setBubbleMetadata(@Nullable BubbleMetadata data) {
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 791c551..00f1e43 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -3398,7 +3398,7 @@
*
* @param mimeType Valid, concrete MIME type.
*/
- public final @NonNull TypeInfo getTypeInfo(@NonNull String mimeType) {
+ public final @NonNull MimeTypeInfo getTypeInfo(@NonNull String mimeType) {
Objects.requireNonNull(mimeType);
return MimeIconUtils.getTypeInfo(mimeType);
}
@@ -3407,13 +3407,13 @@
* Detailed description of a specific MIME type, including an icon and label
* that describe the type.
*/
- public static final class TypeInfo {
+ public static final class MimeTypeInfo {
private final Icon mIcon;
private final CharSequence mLabel;
private final CharSequence mContentDescription;
/** {@hide} */
- public TypeInfo(@NonNull Icon icon, @NonNull CharSequence label,
+ public MimeTypeInfo(@NonNull Icon icon, @NonNull CharSequence label,
@NonNull CharSequence contentDescription) {
mIcon = Objects.requireNonNull(icon);
mLabel = Objects.requireNonNull(label);
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index 075b650..080ff73 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -1130,7 +1130,7 @@
public @NonNull StorageVolume getStorageVolume(@NonNull Uri uri) {
final String volumeName = MediaStore.getVolumeName(uri);
switch (volumeName) {
- case MediaStore.VOLUME_EXTERNAL:
+ case MediaStore.VOLUME_EXTERNAL_PRIMARY:
return getPrimaryStorageVolume();
default:
for (StorageVolume vol : getStorageVolumes()) {
diff --git a/core/java/android/os/storage/StorageVolume.java b/core/java/android/os/storage/StorageVolume.java
index 225ecfa..6280600 100644
--- a/core/java/android/os/storage/StorageVolume.java
+++ b/core/java/android/os/storage/StorageVolume.java
@@ -265,8 +265,13 @@
}
/** {@hide} */
+ public static @Nullable String normalizeUuid(@Nullable String fsUuid) {
+ return fsUuid != null ? fsUuid.toLowerCase(Locale.US) : null;
+ }
+
+ /** {@hide} */
public @Nullable String getNormalizedUuid() {
- return mFsUuid != null ? mFsUuid.toLowerCase(Locale.US) : null;
+ return normalizeUuid(mFsUuid);
}
/**
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 0b1647d..da19d59 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -102,20 +102,40 @@
public static final @NonNull Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
/**
- * Volume name used for content on "internal" storage of device. This
- * volume contains media distributed with the device, such as built-in
- * ringtones and wallpapers.
+ * Synthetic volume name that provides a view of all content across the
+ * "internal" storage of the device.
+ * <p>
+ * This synthetic volume provides a merged view of all media distributed
+ * with the device, such as built-in ringtones and wallpapers.
+ * <p>
+ * Because this is a synthetic volume, you can't insert new content into
+ * this volume.
*/
public static final String VOLUME_INTERNAL = "internal";
/**
- * Volume name used for content on "external" storage of device. This only
- * includes media on the primary shared storage device; the contents of any
- * secondary storage devices can be obtained using
- * {@link #getAllVolumeNames(Context)}.
+ * Synthetic volume name that provides a view of all content across the
+ * "external" storage of the device.
+ * <p>
+ * This synthetic volume provides a merged view of all media across all
+ * currently attached external storage devices.
+ * <p>
+ * Because this is a synthetic volume, you can't insert new content into
+ * this volume. Instead, you can insert content into a specific storage
+ * volume obtained from {@link #getExternalVolumeNames(Context)}.
*/
public static final String VOLUME_EXTERNAL = "external";
+ /**
+ * Specific volume name that represents the primary external storage device
+ * at {@link Environment#getExternalStorageDirectory()}.
+ * <p>
+ * This volume may not always be available, such as when the user has
+ * ejected the device. You can find a list of all specific volume names
+ * using {@link #getExternalVolumeNames(Context)}.
+ */
+ public static final String VOLUME_EXTERNAL_PRIMARY = "external_primary";
+
/** {@hide} */
public static final String SCAN_FILE_CALL = "scan_file";
/** {@hide} */
@@ -1037,6 +1057,16 @@
public static final String OWNER_PACKAGE_NAME = "owner_package_name";
/**
+ * Volume name of the specific storage device where this media item is
+ * persisted. The value is typically one of the volume names returned
+ * from {@link MediaStore#getExternalVolumeNames(Context)}.
+ * <p>
+ * This is a read-only column that is automatically computed.
+ */
+ @Column(value = Cursor.FIELD_TYPE_STRING, readOnly = true)
+ public static final String VOLUME_NAME = "volume_name";
+
+ /**
* Relative path of this media item within the storage device where it
* is persisted. For example, an item stored at
* {@code /storage/0000-0000/DCIM/Vacation/IMG1024.JPG} would have a
@@ -1408,7 +1438,7 @@
final StorageVolume sv = sm.getStorageVolume(path);
if (sv != null) {
if (sv.isPrimary()) {
- return VOLUME_EXTERNAL;
+ return VOLUME_EXTERNAL_PRIMARY;
} else {
return checkArgumentVolumeName(sv.getNormalizedUuid());
}
@@ -1710,7 +1740,7 @@
String stringUrl = null; /* value to be returned */
try {
- url = cr.insert(EXTERNAL_CONTENT_URI, values);
+ url = cr.insert(getContentUri(VOLUME_EXTERNAL_PRIMARY), values);
if (source != null) {
try (OutputStream out = new ParcelFileDescriptor.AutoCloseOutputStream(
@@ -3224,22 +3254,29 @@
}
}
- /**
- * Return list of all volume names currently available. This includes a
- * unique name for each shared storage device that is currently mounted.
- * <p>
- * Each name can be passed to APIs like
- * {@link MediaStore.Images.Media#getContentUri(String)} to query media at
- * that location.
- */
+ /** @removed */
+ @Deprecated
public static @NonNull Set<String> getAllVolumeNames(@NonNull Context context) {
+ return getExternalVolumeNames(context);
+ }
+
+ /**
+ * Return list of all specific volume names that make up
+ * {@link #VOLUME_EXTERNAL}. This includes a unique volume name for each
+ * shared storage device that is currently attached, which typically
+ * includes {@link MediaStore#VOLUME_EXTERNAL_PRIMARY}.
+ * <p>
+ * Each specific volume name can be passed to APIs like
+ * {@link MediaStore.Images.Media#getContentUri(String)} to interact with
+ * media on that storage device.
+ */
+ public static @NonNull Set<String> getExternalVolumeNames(@NonNull Context context) {
final StorageManager sm = context.getSystemService(StorageManager.class);
final Set<String> volumeNames = new ArraySet<>();
- volumeNames.add(VOLUME_INTERNAL);
for (VolumeInfo vi : sm.getVolumes()) {
if (vi.isVisibleForUser(UserHandle.myUserId()) && vi.isMountedReadable()) {
if (vi.isPrimary()) {
- volumeNames.add(VOLUME_EXTERNAL);
+ volumeNames.add(VOLUME_EXTERNAL_PRIMARY);
} else {
volumeNames.add(vi.getNormalizedFsUuid());
}
@@ -3270,6 +3307,8 @@
return volumeName;
} else if (VOLUME_EXTERNAL.equals(volumeName)) {
return volumeName;
+ } else if (VOLUME_EXTERNAL_PRIMARY.equals(volumeName)) {
+ return volumeName;
}
// When not one of the well-known values above, it must be a hex UUID
@@ -3285,8 +3324,9 @@
}
/**
- * Return path where the given volume is mounted. Not valid for
- * {@link #VOLUME_INTERNAL}.
+ * Return path where the given specific volume is mounted. Not valid for
+ * {@link #VOLUME_INTERNAL} or {@link #VOLUME_EXTERNAL}, since those are
+ * broad collections that cover many paths.
*
* @hide
*/
@@ -3297,8 +3337,12 @@
throw new IllegalArgumentException();
}
- if (VOLUME_EXTERNAL.equals(volumeName)) {
- return Environment.getExternalStorageDirectory();
+ switch (volumeName) {
+ case VOLUME_INTERNAL:
+ case VOLUME_EXTERNAL:
+ throw new FileNotFoundException(volumeName + " has no associated path");
+ case VOLUME_EXTERNAL_PRIMARY:
+ return Environment.getExternalStorageDirectory();
}
final StorageManager sm = AppGlobals.getInitialApplication()
@@ -3328,23 +3372,31 @@
throw new IllegalArgumentException();
}
+ final Context context = AppGlobals.getInitialApplication();
+ final UserManager um = context.getSystemService(UserManager.class);
+
final ArrayList<File> res = new ArrayList<>();
if (VOLUME_INTERNAL.equals(volumeName)) {
- addCanoncialFile(res, new File(Environment.getRootDirectory(), "media"));
- addCanoncialFile(res, new File(Environment.getOemDirectory(), "media"));
- addCanoncialFile(res, new File(Environment.getProductDirectory(), "media"));
+ addCanonicalFile(res, new File(Environment.getRootDirectory(), "media"));
+ addCanonicalFile(res, new File(Environment.getOemDirectory(), "media"));
+ addCanonicalFile(res, new File(Environment.getProductDirectory(), "media"));
+ } else if (VOLUME_EXTERNAL.equals(volumeName)) {
+ for (String exactVolume : getExternalVolumeNames(context)) {
+ addCanonicalFile(res, getVolumePath(exactVolume));
+ }
+ if (um.isDemoUser()) {
+ addCanonicalFile(res, Environment.getDataPreloadsMediaDirectory());
+ }
} else {
- addCanoncialFile(res, getVolumePath(volumeName));
- final UserManager um = AppGlobals.getInitialApplication()
- .getSystemService(UserManager.class);
- if (VOLUME_EXTERNAL.equals(volumeName) && um.isDemoUser()) {
- addCanoncialFile(res, Environment.getDataPreloadsMediaDirectory());
+ addCanonicalFile(res, getVolumePath(volumeName));
+ if (VOLUME_EXTERNAL_PRIMARY.equals(volumeName) && um.isDemoUser()) {
+ addCanonicalFile(res, Environment.getDataPreloadsMediaDirectory());
}
}
return res;
}
- private static void addCanoncialFile(List<File> list, File file) {
+ private static void addCanonicalFile(List<File> list, File file) {
try {
list.add(file.getCanonicalFile());
} catch (IOException e) {
@@ -3382,12 +3434,12 @@
* <p>
* No other assumptions should be made about the meaning of the version.
* <p>
- * This method returns the version for {@link MediaStore#VOLUME_EXTERNAL};
- * to obtain a version for a different volume, use
- * {@link #getVersion(Context, String)}.
+ * This method returns the version for
+ * {@link MediaStore#VOLUME_EXTERNAL_PRIMARY}; to obtain a version for a
+ * different volume, use {@link #getVersion(Context, String)}.
*/
public static @NonNull String getVersion(@NonNull Context context) {
- return getVersion(context, VOLUME_EXTERNAL);
+ return getVersion(context, VOLUME_EXTERNAL_PRIMARY);
}
/**
@@ -3401,7 +3453,7 @@
*
* @param volumeName specific volume to obtain an opaque version string for.
* Must be one of the values returned from
- * {@link #getAllVolumeNames(Context)}.
+ * {@link #getExternalVolumeNames(Context)}.
*/
public static @NonNull String getVersion(@NonNull Context context, @NonNull String volumeName) {
final ContentResolver resolver = context.getContentResolver();
diff --git a/core/java/android/view/contentcapture/ContentCaptureCondition.java b/core/java/android/view/contentcapture/ContentCaptureCondition.java
index cf171d7..6f9d4d3 100644
--- a/core/java/android/view/contentcapture/ContentCaptureCondition.java
+++ b/core/java/android/view/contentcapture/ContentCaptureCondition.java
@@ -54,7 +54,9 @@
*
* @param locusId id of the condition, as defined by
* {@link ContentCaptureContext#getLocusId()}.
- * @param flags either {@link ContentCaptureCondition#FLAG_IS_REGEX} or {@code 0}.
+ * @param flags either {@link ContentCaptureCondition#FLAG_IS_REGEX} (to use a regular
+ * expression match) or {@code 0} (in which case the {@code LocusId} must be an exact match of
+ * the {@code LocusId} used in the {@link ContentCaptureContext}).
*/
public ContentCaptureCondition(@NonNull LocusId locusId, @Flags int flags) {
this.mLocusId = Preconditions.checkNotNull(locusId);
diff --git a/core/java/android/view/textclassifier/ConversationAction.java b/core/java/android/view/textclassifier/ConversationAction.java
index f2d878a..b8cb7be 100644
--- a/core/java/android/view/textclassifier/ConversationAction.java
+++ b/core/java/android/view/textclassifier/ConversationAction.java
@@ -200,13 +200,11 @@
/**
* Returns the extended data related to this conversation action.
*
- * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should
- * prefer to hold a reference to the returned bundle rather than frequently calling this
- * method.
+ * <p><b>NOTE: </b>Do not modify this bundle.
*/
@NonNull
public Bundle getExtras() {
- return mExtras.deepCopy();
+ return mExtras;
}
/** Builder class to construct {@link ConversationAction}. */
diff --git a/core/java/android/view/textclassifier/ConversationActions.java b/core/java/android/view/textclassifier/ConversationActions.java
index dc75212..eddc672 100644
--- a/core/java/android/view/textclassifier/ConversationActions.java
+++ b/core/java/android/view/textclassifier/ConversationActions.java
@@ -214,13 +214,11 @@
/**
* Returns the extended data related to this conversation action.
*
- * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should
- * prefer to hold a reference to the returned bundle rather than frequently calling this
- * method.
+ * <p><b>NOTE: </b>Do not modify this bundle.
*/
@NonNull
public Bundle getExtras() {
- return mExtras.deepCopy();
+ return mExtras;
}
/** Builder class to construct a {@link Message} */
diff --git a/core/java/android/view/textclassifier/TextClassification.java b/core/java/android/view/textclassifier/TextClassification.java
index 9ede8fb..4c4cb55 100644
--- a/core/java/android/view/textclassifier/TextClassification.java
+++ b/core/java/android/view/textclassifier/TextClassification.java
@@ -265,13 +265,11 @@
/**
* Returns the extended data.
*
- * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should
- * prefer to hold a reference to the returned bundle rather than frequently calling this
- * method.
+ * <p><b>NOTE: </b>Do not modify this bundle.
*/
@NonNull
public Bundle getExtras() {
- return mExtras.deepCopy();
+ return mExtras;
}
@Override
@@ -635,13 +633,11 @@
/**
* Returns the extended data.
*
- * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should
- * prefer to hold a reference to the returned bundle rather than frequently calling this
- * method.
+ * <p><b>NOTE: </b>Do not modify this bundle.
*/
@NonNull
public Bundle getExtras() {
- return mExtras.deepCopy();
+ return mExtras;
}
/**
diff --git a/core/java/android/view/textclassifier/TextLinks.java b/core/java/android/view/textclassifier/TextLinks.java
index cde27a0..c815f63 100644
--- a/core/java/android/view/textclassifier/TextLinks.java
+++ b/core/java/android/view/textclassifier/TextLinks.java
@@ -125,13 +125,11 @@
/**
* Returns the extended data.
*
- * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should
- * prefer to hold a reference to the returned bundle rather than frequently calling this
- * method.
+ * <p><b>NOTE: </b>Do not modify this bundle.
*/
@NonNull
public Bundle getExtras() {
- return mExtras.deepCopy();
+ return mExtras;
}
/**
@@ -413,13 +411,11 @@
/**
* Returns the extended data.
*
- * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should
- * prefer to hold a reference to the returned bundle rather than frequently calling this
- * method.
+ * <p><b>NOTE: </b>Do not modify this bundle.
*/
@NonNull
public Bundle getExtras() {
- return mExtras.deepCopy();
+ return mExtras;
}
/**
diff --git a/core/java/android/view/textclassifier/TextSelection.java b/core/java/android/view/textclassifier/TextSelection.java
index 5298939..e378e65 100644
--- a/core/java/android/view/textclassifier/TextSelection.java
+++ b/core/java/android/view/textclassifier/TextSelection.java
@@ -112,13 +112,11 @@
/**
* Returns the extended data.
*
- * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should
- * prefer to hold a reference to the returned bundle rather than frequently calling this
- * method.
+ * <p><b>NOTE: </b>Do not modify this bundle.
*/
@NonNull
public Bundle getExtras() {
- return mExtras.deepCopy();
+ return mExtras;
}
@Override
@@ -296,13 +294,11 @@
/**
* Returns the extended data.
*
- * <p><b>NOTE: </b>Each call to this method returns a new bundle copy so clients should
- * prefer to hold a reference to the returned bundle rather than frequently calling this
- * method.
+ * <p><b>NOTE: </b>Do not modify this bundle.
*/
@NonNull
public Bundle getExtras() {
- return mExtras.deepCopy();
+ return mExtras;
}
/**
diff --git a/core/java/com/android/internal/util/MimeIconUtils.java b/core/java/com/android/internal/util/MimeIconUtils.java
index 0b5fa6d..8523b4e 100644
--- a/core/java/com/android/internal/util/MimeIconUtils.java
+++ b/core/java/com/android/internal/util/MimeIconUtils.java
@@ -18,7 +18,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.content.ContentResolver.TypeInfo;
+import android.content.ContentResolver.MimeTypeInfo;
import android.content.res.Resources;
import android.graphics.drawable.Icon;
import android.text.TextUtils;
@@ -34,9 +34,9 @@
public class MimeIconUtils {
@GuardedBy("sCache")
- private static final ArrayMap<String, TypeInfo> sCache = new ArrayMap<>();
+ private static final ArrayMap<String, MimeTypeInfo> sCache = new ArrayMap<>();
- private static TypeInfo buildTypeInfo(String mimeType, int iconId,
+ private static MimeTypeInfo buildTypeInfo(String mimeType, int iconId,
int labelId, int extLabelId) {
final Resources res = Resources.getSystem();
@@ -49,10 +49,10 @@
label = res.getString(labelId);
}
- return new TypeInfo(Icon.createWithResource(res, iconId), label, label);
+ return new MimeTypeInfo(Icon.createWithResource(res, iconId), label, label);
}
- private static @Nullable TypeInfo buildTypeInfo(@NonNull String mimeType) {
+ private static @Nullable MimeTypeInfo buildTypeInfo(@NonNull String mimeType) {
switch (mimeType) {
case "inode/directory":
case "vnd.android.document/directory":
@@ -222,7 +222,7 @@
}
}
- private static @Nullable TypeInfo buildGenericTypeInfo(@NonNull String mimeType) {
+ private static @Nullable MimeTypeInfo buildGenericTypeInfo(@NonNull String mimeType) {
// Look for partial matches
if (mimeType.startsWith("audio/")) {
return buildTypeInfo(mimeType, R.drawable.ic_doc_audio,
@@ -252,12 +252,12 @@
R.string.mime_type_generic, R.string.mime_type_generic_ext);
}
- public static @NonNull TypeInfo getTypeInfo(@NonNull String mimeType) {
+ public static @NonNull MimeTypeInfo getTypeInfo(@NonNull String mimeType) {
// Normalize MIME type
mimeType = mimeType.toLowerCase(Locale.US);
synchronized (sCache) {
- TypeInfo res = sCache.get(mimeType);
+ MimeTypeInfo res = sCache.get(mimeType);
if (res == null) {
res = buildTypeInfo(mimeType);
sCache.put(mimeType, res);
diff --git a/core/res/res/values/dimens_car.xml b/core/res/res/values/dimens_car.xml
index 5c446d6..f22a91f 100644
--- a/core/res/res/values/dimens_car.xml
+++ b/core/res/res/values/dimens_car.xml
@@ -66,9 +66,10 @@
<dimen name="car_padding_0">4dp</dimen>
<dimen name="car_padding_1">8dp</dimen>
<dimen name="car_padding_2">16dp</dimen>
- <dimen name="car_padding_3">28dp</dimen>
+ <dimen name="car_padding_3">24dp</dimen>
<dimen name="car_padding_4">32dp</dimen>
<dimen name="car_padding_5">64dp</dimen>
+ <dimen name="car_padding_6">96dp</dimen>
<!-- Radius -->
<dimen name="car_radius_1">4dp</dimen>
diff --git a/libs/hwui/tests/unit/CommonPoolTests.cpp b/libs/hwui/tests/unit/CommonPoolTests.cpp
index c564ed6..70a5f5a 100644
--- a/libs/hwui/tests/unit/CommonPoolTests.cpp
+++ b/libs/hwui/tests/unit/CommonPoolTests.cpp
@@ -135,4 +135,48 @@
for (auto& f : futures) {
f.get();
}
+}
+
+class ObjectTracker {
+ static std::atomic_int sGlobalCount;
+
+public:
+ ObjectTracker() {
+ sGlobalCount++;
+ }
+ ObjectTracker(const ObjectTracker&) {
+ sGlobalCount++;
+ }
+ ObjectTracker(ObjectTracker&&) {
+ sGlobalCount++;
+ }
+ ~ObjectTracker() {
+ sGlobalCount--;
+ }
+
+ static int count() { return sGlobalCount.load(); }
+};
+
+std::atomic_int ObjectTracker::sGlobalCount{0};
+
+TEST(CommonPool, asyncLifecycleCheck) {
+ ASSERT_EQ(0, ObjectTracker::count());
+ {
+ ObjectTracker obj;
+ ASSERT_EQ(1, ObjectTracker::count());
+ EXPECT_LT(1, CommonPool::async([obj] { return ObjectTracker::count(); }).get());
+ }
+ CommonPool::waitForIdle();
+ ASSERT_EQ(0, ObjectTracker::count());
+}
+
+TEST(CommonPool, syncLifecycleCheck) {
+ ASSERT_EQ(0, ObjectTracker::count());
+ {
+ ObjectTracker obj;
+ ASSERT_EQ(1, ObjectTracker::count());
+ EXPECT_LT(1, CommonPool::runSync([obj] { return ObjectTracker::count(); }));
+ }
+ CommonPool::waitForIdle();
+ ASSERT_EQ(0, ObjectTracker::count());
}
\ No newline at end of file
diff --git a/libs/hwui/thread/CommonPool.cpp b/libs/hwui/thread/CommonPool.cpp
index 7f94a15..d011bdf 100644
--- a/libs/hwui/thread/CommonPool.cpp
+++ b/libs/hwui/thread/CommonPool.cpp
@@ -49,9 +49,13 @@
}
}
-void CommonPool::post(Task&& task) {
+CommonPool& CommonPool::instance() {
static CommonPool pool;
- pool.enqueue(std::move(task));
+ return pool;
+}
+
+void CommonPool::post(Task&& task) {
+ instance().enqueue(std::move(task));
}
void CommonPool::enqueue(Task&& task) {
@@ -86,5 +90,18 @@
}
}
+void CommonPool::waitForIdle() {
+ instance().doWaitForIdle();
+}
+
+void CommonPool::doWaitForIdle() {
+ std::unique_lock lock(mLock);
+ while (mWaitingThreads != THREAD_COUNT) {
+ lock.unlock();
+ usleep(100);
+ lock.lock();
+ }
+}
+
} // namespace uirenderer
} // namespace android
\ No newline at end of file
diff --git a/libs/hwui/thread/CommonPool.h b/libs/hwui/thread/CommonPool.h
index aef2990..7603eee 100644
--- a/libs/hwui/thread/CommonPool.h
+++ b/libs/hwui/thread/CommonPool.h
@@ -57,11 +57,13 @@
mHead = newHead;
}
- constexpr T&& pop() {
+ constexpr T pop() {
LOG_ALWAYS_FATAL_IF(mTail == mHead, "empty");
int index = mTail;
mTail = (mTail + 1) % SIZE;
- return std::move(mBuffer[index]);
+ T ret = std::move(mBuffer[index]);
+ mBuffer[index] = nullptr;
+ return ret;
}
private:
@@ -95,11 +97,17 @@
return task.get_future().get();
};
+ // For testing purposes only, blocks until all worker threads are parked.
+ static void waitForIdle();
+
private:
+ static CommonPool& instance();
+
CommonPool();
~CommonPool() {}
void enqueue(Task&&);
+ void doWaitForIdle();
void workerLoop();
diff --git a/libs/hwui/utils/Color.cpp b/libs/hwui/utils/Color.cpp
index d14116f..39740bd 100644
--- a/libs/hwui/utils/Color.cpp
+++ b/libs/hwui/utils/Color.cpp
@@ -60,6 +60,9 @@
}
sk_sp<SkColorSpace> DataSpaceToColorSpace(android_dataspace dataspace) {
+ if (dataspace == HAL_DATASPACE_UNKNOWN) {
+ return SkColorSpace::MakeSRGB();
+ }
skcms_Matrix3x3 gamut;
switch (dataspace & HAL_DATASPACE_STANDARD_MASK) {
diff --git a/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java b/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java
index 74057be..ff40d8e 100644
--- a/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java
+++ b/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java
@@ -20,14 +20,12 @@
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
-import android.graphics.drawable.Drawable;
import android.location.SettingInjectorService;
import android.os.Bundle;
import android.os.Handler;
@@ -37,9 +35,9 @@
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
+import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.AttributeSet;
-import android.util.IconDrawableFactory;
import android.util.Log;
import android.util.Xml;
@@ -56,8 +54,8 @@
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
/**
@@ -157,22 +155,8 @@
* Adds the InjectedSetting information to a Preference object
*/
private void populatePreference(Preference preference, InjectedSetting setting) {
- final PackageManager pm = mContext.getPackageManager();
- Drawable appIcon = null;
- try {
- final PackageItemInfo itemInfo = new PackageItemInfo();
- itemInfo.icon = setting.iconId;
- itemInfo.packageName = setting.packageName;
- final ApplicationInfo appInfo = pm.getApplicationInfo(setting.packageName,
- PackageManager.GET_META_DATA);
- appIcon = IconDrawableFactory.newInstance(mContext)
- .getBadgedIcon(itemInfo, appInfo, setting.mUserHandle.getIdentifier());
- } catch (PackageManager.NameNotFoundException e) {
- Log.e(TAG, "Can't get ApplicationInfo for " + setting.packageName, e);
- }
preference.setTitle(setting.title);
preference.setSummary(R.string.loading_injected_setting_summary);
- preference.setIcon(appIcon);
preference.setOnPreferenceClickListener(new ServiceSettingClickedListener(setting));
}
@@ -182,13 +166,15 @@
* @param profileId Identifier of the user/profile to obtain the injected settings for or
* UserHandle.USER_CURRENT for all profiles associated with current user.
*/
- public List<Preference> getInjectedSettings(Context prefContext, final int profileId) {
+ public Map<Integer, List<Preference>> getInjectedSettings(Context prefContext,
+ final int profileId) {
final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
final List<UserHandle> profiles = um.getUserProfiles();
- ArrayList<Preference> prefs = new ArrayList<>();
+ final ArrayMap<Integer, List<Preference>> result = new ArrayMap<>();
mSettings.clear();
for (UserHandle userHandle : profiles) {
if (profileId == UserHandle.USER_CURRENT || profileId == userHandle.getIdentifier()) {
+ final List<Preference> prefs = new ArrayList<>();
Iterable<InjectedSetting> settings = getSettings(userHandle);
for (InjectedSetting setting : settings) {
Preference preference = createPreference(prefContext, setting);
@@ -196,12 +182,14 @@
prefs.add(preference);
mSettings.add(new Setting(setting, preference));
}
+ if (!prefs.isEmpty()) {
+ result.put(userHandle.getIdentifier(), prefs);
+ }
}
}
reloadStatusMessages();
-
- return prefs;
+ return result;
}
/**
@@ -303,28 +291,6 @@
}
/**
- * Checks wheteher there is any preference that other apps have injected.
- *
- * @param profileId Identifier of the user/profile to obtain the injected settings for or
- * UserHandle.USER_CURRENT for all profiles associated with current user.
- */
- public boolean hasInjectedSettings(final int profileId) {
- final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
- final List<UserHandle> profiles = um.getUserProfiles();
- final int profileCount = profiles.size();
- for (int i = 0; i < profileCount; ++i) {
- final UserHandle userHandle = profiles.get(i);
- if (profileId == UserHandle.USER_CURRENT || profileId == userHandle.getIdentifier()) {
- Iterable<InjectedSetting> settings = getSettings(userHandle);
- for (InjectedSetting setting : settings) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
* Reloads the status messages for all the preference items.
*/
public void reloadStatusMessages() {
diff --git a/packages/SystemUI/res/values-mcc310-mnc030/config.xml b/packages/SystemUI/res/values-mcc310-mnc030/config.xml
new file mode 100644
index 0000000..26b9192
--- /dev/null
+++ b/packages/SystemUI/res/values-mcc310-mnc030/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources>
+ <!-- Enable 5 bar signal strength icon -->
+ <bool name="config_inflateSignalStrength">true</bool>
+</resources>
+
diff --git a/packages/SystemUI/res/values-mcc310-mnc070/config.xml b/packages/SystemUI/res/values-mcc310-mnc070/config.xml
new file mode 100644
index 0000000..26b9192
--- /dev/null
+++ b/packages/SystemUI/res/values-mcc310-mnc070/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources>
+ <!-- Enable 5 bar signal strength icon -->
+ <bool name="config_inflateSignalStrength">true</bool>
+</resources>
+
diff --git a/packages/SystemUI/res/values-mcc310-mnc170/config.xml b/packages/SystemUI/res/values-mcc310-mnc170/config.xml
new file mode 100644
index 0000000..26b9192
--- /dev/null
+++ b/packages/SystemUI/res/values-mcc310-mnc170/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources>
+ <!-- Enable 5 bar signal strength icon -->
+ <bool name="config_inflateSignalStrength">true</bool>
+</resources>
+
diff --git a/packages/SystemUI/res/values-mcc310-mnc280/config.xml b/packages/SystemUI/res/values-mcc310-mnc280/config.xml
new file mode 100644
index 0000000..26b9192
--- /dev/null
+++ b/packages/SystemUI/res/values-mcc310-mnc280/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources>
+ <!-- Enable 5 bar signal strength icon -->
+ <bool name="config_inflateSignalStrength">true</bool>
+</resources>
+
diff --git a/packages/SystemUI/res/values-mcc310-mnc380/config.xml b/packages/SystemUI/res/values-mcc310-mnc380/config.xml
new file mode 100644
index 0000000..26b9192
--- /dev/null
+++ b/packages/SystemUI/res/values-mcc310-mnc380/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources>
+ <!-- Enable 5 bar signal strength icon -->
+ <bool name="config_inflateSignalStrength">true</bool>
+</resources>
+
diff --git a/packages/SystemUI/res/values-mcc310-mnc410/config.xml b/packages/SystemUI/res/values-mcc310-mnc410/config.xml
new file mode 100644
index 0000000..26b9192
--- /dev/null
+++ b/packages/SystemUI/res/values-mcc310-mnc410/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources>
+ <!-- Enable 5 bar signal strength icon -->
+ <bool name="config_inflateSignalStrength">true</bool>
+</resources>
+
diff --git a/packages/SystemUI/res/values-mcc310-mnc560/config.xml b/packages/SystemUI/res/values-mcc310-mnc560/config.xml
new file mode 100644
index 0000000..26b9192
--- /dev/null
+++ b/packages/SystemUI/res/values-mcc310-mnc560/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources>
+ <!-- Enable 5 bar signal strength icon -->
+ <bool name="config_inflateSignalStrength">true</bool>
+</resources>
+
diff --git a/packages/SystemUI/res/values-mcc310-mnc950/config.xml b/packages/SystemUI/res/values-mcc310-mnc950/config.xml
new file mode 100644
index 0000000..26b9192
--- /dev/null
+++ b/packages/SystemUI/res/values-mcc310-mnc950/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources>
+ <!-- Enable 5 bar signal strength icon -->
+ <bool name="config_inflateSignalStrength">true</bool>
+</resources>
+
diff --git a/packages/SystemUI/res/values-mcc311-mnc180/config.xml b/packages/SystemUI/res/values-mcc311-mnc180/config.xml
new file mode 100644
index 0000000..26b9192
--- /dev/null
+++ b/packages/SystemUI/res/values-mcc311-mnc180/config.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. -->
+<resources>
+ <!-- Enable 5 bar signal strength icon -->
+ <bool name="config_inflateSignalStrength">true</bool>
+</resources>
+
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java
index 4fe09a9..665df77 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java
@@ -26,16 +26,41 @@
*/
class Bubble {
+ private final String mKey;
+ private final BubbleExpandedView.OnBubbleBlockedListener mListener;
+
+ private boolean mInflated;
+
public BubbleView iconView;
public BubbleExpandedView expandedView;
- public String key;
public NotificationEntry entry;
+ Bubble(NotificationEntry e, BubbleExpandedView.OnBubbleBlockedListener listener) {
+ entry = e;
+ mKey = e.key;
+ mListener = listener;
+ }
+
+ /** @deprecated use the other constructor to defer View creation. */
+ @Deprecated
Bubble(NotificationEntry e, LayoutInflater inflater, BubbleStackView stackView,
BubbleExpandedView.OnBubbleBlockedListener listener) {
- entry = e;
- key = entry.key;
+ this(e, listener);
+ inflate(inflater, stackView);
+ }
+ public String getKey() {
+ return mKey;
+ }
+
+ boolean isInflated() {
+ return mInflated;
+ }
+
+ void inflate(LayoutInflater inflater, BubbleStackView stackView) {
+ if (mInflated) {
+ return;
+ }
iconView = (BubbleView) inflater.inflate(
R.layout.bubble_view, stackView, false /* attachToRoot */);
iconView.setNotif(entry);
@@ -44,12 +69,14 @@
R.layout.bubble_expanded_view, stackView, false /* attachToRoot */);
expandedView.setEntry(entry, stackView);
- expandedView.setOnBlockedListener(listener);
+ expandedView.setOnBlockedListener(mListener);
+ mInflated = true;
}
- public void setEntry(NotificationEntry entry) {
- key = entry.key;
- iconView.update(entry);
- expandedView.update(entry);
+ void setEntry(NotificationEntry entry) {
+ if (mInflated) {
+ iconView.update(entry);
+ expandedView.update(entry);
+ }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 5acf3c2..418d052e 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -220,6 +220,26 @@
mSurfaceSynchronizer = synchronizer;
}
+ /**
+ * BubbleStackView is lazily created by this method the first time a Bubble is added. This
+ * method initializes the stack view and adds it to the StatusBar just above the scrim.
+ */
+ private void ensureStackViewCreated() {
+ if (mStackView == null) {
+ mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
+ ViewGroup sbv = mStatusBarWindowController.getStatusBarView();
+ // TODO(b/130237686): When you expand the shade on top of expanded bubble, there is no
+ // scrim between bubble and the shade
+ int bubblePosition = sbv.indexOfChild(sbv.findViewById(R.id.scrim_behind)) + 1;
+ sbv.addView(mStackView, bubblePosition,
+ new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
+ if (mExpandListener != null) {
+ mStackView.setExpandListener(mExpandListener);
+ }
+ mStackView.setOnBlockedListener(this);
+ }
+ }
+
@Override
public void onUiModeChanged() {
if (mStackView != null) {
@@ -325,27 +345,15 @@
/**
* Adds or updates a bubble associated with the provided notification entry.
*
- * @param notif the notification associated with this bubble.
+ * @param notif the notification associated with this bubble.
*/
void updateBubble(NotificationEntry notif) {
if (mStackView != null && mBubbleData.getBubble(notif.key) != null) {
// It's an update
mStackView.updateBubble(notif);
} else {
- if (mStackView == null) {
- mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
- ViewGroup sbv = mStatusBarWindowController.getStatusBarView();
- // XXX: Bug when you expand the shade on top of expanded bubble, there is no scrim
- // between bubble and the shade
- int bubblePosition = sbv.indexOfChild(sbv.findViewById(R.id.scrim_behind)) + 1;
- sbv.addView(mStackView, bubblePosition,
- new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
- if (mExpandListener != null) {
- mStackView.setExpandListener(mExpandListener);
- }
- mStackView.setOnBlockedListener(this);
- }
// It's new
+ ensureStackViewCreated();
mStackView.addBubble(notif);
}
if (shouldAutoExpand(notif)) {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
index cf70287..fe3f9d1 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
@@ -106,7 +106,7 @@
}
public void addBubble(Bubble b) {
- mBubbles.put(b.key, b);
+ mBubbles.put(b.getKey(), b);
}
@Nullable
diff --git a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java
index d1939d0..477e7d7e 100644
--- a/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/glwallpaper/ImageProcessHelper.java
@@ -85,9 +85,7 @@
Bitmap bitmap = bitmaps[0];
if (bitmap != null) {
int[] histogram = processHistogram(bitmap);
- Float val = computePercentile85(bitmap, histogram);
- bitmaps[0] = null;
- return val;
+ return computePercentile85(bitmap, histogram);
}
Log.e(TAG, "Per85ComputeTask: Can't get bitmap");
return DEFAULT_PER85;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 15848d8..3441591 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -83,7 +83,7 @@
private final int mSlowThreshold;
private final int mFastThreshold;
- private LockIcon mLockIcon;
+ private final LockIcon mLockIcon;
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private String mRestingIndication;
@@ -672,5 +672,10 @@
updateIndication(false);
}
}
+
+ @Override
+ public void onKeyguardBouncerChanged(boolean bouncer) {
+ mLockIcon.setBouncerVisible(bouncer);
+ }
};
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index 6ebd6b3..3cc4a7b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -57,8 +57,10 @@
private int mDensity;
private boolean mPulsing;
private boolean mDozing;
+ private boolean mBouncerVisible;
private boolean mLastDozing;
private boolean mLastPulsing;
+ private boolean mLastBouncerVisible;
private final Runnable mDrawOffTimeout = () -> update(true /* forceUpdate */);
private float mDarkAmount;
@@ -109,9 +111,9 @@
int state = getState();
mIsFaceUnlockState = state == STATE_SCANNING_FACE;
if (state != mLastState || mLastDozing != mDozing || mLastPulsing != mPulsing
- || mLastScreenOn != mScreenOn || force) {
+ || mLastScreenOn != mScreenOn || mLastBouncerVisible != mBouncerVisible || force) {
int iconAnimRes = getAnimationResForTransition(mLastState, state, mLastPulsing,
- mPulsing, mLastDozing, mDozing);
+ mPulsing, mLastDozing, mDozing, mBouncerVisible);
boolean isAnim = iconAnimRes != -1;
Drawable icon;
@@ -159,6 +161,7 @@
mLastScreenOn = mScreenOn;
mLastDozing = mDozing;
mLastPulsing = mPulsing;
+ mLastBouncerVisible = mBouncerVisible;
}
setVisibility(mDozing && !mPulsing ? GONE : VISIBLE);
@@ -231,8 +234,8 @@
}
private static int getAnimationResForTransition(int oldState, int newState,
- boolean wasPulsing, boolean pulsing,
- boolean wasDozing, boolean dozing) {
+ boolean wasPulsing, boolean pulsing, boolean wasDozing, boolean dozing,
+ boolean bouncerVisible) {
// Never animate when screen is off
if (dozing && !pulsing) {
@@ -249,7 +252,7 @@
return com.android.internal.R.anim.lock_unlock;
} else if (justLocked) {
return com.android.internal.R.anim.lock_lock;
- } else if (newState == STATE_SCANNING_FACE) {
+ } else if (newState == STATE_SCANNING_FACE && bouncerVisible) {
return com.android.internal.R.anim.lock_scanning;
} else if (!wasPulsing && pulsing && newState != STATE_LOCK_OPEN) {
return com.android.internal.R.anim.lock_in;
@@ -298,4 +301,15 @@
int color = ColorUtils.blendARGB(Color.TRANSPARENT, Color.WHITE, mDarkAmount);
drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
}
+
+ /**
+ * If bouncer is visible or not.
+ */
+ public void setBouncerVisible(boolean bouncerVisible) {
+ if (mBouncerVisible == bouncerVisible) {
+ return;
+ }
+ mBouncerVisible = bouncerVisible;
+ update();
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index 15854e6..8f135c8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -75,6 +75,7 @@
private SignalStrength mSignalStrength;
private MobileIconGroup mDefaultIcons;
private Config mConfig;
+ private boolean mInflateSignalStrengths = false;
// Some specific carriers have 5GE network which is special LTE CA network.
private static final int NETWORK_TYPE_LTE_CA_5GE = TelephonyManager.MAX_NETWORK_TYPE + 1;
@@ -118,6 +119,7 @@
public void setConfiguration(Config config) {
mConfig = config;
+ updateInflateSignalStrength();
mapIconSets();
updateTelephony();
}
@@ -245,8 +247,14 @@
mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_IWLAN, TelephonyIcons.WFC);
}
+ private void updateInflateSignalStrength() {
+ mInflateSignalStrengths = SubscriptionManager.getResourcesForSubId(mContext,
+ mSubscriptionInfo.getSubscriptionId())
+ .getBoolean(R.bool.config_inflateSignalStrength);
+ }
+
private int getNumLevels() {
- if (mConfig.inflateSignalStrengths) {
+ if (mInflateSignalStrengths) {
return SignalStrength.NUM_SIGNAL_STRENGTH_BINS + 1;
}
return SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
@@ -258,7 +266,7 @@
return SignalDrawable.getCarrierChangeState(getNumLevels());
} else if (mCurrentState.connected) {
int level = mCurrentState.level;
- if (mConfig.inflateSignalStrengths) {
+ if (mInflateSignalStrengths) {
level++;
}
boolean dataDisabled = mCurrentState.userSetup
@@ -561,6 +569,7 @@
pw.println(" mSignalStrength=" + mSignalStrength + ",");
pw.println(" mDataState=" + mDataState + ",");
pw.println(" mDataNetType=" + mDataNetType + ",");
+ pw.println(" mInflateSignalStrengths=" + mInflateSignalStrengths + ",");
}
class MobilePhoneStateListener extends PhoneStateListener {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index ea0dd33..faf63c8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -55,6 +55,7 @@
import android.util.MathUtils;
import android.util.SparseArray;
+import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
@@ -108,16 +109,10 @@
private final SubscriptionDefaults mSubDefaults;
private final DataSaverController mDataSaverController;
private final CurrentUserTracker mUserTracker;
+ private final Object mLock = new Object();
private Config mConfig;
- private PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
- @Override
- public void onActiveDataSubscriptionIdChanged(int subId) {
- mActiveMobileDataSubscription = subId;
- doUpdateMobileControllers();
- }
- };
-
+ private PhoneStateListener mPhoneStateListener;
private int mActiveMobileDataSubscription = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
// Subcontrollers.
@@ -279,6 +274,14 @@
// TODO: Move off of the deprecated CONNECTIVITY_ACTION broadcast and rely on callbacks
// exclusively for status bar icons.
mConnectivityManager.registerDefaultNetworkCallback(callback, mReceiverHandler);
+ // Register the listener on our bg looper
+ mPhoneStateListener = new PhoneStateListener(bgLooper) {
+ @Override
+ public void onActiveDataSubscriptionIdChanged(int subId) {
+ mActiveMobileDataSubscription = subId;
+ doUpdateMobileControllers();
+ }
+ };
}
public DataSaverController getDataSaverController() {
@@ -600,7 +603,9 @@
updateNoSims();
return;
}
- setCurrentSubscriptions(subscriptions);
+ synchronized (mLock) {
+ setCurrentSubscriptionsLocked(subscriptions);
+ }
updateNoSims();
recalculateEmergency();
}
@@ -628,8 +633,9 @@
return false;
}
+ @GuardedBy("mLock")
@VisibleForTesting
- void setCurrentSubscriptions(List<SubscriptionInfo> subscriptions) {
+ public void setCurrentSubscriptionsLocked(List<SubscriptionInfo> subscriptions) {
Collections.sort(subscriptions, new Comparator<SubscriptionInfo>() {
@Override
public int compare(SubscriptionInfo lhs, SubscriptionInfo rhs) {
diff --git a/packages/SystemUI/src/com/android/systemui/volume/Events.java b/packages/SystemUI/src/com/android/systemui/volume/Events.java
index 2a84c5d..9bbfd22 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/Events.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/Events.java
@@ -94,7 +94,6 @@
public static final int DISMISS_STREAM_GONE = 7;
public static final int DISMISS_REASON_OUTPUT_CHOOSER = 8;
public static final int DISMISS_REASON_USB_OVERHEAD_ALARM_CHANGED = 9;
- public static final int DISMISS_REASON_ODI_CAPTIONS_CLICKED = 10;
public static final String[] DISMISS_REASONS = {
"unknown",
"touch_outside",
@@ -105,8 +104,7 @@
"done_clicked",
"a11y_stream_changed",
"output_chooser",
- "usb_temperature_below_threshold",
- "odi_captions_clicked"
+ "usb_temperature_below_threshold"
};
public static final int SHOW_REASON_UNKNOWN = 0;
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index 2094b36..5095370 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -30,7 +30,6 @@
import static android.view.View.VISIBLE;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
-import static com.android.systemui.volume.Events.DISMISS_REASON_ODI_CAPTIONS_CLICKED;
import static com.android.systemui.volume.Events.DISMISS_REASON_SETTINGS_CLICKED;
import android.animation.ObjectAnimator;
@@ -519,7 +518,6 @@
mODICaptionsIcon.setOnConfirmedTapListener(() -> {
onCaptionIconClicked();
Events.writeEvent(mContext, Events.EVENT_ODI_CAPTIONS_CLICK);
- dismissH(DISMISS_REASON_ODI_CAPTIONS_CLICKED);
}, mHandler);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index ac6544e..0b53c48 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -300,7 +300,7 @@
// We can only test whether unregister gets called if it thinks its in a listening
// state.
mNetworkController.mListening = true;
- mNetworkController.setCurrentSubscriptions(subscriptions);
+ mNetworkController.setCurrentSubscriptionsLocked(subscriptions);
for (int i = 0; i < testSubscriptions.length; i++) {
if (i == indexToSkipController) {
diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
index a3e7d36..54a3ecb 100644
--- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
+++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
@@ -166,6 +166,9 @@
@Override
public void onUnlockUser(int userHandle) {
Set<Association> associations = readAllAssociations(userHandle);
+ if (associations == null || associations.isEmpty()) {
+ return;
+ }
Set<String> companionAppPackages = new HashSet<>();
for (Association association : associations) {
companionAppPackages.add(association.companionAppPackage);
diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java
index 2cfcecc..2055b64 100644
--- a/services/core/java/com/android/server/IpSecService.java
+++ b/services/core/java/com/android/server/IpSecService.java
@@ -208,6 +208,7 @@
mBinder.linkToDeath(this, 0);
} catch (RemoteException e) {
binderDied();
+ e.rethrowFromSystemServer();
}
}
}
diff --git a/services/core/java/com/android/server/pm/ApexManager.java b/services/core/java/com/android/server/pm/ApexManager.java
index 944aef5..21b6f12 100644
--- a/services/core/java/com/android/server/pm/ApexManager.java
+++ b/services/core/java/com/android/server/pm/ApexManager.java
@@ -324,6 +324,8 @@
ipw.println("State: ROLLBACK IN PROGRESS");
} else if (si.isRolledBack) {
ipw.println("State: ROLLED BACK");
+ } else if (si.isRollbackFailed) {
+ ipw.println("State: ROLLBACK FAILED");
}
ipw.decreaseIndent();
}
diff --git a/services/core/java/com/android/server/pm/StagingManager.java b/services/core/java/com/android/server/pm/StagingManager.java
index a0f0a31..1908b3f 100644
--- a/services/core/java/com/android/server/pm/StagingManager.java
+++ b/services/core/java/com/android/server/pm/StagingManager.java
@@ -565,7 +565,8 @@
// isRollbackInProgress is included to cover the scenario, when a device is rebooted in
// during the rollback, and apexd fails to resume the rollback after reboot.
return apexSessionInfo.isActivationFailed || apexSessionInfo.isUnknown
- || apexSessionInfo.isRolledBack || apexSessionInfo.isRollbackInProgress;
+ || apexSessionInfo.isRolledBack || apexSessionInfo.isRollbackInProgress
+ || apexSessionInfo.isRollbackFailed;
}
@GuardedBy("mStagedSessions")
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index 5df2f86..b819aa5 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -302,6 +302,7 @@
}
public void grantDefaultPermissions(int userId) {
+ removeSystemFixedStorage(userId);
grantPermissionsToSysComponentsAndPrivApps(userId);
grantDefaultSystemHandlerPermissions(userId);
grantDefaultPermissionExceptions(userId);
@@ -310,6 +311,46 @@
}
}
+ // STOPSHIP: This is meant to fix the devices messed up by storage permission model 2 and
+ // should be removed once all devices were updated
+ private void removeSystemFixedStorage(int userId) {
+ List<PackageInfo> packages = mContext.getPackageManager().getInstalledPackagesAsUser(
+ DEFAULT_PACKAGE_INFO_QUERY_FLAGS, userId);
+
+ for (PackageInfo pkg : packages) {
+ if (pkg == null || pkg.requestedPermissions == null) {
+ continue;
+ }
+
+ for (String permission : pkg.requestedPermissions) {
+ if (!(Manifest.permission.READ_EXTERNAL_STORAGE.equals(permission)
+ || Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permission))) {
+ continue;
+ }
+
+ int flags = mContext.getPackageManager().getPermissionFlags(permission,
+ pkg.packageName, UserHandle.of(userId));
+ if ((flags & PackageManager.FLAG_PERMISSION_SYSTEM_FIXED) == 0) {
+ continue;
+ }
+
+ Log.v(TAG, "Removing system fixed " + pkg.packageName + "/" + permission);
+ mContext.getPackageManager().updatePermissionFlags(permission, pkg.packageName,
+ PackageManager.FLAG_PERMISSION_SYSTEM_FIXED, 0, UserHandle.of(userId));
+
+ if (!doesPackageSupportRuntimePermissions(pkg)
+ || (flags & (PackageManager.FLAG_PERMISSION_USER_SET
+ | PackageManager.FLAG_PERMISSION_POLICY_FIXED)) != 0) {
+ continue;
+ }
+
+ Log.v(TAG, "Revoking " + pkg.packageName + "/" + permission);
+ mContext.getPackageManager().revokeRuntimePermission(pkg.packageName, permission,
+ UserHandle.of(userId));
+ }
+ }
+ }
+
private void grantRuntimePermissionsForSystemPackage(int userId, PackageInfo pkg) {
Set<String> permissions = new ArraySet<>();
for (String permission : pkg.requestedPermissions) {
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
index b078825..bafcd5f 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -4289,6 +4289,36 @@
}
@Test
+ public void testFlagBubble() throws RemoteException {
+ // Bubbles are allowed!
+ mService.setPreferencesHelper(mPreferencesHelper);
+ when(mPreferencesHelper.areBubblesAllowed(anyString(), anyInt())).thenReturn(true);
+ when(mPreferencesHelper.getNotificationChannel(
+ anyString(), anyInt(), anyString(), anyBoolean())).thenReturn(
+ mTestNotificationChannel);
+ when(mPreferencesHelper.getImportance(anyString(), anyInt())).thenReturn(
+ mTestNotificationChannel.getImportance());
+
+ // Notif with bubble metadata but not our other misc requirements
+ NotificationRecord nr = generateNotificationRecord(mTestNotificationChannel,
+ null /* tvExtender */, true /* isBubble */);
+
+ // Say we're foreground
+ when(mActivityManager.getPackageImportance(nr.sbn.getPackageName())).thenReturn(
+ IMPORTANCE_FOREGROUND);
+
+ mBinderService.enqueueNotificationWithTag(PKG, PKG, "tag",
+ nr.sbn.getId(), nr.sbn.getNotification(), nr.sbn.getUserId());
+ waitForIdle();
+
+ StatusBarNotification[] notifs = mBinderService.getActiveNotifications(PKG);
+ assertEquals(1, notifs.length);
+ assertTrue((notifs[0].getNotification().flags & FLAG_BUBBLE) != 0);
+ assertTrue(mService.getNotificationRecord(
+ nr.sbn.getKey()).getNotification().isBubbleNotification());
+ }
+
+ @Test
public void testFlagBubbleNotifs_flag_appForeground() throws RemoteException {
// Bubbles are allowed!
mService.setPreferencesHelper(mPreferencesHelper);
diff --git a/tests/net/java/com/android/server/IpSecServiceRefcountedResourceTest.java b/tests/net/java/com/android/server/IpSecServiceRefcountedResourceTest.java
index 68ff777..22a2c94 100644
--- a/tests/net/java/com/android/server/IpSecServiceRefcountedResourceTest.java
+++ b/tests/net/java/com/android/server/IpSecServiceRefcountedResourceTest.java
@@ -18,6 +18,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.eq;
@@ -134,11 +135,11 @@
IBinder binderMock = mock(IBinder.class);
doThrow(new RemoteException()).when(binderMock).linkToDeath(anyObject(), anyInt());
- RefcountedResource<IResource> refcountedResource = getTestRefcountedResource(binderMock);
-
- // Verify that cleanup is performed (Spy limitations prevent verification of method calls
- // for binder death scenario; check refcount to determine if cleanup was performed.)
- assertEquals(-1, refcountedResource.mRefCount);
+ try {
+ getTestRefcountedResource(binderMock);
+ fail("Expected exception to propogate when binder fails to link to death");
+ } catch (RuntimeException expected) {
+ }
}
@Test