Merge "Update media's mainline OWNERS"
diff --git a/.gitignore b/.gitignore
index c47cc8b..2dffb7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.idea
+.project
*.iml
*.sw*
gen/
\ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 1fbdc15..d5a81c4 100644
--- a/Android.bp
+++ b/Android.bp
@@ -228,6 +228,12 @@
"android.hardware.radio-V1.4-java",
"android.hardware.radio-V1.5-java",
"android.hardware.radio-V1.6-java",
+ "android.hardware.radio.data-V1-java",
+ "android.hardware.radio.messaging-V1-java",
+ "android.hardware.radio.modem-V1-java",
+ "android.hardware.radio.network-V1-java",
+ "android.hardware.radio.sim-V1-java",
+ "android.hardware.radio.voice-V1-java",
"android.hardware.thermal-V1.0-java-constants",
"android.hardware.thermal-V1.0-java",
"android.hardware.thermal-V1.1-java",
diff --git a/OWNERS b/OWNERS
index ab5bd18..47d8c83 100644
--- a/OWNERS
+++ b/OWNERS
@@ -29,10 +29,7 @@
# Support bulk translation updates
per-file */res*/values*/*.xml = byi@google.com, delphij@google.com
-per-file Android.bp = file:platform/build/soong:/OWNERS
-per-file Android.mk = file:platform/build/soong:/OWNERS
-per-file ApiDocs.bp = file:platform/build/soong:/OWNERS
-per-file StubLibraries.bp = file:platform/build/soong:/OWNERS
-per-file ProtoLibraries.bp = file:platform/build/soong:/OWNERS
+per-file *.bp = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION}
+per-file Android.mk = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION}
per-file TestProtoLibraries.bp = file:platform/platform_testing:/libraries/health/OWNERS
per-file TestProtoLibraries.bp = file:platform/tools/tradefederation:/OWNERS
diff --git a/core/api/current.txt b/core/api/current.txt
index 93ef8f8..371e2e3 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -10253,6 +10253,8 @@
field public static final String NSD_SERVICE = "servicediscovery";
field public static final String POWER_SERVICE = "power";
field public static final String PRINT_SERVICE = "print";
+ field public static final int RECEIVER_EXPORTED = 2; // 0x2
+ field public static final int RECEIVER_NOT_EXPORTED = 4; // 0x4
field public static final int RECEIVER_VISIBLE_TO_INSTANT_APPS = 1; // 0x1
field public static final String RESTRICTIONS_SERVICE = "restrictions";
field public static final String ROLE_SERVICE = "role";
@@ -29976,6 +29978,7 @@
method public boolean hasFileDescriptors();
method public byte[] marshall();
method @NonNull public static android.os.Parcel obtain();
+ method @NonNull public static android.os.Parcel obtain(@NonNull android.os.IBinder);
method @Nullable public Object[] readArray(@Nullable ClassLoader);
method @Nullable public java.util.ArrayList readArrayList(@Nullable ClassLoader);
method public void readBinderArray(@NonNull android.os.IBinder[]);
@@ -38050,6 +38053,7 @@
field public static final int CAPABILITY_MANAGE_CONFERENCE = 128; // 0x80
field public static final int CAPABILITY_MERGE_CONFERENCE = 4; // 0x4
field public static final int CAPABILITY_MUTE = 64; // 0x40
+ field public static final int CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT = 268435456; // 0x10000000
field public static final int CAPABILITY_RESPOND_VIA_TEXT = 32; // 0x20
field public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 4096; // 0x1000
field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL = 768; // 0x300
@@ -38329,6 +38333,7 @@
field public static final int CAPABILITY_MANAGE_CONFERENCE = 128; // 0x80
field public static final int CAPABILITY_MERGE_CONFERENCE = 4; // 0x4
field public static final int CAPABILITY_MUTE = 64; // 0x40
+ field public static final int CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT = 536870912; // 0x20000000
field public static final int CAPABILITY_RESPOND_VIA_TEXT = 32; // 0x20
field public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 4096; // 0x1000
field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL = 768; // 0x300
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index e601583..a61851d 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -1861,6 +1861,7 @@
method @Nullable public abstract java.io.File getPreloadsFileCache();
method public abstract boolean isCredentialProtectedStorage();
method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public android.content.Intent registerReceiverForAllUsers(@Nullable android.content.BroadcastReceiver, @NonNull android.content.IntentFilter, @Nullable String, @Nullable android.os.Handler);
+ method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public android.content.Intent registerReceiverForAllUsers(@Nullable android.content.BroadcastReceiver, @NonNull android.content.IntentFilter, @Nullable String, @Nullable android.os.Handler, int);
method public abstract void sendBroadcast(android.content.Intent, @Nullable String, @Nullable android.os.Bundle);
method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public abstract void sendBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String, @Nullable android.os.Bundle);
method public abstract void sendOrderedBroadcast(@NonNull android.content.Intent, @Nullable String, @Nullable android.os.Bundle, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 749e8f5..7c140d6 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -3724,7 +3724,6 @@
Intent intent = new Intent(activityIntent);
intent.setFlags(intent.getFlags() & ~(Intent.FLAG_GRANT_WRITE_URI_PERMISSION
| Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION));
- intent.removeUnsafeExtras();
content.setDefaultIntent(intent);
}
} else {
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 12c9cd9..14fb245 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1635,12 +1635,26 @@
}
@Override
+ public Intent registerReceiverForAllUsers(BroadcastReceiver receiver,
+ IntentFilter filter, String broadcastPermission, Handler scheduler, int flags) {
+ return registerReceiverAsUser(receiver, UserHandle.ALL,
+ filter, broadcastPermission, scheduler, flags);
+ }
+
+ @Override
public Intent registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user,
IntentFilter filter, String broadcastPermission, Handler scheduler) {
return registerReceiverInternal(receiver, user.getIdentifier(),
filter, broadcastPermission, scheduler, getOuterContext(), 0);
}
+ @Override
+ public Intent registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user,
+ IntentFilter filter, String broadcastPermission, Handler scheduler, int flags) {
+ return registerReceiverInternal(receiver, user.getIdentifier(),
+ filter, broadcastPermission, scheduler, getOuterContext(), flags);
+ }
+
private Intent registerReceiverInternal(BroadcastReceiver receiver, int userId,
IntentFilter filter, String broadcastPermission,
Handler scheduler, Context context, int flags) {
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 4293ab0..b4a4c90 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -483,8 +483,8 @@
| Context.BIND_NOT_PERCEPTIBLE | Context.BIND_NOT_VISIBLE;
/** @hide */
- @IntDef(flag = true, prefix = { "RECEIVER_VISIBLE_" }, value = {
- RECEIVER_VISIBLE_TO_INSTANT_APPS
+ @IntDef(flag = true, prefix = { "RECEIVER_VISIBLE" }, value = {
+ RECEIVER_VISIBLE_TO_INSTANT_APPS, RECEIVER_EXPORTED, RECEIVER_NOT_EXPORTED
})
@Retention(RetentionPolicy.SOURCE)
public @interface RegisterReceiverFlags {}
@@ -495,6 +495,18 @@
public static final int RECEIVER_VISIBLE_TO_INSTANT_APPS = 0x1;
/**
+ * Flag for {@link #registerReceiver}: The receiver can receive broadcasts from other Apps.
+ * Has the same behavior as marking a statically registered receiver with "exported=true"
+ */
+ public static final int RECEIVER_EXPORTED = 0x2;
+
+ /**
+ * Flag for {@link #registerReceiver}: The receiver cannot receive broadcasts from other Apps.
+ * Has the same behavior as marking a statically registered receiver with "exported=false"
+ */
+ public static final int RECEIVER_NOT_EXPORTED = 0x4;
+
+ /**
* Returns an AssetManager instance for the application's package.
* <p>
* <strong>Note:</strong> Implementations of this method should return
@@ -2881,8 +2893,12 @@
*
* @param receiver The BroadcastReceiver to handle the broadcast.
* @param filter Selects the Intent broadcasts to be received.
- * @param flags Additional options for the receiver. May be 0 or
- * {@link #RECEIVER_VISIBLE_TO_INSTANT_APPS}.
+ * @param flags Additional options for the receiver. As of
+ * Android T, either {@link #RECEIVER_EXPORTED} or
+ * {@link #RECEIVER_NOT_EXPORTED} must be specified if the receiver isn't being registered
+ * for protected broadcasts, and may additionally specify
+ * {@link #RECEIVER_VISIBLE_TO_INSTANT_APPS} if {@link #RECEIVER_EXPORTED} is
+ * specified.
*
* @return The first sticky intent found that matches <var>filter</var>,
* or null if there are none.
@@ -2954,8 +2970,12 @@
* no permission is required.
* @param scheduler Handler identifying the thread that will receive
* the Intent. If null, the main thread of the process will be used.
- * @param flags Additional options for the receiver. May be 0 or
- * {@link #RECEIVER_VISIBLE_TO_INSTANT_APPS}.
+ * @param flags Additional options for the receiver. As of
+ * Android T, either {@link #RECEIVER_EXPORTED} or
+ * {@link #RECEIVER_NOT_EXPORTED} must be specified if the receiver isn't being registered
+ * for protected broadcasts, and may additionally specify
+ * {@link #RECEIVER_VISIBLE_TO_INSTANT_APPS} if {@link #RECEIVER_EXPORTED} is
+ * specified.
*
* @return The first sticky intent found that matches <var>filter</var>,
* or null if there are none.
@@ -3002,6 +3022,42 @@
}
/**
+ * Same as {@link #registerReceiver(BroadcastReceiver, IntentFilter, String, Handler, int)}
+ * but this receiver will receive broadcasts that are sent to all users. The receiver can
+ * use {@link BroadcastReceiver#getSendingUser} to determine on which user the broadcast
+ * was sent.
+ *
+ * @param receiver The BroadcastReceiver to handle the broadcast.
+ * @param filter Selects the Intent broadcasts to be received.
+ * @param broadcastPermission String naming a permissions that a
+ * broadcaster must hold in order to send an Intent to you. If {@code null},
+ * no permission is required.
+ * @param scheduler Handler identifying the thread that will receive
+ * the Intent. If {@code null}, the main thread of the process will be used.
+ * @param flags Additional options for the receiver. As of
+ * Android T, either {@link #RECEIVER_EXPORTED} or
+ * {@link #RECEIVER_NOT_EXPORTED} must be specified if the receiver isn't being
+ * registered for protected broadcasts
+ *
+ * @return The first sticky intent found that matches <var>filter</var>,
+ * or {@code null} if there are none.
+ *
+ * @see #registerReceiver(BroadcastReceiver, IntentFilter, String, Handler, int)
+ * @see #sendBroadcast
+ * @see #unregisterReceiver
+ * @hide
+ */
+ @SuppressLint("IntentBuilderName")
+ @Nullable
+ @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
+ @SystemApi
+ public Intent registerReceiverForAllUsers(@Nullable BroadcastReceiver receiver,
+ @NonNull IntentFilter filter, @Nullable String broadcastPermission,
+ @Nullable Handler scheduler, @RegisterReceiverFlags int flags) {
+ throw new RuntimeException("Not implemented. Must override in a subclass.");
+ }
+
+ /**
* @hide
* Same as {@link #registerReceiver(BroadcastReceiver, IntentFilter, String, Handler)
* but for a specific user. This receiver will receiver broadcasts that
@@ -3032,6 +3088,41 @@
@Nullable Handler scheduler);
/**
+ * @hide
+ * Same as {@link #registerReceiver(BroadcastReceiver, IntentFilter, String, Handler, int)
+ * but for a specific user. This receiver will receiver broadcasts that
+ * are sent to the requested user.
+ *
+ * @param receiver The BroadcastReceiver to handle the broadcast.
+ * @param user UserHandle to send the intent to.
+ * @param filter Selects the Intent broadcasts to be received.
+ * @param broadcastPermission String naming a permissions that a
+ * broadcaster must hold in order to send an Intent to you. If null,
+ * no permission is required.
+ * @param scheduler Handler identifying the thread that will receive
+ * the Intent. If null, the main thread of the process will be used.
+ * @param flags Additional options for the receiver. As of
+ * Android T, either {@link #RECEIVER_EXPORTED} or
+ * {@link #RECEIVER_NOT_EXPORTED} must be specified if the receiver isn't being
+ * registered for protected broadcasts
+ *
+ * @return The first sticky intent found that matches <var>filter</var>,
+ * or null if there are none.
+ *
+ * @see #registerReceiver(BroadcastReceiver, IntentFilter, String, Handler, int)
+ * @see #sendBroadcast
+ * @see #unregisterReceiver
+ */
+ @SuppressWarnings("HiddenAbstractMethod")
+ @SuppressLint("IntentBuilderName")
+ @Nullable
+ @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
+ @UnsupportedAppUsage
+ public abstract Intent registerReceiverAsUser(BroadcastReceiver receiver,
+ UserHandle user, IntentFilter filter, @Nullable String broadcastPermission,
+ @Nullable Handler scheduler, @RegisterReceiverFlags int flags);
+
+ /**
* Unregister a previously registered BroadcastReceiver. <em>All</em>
* filters that have been registered for this BroadcastReceiver will be
* removed.
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
index e351c244..28c8664 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -732,14 +732,34 @@
/** @hide */
@Override
+ @Nullable
+ public Intent registerReceiverForAllUsers(@Nullable BroadcastReceiver receiver,
+ @NonNull IntentFilter filter, @Nullable String broadcastPermission,
+ @Nullable Handler scheduler, int flags) {
+ return mBase.registerReceiverForAllUsers(receiver, filter, broadcastPermission,
+ scheduler, flags);
+ }
+
+ /** @hide */
+ @Override
@UnsupportedAppUsage
- public Intent registerReceiverAsUser(
- BroadcastReceiver receiver, UserHandle user, IntentFilter filter,
- String broadcastPermission, Handler scheduler) {
+ public Intent registerReceiverAsUser(@Nullable BroadcastReceiver receiver, UserHandle user,
+ IntentFilter filter, @Nullable String broadcastPermission,
+ @Nullable Handler scheduler) {
return mBase.registerReceiverAsUser(receiver, user, filter, broadcastPermission,
scheduler);
}
+ /** @hide */
+ @Override
+ @UnsupportedAppUsage
+ public Intent registerReceiverAsUser(@Nullable BroadcastReceiver receiver, UserHandle user,
+ IntentFilter filter, @Nullable String broadcastPermission,
+ @Nullable Handler scheduler, int flags) {
+ return mBase.registerReceiverAsUser(receiver, user, filter, broadcastPermission,
+ scheduler, flags);
+ }
+
@Override
public void unregisterReceiver(BroadcastReceiver receiver) {
mBase.unregisterReceiver(receiver);
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 0fad63f..9746066 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -8568,16 +8568,6 @@
}
/**
- * Filter extras to only basic types.
- * @hide
- */
- public void removeUnsafeExtras() {
- if (mExtras != null) {
- mExtras = mExtras.filterValues();
- }
- }
-
- /**
* @return Whether {@link #maybeStripForHistory} will return an lightened intent or
* return itself as-is.
* @hide
diff --git a/core/java/android/os/BaseBundle.java b/core/java/android/os/BaseBundle.java
index 7ce8d72..2a344f6 100644
--- a/core/java/android/os/BaseBundle.java
+++ b/core/java/android/os/BaseBundle.java
@@ -43,18 +43,22 @@
protected static final String TAG = "Bundle";
static final boolean DEBUG = false;
- // Keep them in sync with frameworks/native/libs/binder/PersistableBundle.cpp.
- private static final int BUNDLE_MAGIC = 0x4C444E42; // 'B' 'N' 'D' 'L'
+ /**
+ * Keep them in sync with frameworks/native/libs/binder/PersistableBundle.cpp.
+ *
+ * @hide
+ */
+ @VisibleForTesting
+ static final int BUNDLE_MAGIC = 0x4C444E42; // 'B' 'N' 'D' 'L'
private static final int BUNDLE_MAGIC_NATIVE = 0x4C444E44; // 'B' 'N' 'D' 'N'
/**
- * Flag indicating that this Bundle is okay to "defuse." That is, it's okay
- * for system processes to ignore any {@link BadParcelableException}
- * encountered when unparceling it, leaving an empty bundle in its place.
+ * Flag indicating that this Bundle is okay to "defuse", see {@link #setShouldDefuse(boolean)}
+ * for more details.
* <p>
- * This should <em>only</em> be set when the Bundle reaches its final
- * destination, otherwise a system process may clobber contents that were
- * destined for an app that could have unparceled them.
+ * This should <em>only</em> be set when the Bundle reaches its final destination, otherwise a
+ * system process may clobber contents that were destined for an app that could have unparceled
+ * them.
*/
static final int FLAG_DEFUSABLE = 1 << 0;
@@ -63,10 +67,15 @@
private static volatile boolean sShouldDefuse = false;
/**
- * Set global variable indicating that any Bundles parsed in this process
- * should be "defused." That is, any {@link BadParcelableException}
- * encountered will be suppressed and logged, leaving an empty Bundle
- * instead of crashing.
+ * Set global variable indicating that any Bundles parsed in this process should be "defused".
+ * That is, any {@link BadParcelableException} encountered will be suppressed and logged. Also:
+ * <ul>
+ * <li>If it was the deserialization of a custom item (eg. {@link Parcelable}) that caused the
+ * exception, {@code null} will be returned but the item will be held in the map in its
+ * serialized form (lazy value).
+ * <li>If the exception happened during partial deserialization, that is, during the read of
+ * the map and its basic types (while skipping custom types), the map will be left empty.
+ * </ul>
*
* @hide
*/
@@ -249,6 +258,12 @@
}
}
if (itemwise) {
+ if (LOG_DEFUSABLE && sShouldDefuse && (mFlags & FLAG_DEFUSABLE) == 0) {
+ Slog.wtf(TAG,
+ "Attempting to unparcel all items in a Bundle while in transit; this "
+ + "may remove elements intended for the final desitination.",
+ new Throwable());
+ }
for (int i = 0, n = mMap.size(); i < n; i++) {
// Triggers deserialization of i-th item, if needed
getValueAt(i);
@@ -281,7 +296,16 @@
final Object getValueAt(int i) {
Object object = mMap.valueAt(i);
if (object instanceof Supplier<?>) {
- object = ((Supplier<?>) object).get();
+ try {
+ object = ((Supplier<?>) object).get();
+ } catch (BadParcelableException e) {
+ if (sShouldDefuse) {
+ Log.w(TAG, "Failed to parse item " + mMap.keyAt(i) + ", returning null.", e);
+ return null;
+ } else {
+ throw e;
+ }
+ }
mMap.setValueAt(i, object);
}
return object;
@@ -289,11 +313,6 @@
private void initializeFromParcelLocked(@NonNull Parcel parcelledData, boolean recycleParcel,
boolean parcelledByNative) {
- if (LOG_DEFUSABLE && sShouldDefuse && (mFlags & FLAG_DEFUSABLE) == 0) {
- Slog.wtf(TAG, "Attempting to unparcel a Bundle while in transit; this may "
- + "clobber all data inside!", new Throwable());
- }
-
if (isEmptyParcel(parcelledData)) {
if (DEBUG) {
Log.d(TAG, "unparcel "
@@ -376,8 +395,16 @@
}
}
- /** @hide */
- ArrayMap<String, Object> getMap() {
+ /**
+ * Returns the backing map of this bundle after deserializing every item.
+ *
+ * <p><b>Warning:</b> This method will deserialize every item on the bundle, including custom
+ * types such as {@link Parcelable} and {@link Serializable}, so only use this when you trust
+ * the source. Specifically don't use this method on app-provided bundles.
+ *
+ * @hide
+ */
+ ArrayMap<String, Object> getItemwiseMap() {
unparcel(/* itemwise */ true);
return mMap;
}
@@ -500,7 +527,7 @@
final int N = fromMap.size();
mMap = new ArrayMap<>(N);
for (int i = 0; i < N; i++) {
- mMap.append(fromMap.keyAt(i), deepCopyValue(from.getValueAt(i)));
+ mMap.append(fromMap.keyAt(i), deepCopyValue(fromMap.valueAt(i)));
}
}
} else {
@@ -1772,7 +1799,7 @@
pw.println("[null]");
return;
}
- final ArrayMap<String, Object> map = bundle.getMap();
+ final ArrayMap<String, Object> map = bundle.getItemwiseMap();
for (int i = 0; i < map.size(); i++) {
dumpStats(pw, map.keyAt(i), map.valueAt(i));
}
diff --git a/core/java/android/os/Bundle.java b/core/java/android/os/Bundle.java
index 5626bde..6d5cdc2 100644
--- a/core/java/android/os/Bundle.java
+++ b/core/java/android/os/Bundle.java
@@ -33,6 +33,9 @@
/**
* A mapping from String keys to various {@link Parcelable} values.
*
+ * <p><b>Warning:</b> Note that {@link Bundle} is a lazy container and as such it does NOT implement
+ * {@link #equals(Object)} or {@link #hashCode()}.
+ *
* @see PersistableBundle
*/
public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
@@ -347,56 +350,6 @@
return (mFlags & FLAG_HAS_FDS) != 0;
}
- /**
- * Filter values in Bundle to only basic types.
- * @hide
- */
- @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public Bundle filterValues() {
- unparcel(/* itemwise */ true);
- Bundle bundle = this;
- if (mMap != null) {
- ArrayMap<String, Object> map = mMap;
- for (int i = map.size() - 1; i >= 0; i--) {
- Object value = map.valueAt(i);
- if (PersistableBundle.isValidType(value)) {
- continue;
- }
- if (value instanceof Bundle) {
- Bundle newBundle = ((Bundle)value).filterValues();
- if (newBundle != value) {
- if (map == mMap) {
- // The filter had to generate a new bundle, but we have not yet
- // created a new one here. Do that now.
- bundle = new Bundle(this);
- // Note the ArrayMap<> constructor is guaranteed to generate
- // a new object with items in the same order as the original.
- map = bundle.mMap;
- }
- // Replace this current entry with the new child bundle.
- map.setValueAt(i, newBundle);
- }
- continue;
- }
- if (value.getClass().getName().startsWith("android.")) {
- continue;
- }
- if (map == mMap) {
- // This is the first time we have had to remove something, that means we
- // need to switch to a new Bundle.
- bundle = new Bundle(this);
- // Note the ArrayMap<> constructor is guaranteed to generate
- // a new object with items in the same order as the original.
- map = bundle.mMap;
- }
- map.removeAt(i);
- }
- }
- mFlags |= FLAG_HAS_FDS_KNOWN;
- mFlags &= ~FLAG_HAS_FDS;
- return bundle;
- }
-
/** {@hide} */
@Override
public void putObject(@Nullable String key, @Nullable Object value) {
@@ -1279,6 +1232,10 @@
maybePrefillHasFds();
}
+ /**
+ * Returns a string representation of the {@link Bundle} that may be suitable for debugging. It
+ * won't print the internal map if its content hasn't been unparcelled.
+ */
@Override
public synchronized String toString() {
if (mParcelledData != null) {
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 243dfb3..e6925cb 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -458,8 +458,6 @@
* transaction on this specific binder object. Based on this, the format of the wire binder
* protocol may change. For future compatibility, it is recommended to use this for all
* Parcels.
- *
- * @hide
*/
@NonNull
public static Parcel obtain(@NonNull IBinder binder) {
@@ -3534,14 +3532,17 @@
Parcel source = mSource;
if (source != null) {
synchronized (source) {
- int restore = source.dataPosition();
- try {
- source.setDataPosition(mPosition);
- mObject = source.readValue(mLoader);
- } finally {
- source.setDataPosition(restore);
+ // Check mSource != null guarantees callers won't ever see different objects.
+ if (mSource != null) {
+ int restore = source.dataPosition();
+ try {
+ source.setDataPosition(mPosition);
+ mObject = source.readValue(mLoader);
+ } finally {
+ source.setDataPosition(restore);
+ }
+ mSource = null;
}
- mSource = null;
}
}
return mObject;
@@ -3778,7 +3779,7 @@
default:
int off = dataPosition() - 4;
- throw new RuntimeException(
+ throw new BadParcelableException(
"Parcel " + this + ": Unmarshalling unknown type code " + type
+ " at offset " + off);
}
diff --git a/core/java/android/os/PersistableBundle.java b/core/java/android/os/PersistableBundle.java
index 339371b..ce615aa 100644
--- a/core/java/android/os/PersistableBundle.java
+++ b/core/java/android/os/PersistableBundle.java
@@ -34,6 +34,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.Serializable;
import java.util.ArrayList;
/**
@@ -41,6 +42,9 @@
* supported by this class is purposefully restricted to simple objects that can
* safely be persisted to and restored from disk.
*
+ * <p><b>Warning:</b> Note that {@link PersistableBundle} is a lazy container and as such it does
+ * NOT implement {@link #equals(Object)} or {@link #hashCode()}.
+ *
* @see Bundle
*/
public final class PersistableBundle extends BaseBundle implements Cloneable, Parcelable,
@@ -100,6 +104,10 @@
/**
* Constructs a PersistableBundle from a Bundle. Does only a shallow copy of the Bundle.
*
+ * <p><b>Warning:</b> This method will deserialize every item on the bundle, including custom
+ * types such as {@link Parcelable} and {@link Serializable}, so only use this when you trust
+ * the source. Specifically don't use this method on app-provided bundles.
+ *
* @param b a Bundle to be copied.
*
* @throws IllegalArgumentException if any element of {@code b} cannot be persisted.
@@ -107,7 +115,7 @@
* @hide
*/
public PersistableBundle(Bundle b) {
- this(b.getMap());
+ this(b.getItemwiseMap());
}
/**
@@ -305,8 +313,12 @@
return new PersistableBundle(); // An empty mutable PersistableBundle
}
+ /**
+ * Returns a string representation of the {@link PersistableBundle} that may be suitable for
+ * debugging. It won't print the internal map if its content hasn't been unparcelled.
+ */
@Override
- synchronized public String toString() {
+ public synchronized String toString() {
if (mParcelledData != null) {
if (isEmptyParcel()) {
return "PersistableBundle[EMPTY_PARCEL]";
diff --git a/core/tests/coretests/src/android/os/BundleTest.java b/core/tests/coretests/src/android/os/BundleTest.java
index 9d2cab3..ddd0070 100644
--- a/core/tests/coretests/src/android/os/BundleTest.java
+++ b/core/tests/coretests/src/android/os/BundleTest.java
@@ -47,6 +47,7 @@
@After
public void tearDown() throws Exception {
+ BaseBundle.setShouldDefuse(false);
if (mWtfHandler != null) {
Log.setWtfHandler(mWtfHandler);
}
@@ -355,6 +356,81 @@
assertThat(e.getCause()).isInstanceOf(Log.TerribleFailure.class);
}
+ @Test
+ public void getParcelable_whenThrowingAndNotDefusing_throws() throws Exception {
+ Bundle.setShouldDefuse(false);
+ Bundle bundle = new Bundle();
+ bundle.putParcelable("key", new CustomParcelable(13, "Tiramisu"));
+ bundle.readFromParcel(getParcelledBundle(bundle));
+
+ // Default class-loader is the bootpath class-loader, which doesn't contain
+ // CustomParcelable, so trying to read it will throw BadParcelableException.
+ assertThrows(BadParcelableException.class, () -> bundle.getParcelable("key"));
+ }
+
+ @Test
+ public void getParcelable_whenThrowingAndDefusing_returnsNull() throws Exception {
+ Bundle.setShouldDefuse(true);
+ Bundle bundle = new Bundle();
+ bundle.putParcelable("key", new CustomParcelable(13, "Tiramisu"));
+ bundle.putString("string", "value");
+ bundle.readFromParcel(getParcelledBundle(bundle));
+
+ // Default class-loader is the bootpath class-loader, which doesn't contain
+ // CustomParcelable, so trying to read it will throw BadParcelableException.
+ assertThat(bundle.<Parcelable>getParcelable("key")).isNull();
+ // Doesn't affect other items
+ assertThat(bundle.getString("string")).isEqualTo("value");
+ }
+
+ @Test
+ public void getParcelable_whenThrowingAndDefusing_leavesElement() throws Exception {
+ Bundle.setShouldDefuse(true);
+ Bundle bundle = new Bundle();
+ Parcelable parcelable = new CustomParcelable(13, "Tiramisu");
+ bundle.putParcelable("key", parcelable);
+ bundle.putString("string", "value");
+ bundle.readFromParcel(getParcelledBundle(bundle));
+ assertThat(bundle.<Parcelable>getParcelable("key")).isNull();
+
+ // Now, we simulate reserializing and assign the proper class loader to not throw anymore
+ bundle.readFromParcel(getParcelledBundle(bundle));
+ bundle.setClassLoader(getClass().getClassLoader());
+
+ // We're able to retrieve it even though we failed before
+ assertThat(bundle.<Parcelable>getParcelable("key")).isEqualTo(parcelable);
+ }
+
+ @Test
+ public void partialDeserialization_whenNotDefusing_throws() throws Exception {
+ Bundle.setShouldDefuse(false);
+ Bundle bundle = getMalformedBundle();
+ assertThrows(BadParcelableException.class, bundle::isEmpty);
+ }
+
+ @Test
+ public void partialDeserialization_whenDefusing_emptiesMap() throws Exception {
+ Bundle.setShouldDefuse(true);
+ Bundle bundle = getMalformedBundle();
+ bundle.isEmpty();
+ // Nothing thrown
+ assertThat(bundle.size()).isEqualTo(0);
+ }
+
+ private Bundle getMalformedBundle() {
+ Parcel p = Parcel.obtain();
+ p.writeInt(BaseBundle.BUNDLE_MAGIC);
+ int start = p.dataPosition();
+ p.writeInt(1); // Number of items
+ p.writeString("key");
+ p.writeInt(131313); // Invalid type
+ p.writeInt(0); // Anything, really
+ int end = p.dataPosition();
+ p.setDataPosition(0);
+ return new Bundle(p, end - start);
+ }
+
+
private static class CustomParcelable implements Parcelable {
public final int integer;
public final String string;
diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java
index c7c503d..6fe771a 100644
--- a/media/java/android/media/MediaCodecInfo.java
+++ b/media/java/android/media/MediaCodecInfo.java
@@ -27,6 +27,7 @@
import android.os.Build;
import android.os.Process;
import android.os.SystemProperties;
+import android.sysprop.MediaProperties;
import android.util.Log;
import android.util.Pair;
import android.util.Range;
@@ -195,13 +196,20 @@
private static final Range<Rational> POSITIVE_RATIONALS =
Range.create(new Rational(1, Integer.MAX_VALUE),
new Rational(Integer.MAX_VALUE, 1));
- private static final Range<Integer> SIZE_RANGE =
- Process.is64Bit() ? Range.create(1, 32768) : Range.create(1, 4096);
private static final Range<Integer> FRAME_RATE_RANGE = Range.create(0, 960);
private static final Range<Integer> BITRATE_RANGE = Range.create(0, 500000000);
private static final int DEFAULT_MAX_SUPPORTED_INSTANCES = 32;
private static final int MAX_SUPPORTED_INSTANCES_LIMIT = 256;
+ private static final class LazyHolder {
+ private static final Range<Integer> SIZE_RANGE = Process.is64Bit()
+ ? Range.create(1, 32768)
+ : Range.create(1, MediaProperties.resolution_limit_32bit().orElse(4096));
+ }
+ private static Range<Integer> getSizeRange() {
+ return LazyHolder.SIZE_RANGE;
+ }
+
// found stuff that is not supported by framework (=> this should not happen)
private static final int ERROR_UNRECOGNIZED = (1 << 0);
// found profile/level for which we don't have capability estimates
@@ -2131,12 +2139,12 @@
private void initWithPlatformLimits() {
mBitrateRange = BITRATE_RANGE;
- mWidthRange = SIZE_RANGE;
- mHeightRange = SIZE_RANGE;
+ mWidthRange = getSizeRange();
+ mHeightRange = getSizeRange();
mFrameRateRange = FRAME_RATE_RANGE;
- mHorizontalBlockRange = SIZE_RANGE;
- mVerticalBlockRange = SIZE_RANGE;
+ mHorizontalBlockRange = getSizeRange();
+ mVerticalBlockRange = getSizeRange();
// full positive ranges are supported as these get calculated
mBlockCountRange = POSITIVE_INTEGERS;
@@ -2150,7 +2158,7 @@
mHeightAlignment = 2;
mBlockWidth = 2;
mBlockHeight = 2;
- mSmallerDimensionUpperLimit = SIZE_RANGE.getUpper();
+ mSmallerDimensionUpperLimit = getSizeRange().getUpper();
}
private @Nullable List<PerformancePoint> getPerformancePoints(Map<String, Object> map) {
@@ -2391,10 +2399,10 @@
// codec supports profiles that we don't know.
// Use supplied values clipped to platform limits
if (widths != null) {
- mWidthRange = SIZE_RANGE.intersect(widths);
+ mWidthRange = getSizeRange().intersect(widths);
}
if (heights != null) {
- mHeightRange = SIZE_RANGE.intersect(heights);
+ mHeightRange = getSizeRange().intersect(heights);
}
if (counts != null) {
mBlockCountRange = POSITIVE_INTEGERS.intersect(
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java
index 0256615..1f75ae3 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java
@@ -139,14 +139,14 @@
*/
public synchronized String getSubDeviceSummary(CachedBluetoothDevice device) {
final Set<CachedBluetoothDevice> memberDevices = device.getMemberDevice();
- if (memberDevices != null) {
+ // TODO: check the CSIP group size instead of the real member device set size, and adjust
+ // the size restriction.
+ if (memberDevices.size() == 1) {
for (CachedBluetoothDevice memberDevice : memberDevices) {
- if (!memberDevice.isConnected()) {
- return null;
+ if (memberDevice.isConnected()) {
+ return memberDevice.getConnectionSummary();
}
}
-
- return device.getConnectionSummary();
}
CachedBluetoothDevice subDevice = device.getSubDevice();
if (subDevice != null && subDevice.isConnected()) {
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index 8bb5204..66227d3 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -619,10 +619,8 @@
}
}
- if (!mService.isPowerStandbyOrTransient()) {
- addAndStartAction(new NewDeviceAction(this, activeSource.logicalAddress,
- activeSource.physicalAddress, deviceType));
- }
+ addAndStartAction(new NewDeviceAction(this, activeSource.logicalAddress,
+ activeSource.physicalAddress, deviceType));
}
private boolean handleNewDeviceAtTheTailOfActivePath(int path) {
@@ -798,14 +796,12 @@
@ServiceThreadOnly
void onNewAvrAdded(HdmiDeviceInfo avr) {
assertRunOnServiceThread();
- if (!mService.isPowerStandbyOrTransient()) {
- addAndStartAction(new SystemAudioAutoInitiationAction(this, avr.getLogicalAddress()));
- if (!isDirectConnectAddress(avr.getPhysicalAddress())) {
- startArcAction(false);
- } else if (isConnected(avr.getPortId()) && isArcFeatureEnabled(avr.getPortId())
- && !hasAction(SetArcTransmissionStateAction.class)) {
- startArcAction(true);
- }
+ addAndStartAction(new SystemAudioAutoInitiationAction(this, avr.getLogicalAddress()));
+ if (!isDirectConnectAddress(avr.getPhysicalAddress())) {
+ startArcAction(false);
+ } else if (isConnected(avr.getPortId()) && isArcFeatureEnabled(avr.getPortId())
+ && !hasAction(SetArcTransmissionStateAction.class)) {
+ startArcAction(true);
}
}
diff --git a/services/core/java/com/android/server/os/NativeTombstoneManager.java b/services/core/java/com/android/server/os/NativeTombstoneManager.java
index ed1f5f5..3fc4169 100644
--- a/services/core/java/com/android/server/os/NativeTombstoneManager.java
+++ b/services/core/java/com/android/server/os/NativeTombstoneManager.java
@@ -356,7 +356,7 @@
return false;
}
- if (Math.abs(exitInfo.getTimestamp() - mTimestampMs) > 1000) {
+ if (Math.abs(exitInfo.getTimestamp() - mTimestampMs) > 5000) {
return false;
}
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
old mode 100755
new mode 100644
index 4679b9c..d281306
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -543,8 +543,14 @@
*/
public static final int CAPABILITY_TRANSFER_CONSULTATIVE = 0x08000000;
+ /**
+ * Indicates whether the remote party supports RTT or not to the UI.
+ */
+
+ public static final int CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT = 0x10000000;
+
//******************************************************************************************
- // Next CAPABILITY value: 0x10000000
+ // Next CAPABILITY value: 0x20000000
//******************************************************************************************
/**
@@ -786,6 +792,9 @@
if (can(capabilities, CAPABILITY_TRANSFER_CONSULTATIVE)) {
builder.append(" CAPABILITY_TRANSFER_CONSULTATIVE");
}
+ if (can(capabilities, CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT)) {
+ builder.append(" CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT");
+ }
builder.append("]");
return builder.toString();
}
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 52d560c..7774e49 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -417,8 +417,14 @@
*/
public static final int CAPABILITY_TRANSFER_CONSULTATIVE = 0x10000000;
+ /**
+ * Indicates whether the remote party supports RTT or not to the UI.
+ */
+
+ public static final int CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT = 0x20000000;
+
//**********************************************************************************************
- // Next CAPABILITY value: 0x20000000
+ // Next CAPABILITY value: 0x40000000
//**********************************************************************************************
/**
@@ -1076,6 +1082,10 @@
== CAPABILITY_TRANSFER_CONSULTATIVE) {
builder.append(isLong ? " CAPABILITY_TRANSFER_CONSULTATIVE" : " sup_cTrans");
}
+ if ((capabilities & CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT)
+ == CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT) {
+ builder.append(isLong ? " CAPABILITY_REMOTE_PARTY_SUPPORTS_RTT" : " sup_rtt");
+ }
builder.append("]");
return builder.toString();
}
diff --git a/telephony/java/android/telephony/data/EpsQos.java b/telephony/java/android/telephony/data/EpsQos.java
index 22c8b0a..64c956f 100644
--- a/telephony/java/android/telephony/data/EpsQos.java
+++ b/telephony/java/android/telephony/data/EpsQos.java
@@ -32,15 +32,9 @@
int qosClassId;
- public EpsQos() {
- super(Qos.QOS_TYPE_EPS,
- new android.hardware.radio.V1_6.QosBandwidth(),
- new android.hardware.radio.V1_6.QosBandwidth());
- }
-
- public EpsQos(@NonNull android.hardware.radio.V1_6.EpsQos qos) {
- super(Qos.QOS_TYPE_EPS, qos.downlink, qos.uplink);
- qosClassId = qos.qci;
+ public EpsQos(QosBandwidth downlink, QosBandwidth uplink, int qosClassId) {
+ super(Qos.QOS_TYPE_EPS, downlink, uplink);
+ this.qosClassId = qosClassId;
}
private EpsQos(Parcel source) {
diff --git a/telephony/java/android/telephony/data/NrQos.java b/telephony/java/android/telephony/data/NrQos.java
index fe124ac..a24d5fa 100644
--- a/telephony/java/android/telephony/data/NrQos.java
+++ b/telephony/java/android/telephony/data/NrQos.java
@@ -32,11 +32,12 @@
int fiveQi;
int averagingWindowMs;
- public NrQos(@NonNull android.hardware.radio.V1_6.NrQos qos) {
- super(Qos.QOS_TYPE_NR, qos.downlink, qos.uplink);
- fiveQi = qos.fiveQi;
- qosFlowId = qos.qfi;
- averagingWindowMs = qos.averagingWindowMs;
+ public NrQos(QosBandwidth downlink, QosBandwidth uplink, int qosFlowId, int fiveQi,
+ int averagingWindowMs) {
+ super(Qos.QOS_TYPE_NR, downlink, uplink);
+ this.qosFlowId = qosFlowId;
+ this.fiveQi = fiveQi;
+ this.averagingWindowMs = averagingWindowMs;
}
private NrQos(Parcel source) {
diff --git a/telephony/java/android/telephony/data/Qos.java b/telephony/java/android/telephony/data/Qos.java
index c286c621..8c437c8 100644
--- a/telephony/java/android/telephony/data/Qos.java
+++ b/telephony/java/android/telephony/data/Qos.java
@@ -48,12 +48,10 @@
final QosBandwidth downlink;
final QosBandwidth uplink;
- Qos(int type,
- @NonNull android.hardware.radio.V1_6.QosBandwidth downlink,
- @NonNull android.hardware.radio.V1_6.QosBandwidth uplink) {
+ Qos(int type, QosBandwidth downlink, QosBandwidth uplink) {
this.type = type;
- this.downlink = new QosBandwidth(downlink.maxBitrateKbps, downlink.guaranteedBitrateKbps);
- this.uplink = new QosBandwidth(uplink.maxBitrateKbps, uplink.guaranteedBitrateKbps);
+ this.downlink = downlink;
+ this.uplink = uplink;
}
public QosBandwidth getDownlinkBandwidth() {
@@ -68,10 +66,7 @@
int maxBitrateKbps;
int guaranteedBitrateKbps;
- QosBandwidth() {
- }
-
- QosBandwidth(int maxBitrateKbps, int guaranteedBitrateKbps) {
+ public QosBandwidth(int maxBitrateKbps, int guaranteedBitrateKbps) {
this.maxBitrateKbps = maxBitrateKbps;
this.guaranteedBitrateKbps = guaranteedBitrateKbps;
}
@@ -158,18 +153,6 @@
}
/** @hide */
- public static @NonNull Qos create(@NonNull android.hardware.radio.V1_6.Qos qos) {
- switch (qos.getDiscriminator()) {
- case android.hardware.radio.V1_6.Qos.hidl_discriminator.eps:
- return new EpsQos(qos.eps());
- case android.hardware.radio.V1_6.Qos.hidl_discriminator.nr:
- return new NrQos(qos.nr());
- default:
- return null;
- }
- }
-
- /** @hide */
public @QosType int getType() {
return type;
}
diff --git a/telephony/java/android/telephony/data/QosBearerFilter.java b/telephony/java/android/telephony/data/QosBearerFilter.java
index 5642549..da51962 100644
--- a/telephony/java/android/telephony/data/QosBearerFilter.java
+++ b/telephony/java/android/telephony/data/QosBearerFilter.java
@@ -18,15 +18,12 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
-import android.net.InetAddresses;
import android.net.LinkAddress;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.net.InetAddress;
-import java.net.Inet4Address;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -91,20 +88,13 @@
*/
private int precedence;
- QosBearerFilter() {
- localAddresses = new ArrayList<>();
- remoteAddresses = new ArrayList<>();
- localPort = new PortRange();
- remotePort = new PortRange();
- protocol = QOS_PROTOCOL_UNSPECIFIED;
- filterDirection = QOS_FILTER_DIRECTION_BIDIRECTIONAL;
- }
-
public QosBearerFilter(List<LinkAddress> localAddresses, List<LinkAddress> remoteAddresses,
PortRange localPort, PortRange remotePort, int protocol, int tos,
long flowLabel, long spi, int direction, int precedence) {
- this.localAddresses = localAddresses;
- this.remoteAddresses = remoteAddresses;
+ this.localAddresses = new ArrayList<>();
+ this.localAddresses.addAll(localAddresses);
+ this.remoteAddresses = new ArrayList<>();
+ this.remoteAddresses.addAll(remoteAddresses);
this.localPort = localPort;
this.remotePort = remotePort;
this.protocol = protocol;
@@ -135,82 +125,10 @@
return precedence;
}
- /** @hide */
- public static @NonNull QosBearerFilter create(
- @NonNull android.hardware.radio.V1_6.QosFilter qosFilter) {
- QosBearerFilter ret = new QosBearerFilter();
-
- String[] localAddresses = qosFilter.localAddresses.stream().toArray(String[]::new);
- if (localAddresses != null) {
- for (String address : localAddresses) {
- ret.localAddresses.add(createLinkAddressFromString(address));
- }
- }
-
- String[] remoteAddresses = qosFilter.remoteAddresses.stream().toArray(String[]::new);
- if (remoteAddresses != null) {
- for (String address : remoteAddresses) {
- ret.remoteAddresses.add(createLinkAddressFromString(address));
- }
- }
-
- if (qosFilter.localPort != null) {
- if (qosFilter.localPort.getDiscriminator()
- == android.hardware.radio.V1_6.MaybePort.hidl_discriminator.range) {
- final android.hardware.radio.V1_6.PortRange portRange = qosFilter.localPort.range();
- ret.localPort.start = portRange.start;
- ret.localPort.end = portRange.end;
- }
- }
-
- if (qosFilter.remotePort != null) {
- if (qosFilter.remotePort.getDiscriminator()
- == android.hardware.radio.V1_6.MaybePort.hidl_discriminator.range) {
- final android.hardware.radio.V1_6.PortRange portRange
- = qosFilter.remotePort.range();
- ret.remotePort.start = portRange.start;
- ret.remotePort.end = portRange.end;
- }
- }
-
- ret.protocol = qosFilter.protocol;
-
- if (qosFilter.tos != null) {
- if (qosFilter.tos.getDiscriminator()
- == android.hardware.radio.V1_6.QosFilter.TypeOfService.hidl_discriminator.value) {
- ret.typeOfServiceMask = qosFilter.tos.value();
- }
- }
-
- if (qosFilter.flowLabel != null) {
- if (qosFilter.flowLabel.getDiscriminator()
- == android.hardware.radio.V1_6.QosFilter.Ipv6FlowLabel.hidl_discriminator.value) {
- ret.flowLabel = qosFilter.flowLabel.value();
- }
- }
-
- if (qosFilter.spi != null) {
- if (qosFilter.spi.getDiscriminator()
- == android.hardware.radio.V1_6.QosFilter.IpsecSpi.hidl_discriminator.value) {
- ret.securityParameterIndex = qosFilter.spi.value();
- }
- }
-
- ret.filterDirection = qosFilter.direction;
- ret.precedence = qosFilter.precedence;
-
- return ret;
- }
-
public static class PortRange implements Parcelable {
int start;
int end;
- PortRange() {
- start = -1;
- end = -1;
- }
-
private PortRange(Parcel source) {
start = source.readInt();
end = source.readInt();
@@ -325,32 +243,6 @@
&& precedence == other.precedence;
}
- private static LinkAddress createLinkAddressFromString(String addressString) {
- addressString = addressString.trim();
- InetAddress address = null;
- int prefixLength = -1;
- try {
- String[] pieces = addressString.split("/", 2);
- address = InetAddresses.parseNumericAddress(pieces[0]);
- if (pieces.length == 1) {
- prefixLength = (address instanceof Inet4Address) ? 32 : 128;
- } else if (pieces.length == 2) {
- prefixLength = Integer.parseInt(pieces[1]);
- }
- } catch (NullPointerException e) { // Null string.
- } catch (ArrayIndexOutOfBoundsException e) { // No prefix length.
- } catch (NumberFormatException e) { // Non-numeric prefix.
- } catch (IllegalArgumentException e) { // Invalid IP address.
- }
-
- if (address == null || prefixLength == -1) {
- throw new IllegalArgumentException("Invalid link address " + addressString);
- }
-
- return new LinkAddress(address, prefixLength, 0, 0,
- LinkAddress.LIFETIME_UNKNOWN, LinkAddress.LIFETIME_UNKNOWN);
- }
-
private QosBearerFilter(Parcel source) {
localAddresses = new ArrayList<>();
source.readList(localAddresses, LinkAddress.class.getClassLoader());
diff --git a/telephony/java/android/telephony/data/QosBearerSession.java b/telephony/java/android/telephony/data/QosBearerSession.java
index 30effc9..ffeb08a 100644
--- a/telephony/java/android/telephony/data/QosBearerSession.java
+++ b/telephony/java/android/telephony/data/QosBearerSession.java
@@ -36,10 +36,12 @@
final Qos qos;
final List<QosBearerFilter> qosBearerFilterList;
- public QosBearerSession(int qosBearerSessionId, @NonNull Qos qos, @NonNull List<QosBearerFilter> qosBearerFilterList) {
+ public QosBearerSession(int qosBearerSessionId, @NonNull Qos qos,
+ @NonNull List<QosBearerFilter> qosBearerFilterList) {
this.qosBearerSessionId = qosBearerSessionId;
this.qos = qos;
- this.qosBearerFilterList = qosBearerFilterList;
+ this.qosBearerFilterList = new ArrayList<>();
+ this.qosBearerFilterList.addAll(qosBearerFilterList);
}
private QosBearerSession(Parcel source) {
@@ -72,22 +74,6 @@
dest.writeList(qosBearerFilterList);
}
- public static @NonNull QosBearerSession create(
- @NonNull android.hardware.radio.V1_6.QosSession qosSession) {
- List<QosBearerFilter> qosBearerFilters = new ArrayList<>();
-
- if (qosSession.qosFilters != null) {
- for (android.hardware.radio.V1_6.QosFilter filter : qosSession.qosFilters) {
- qosBearerFilters.add(QosBearerFilter.create(filter));
- }
- }
-
- return new QosBearerSession(
- qosSession.qosSessionId,
- Qos.create(qosSession.qos),
- qosBearerFilters);
- }
-
@Override
public int describeContents() {
return 0;
diff --git a/telephony/java/android/telephony/data/RouteSelectionDescriptor.java b/telephony/java/android/telephony/data/RouteSelectionDescriptor.java
index c2457f2..b3b8464 100644
--- a/telephony/java/android/telephony/data/RouteSelectionDescriptor.java
+++ b/telephony/java/android/telephony/data/RouteSelectionDescriptor.java
@@ -120,43 +120,23 @@
private final List<String> mDnn;
/** @hide */
- RouteSelectionDescriptor(android.hardware.radio.V1_6.RouteSelectionDescriptor rsd) {
- this(rsd.precedence, rsd.sessionType.value(), rsd.sscMode.value(), rsd.sliceInfo,
- rsd.dnn);
- }
-
- /** @hide */
public RouteSelectionDescriptor(int precedence, int sessionType, int sscMode,
- List<android.hardware.radio.V1_6.SliceInfo> sliceInfo, List<String> dnn) {
+ List<NetworkSliceInfo> sliceInfo, List<String> dnn) {
mPrecedence = precedence;
mSessionType = sessionType;
mSscMode = sscMode;
- mSliceInfo = new ArrayList<NetworkSliceInfo>();
- for (android.hardware.radio.V1_6.SliceInfo si : sliceInfo) {
- mSliceInfo.add(sliceInfoBuilder(si));
- }
- mDnn = new ArrayList<String>();
+ mSliceInfo = new ArrayList<>();
+ mSliceInfo.addAll(sliceInfo);
+ mDnn = new ArrayList<>();
mDnn.addAll(dnn);
}
- private NetworkSliceInfo sliceInfoBuilder(android.hardware.radio.V1_6.SliceInfo si) {
- NetworkSliceInfo.Builder builder = new NetworkSliceInfo.Builder()
- .setSliceServiceType(si.sst)
- .setMappedHplmnSliceServiceType(si.mappedHplmnSst);
- if (si.sliceDifferentiator != NetworkSliceInfo.SLICE_DIFFERENTIATOR_NO_SLICE) {
- builder
- .setSliceDifferentiator(si.sliceDifferentiator)
- .setMappedHplmnSliceDifferentiator(si.mappedHplmnSD);
- }
- return builder.build();
- }
-
private RouteSelectionDescriptor(Parcel p) {
mPrecedence = p.readInt();
mSessionType = p.readInt();
mSscMode = p.readInt();
mSliceInfo = p.createTypedArrayList(NetworkSliceInfo.CREATOR);
- mDnn = new ArrayList<String>();
+ mDnn = new ArrayList<>();
p.readStringList(mDnn);
}
diff --git a/telephony/java/android/telephony/data/SlicingConfig.java b/telephony/java/android/telephony/data/SlicingConfig.java
index 990e4d2..51e6384 100644
--- a/telephony/java/android/telephony/data/SlicingConfig.java
+++ b/telephony/java/android/telephony/data/SlicingConfig.java
@@ -33,39 +33,15 @@
private final List<NetworkSliceInfo> mSliceInfo;
public SlicingConfig() {
- mUrspRules = new ArrayList<UrspRule>();
- mSliceInfo = new ArrayList<NetworkSliceInfo>();
+ mUrspRules = new ArrayList<>();
+ mSliceInfo = new ArrayList<>();
}
/** @hide */
- public SlicingConfig(android.hardware.radio.V1_6.SlicingConfig sc) {
- this(sc.urspRules, sc.sliceInfo);
- }
-
- /** @hide */
- public SlicingConfig(List<android.hardware.radio.V1_6.UrspRule> urspRules,
- List<android.hardware.radio.V1_6.SliceInfo> sliceInfo) {
- mUrspRules = new ArrayList<UrspRule>();
- for (android.hardware.radio.V1_6.UrspRule ur : urspRules) {
- mUrspRules.add(new UrspRule(ur.precedence, ur.trafficDescriptors,
- ur.routeSelectionDescriptor));
- }
- mSliceInfo = new ArrayList<NetworkSliceInfo>();
- for (android.hardware.radio.V1_6.SliceInfo si : sliceInfo) {
- mSliceInfo.add(sliceInfoBuilder(si));
- }
- }
-
- private NetworkSliceInfo sliceInfoBuilder(android.hardware.radio.V1_6.SliceInfo si) {
- NetworkSliceInfo.Builder builder = new NetworkSliceInfo.Builder()
- .setSliceServiceType(si.sst)
- .setMappedHplmnSliceServiceType(si.mappedHplmnSst);
- if (si.sliceDifferentiator != NetworkSliceInfo.SLICE_DIFFERENTIATOR_NO_SLICE) {
- builder
- .setSliceDifferentiator(si.sliceDifferentiator)
- .setMappedHplmnSliceDifferentiator(si.mappedHplmnSD);
- }
- return builder.build();
+ public SlicingConfig(List<UrspRule> urspRules, List<NetworkSliceInfo> sliceInfo) {
+ this();
+ mUrspRules.addAll(urspRules);
+ mSliceInfo.addAll(sliceInfo);
}
/** @hide */
diff --git a/telephony/java/android/telephony/data/UrspRule.java b/telephony/java/android/telephony/data/UrspRule.java
index e2c47fd..afbd429 100644
--- a/telephony/java/android/telephony/data/UrspRule.java
+++ b/telephony/java/android/telephony/data/UrspRule.java
@@ -19,12 +19,9 @@
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.hardware.radio.V1_6.OptionalDnn;
-import android.hardware.radio.V1_6.OptionalOsAppId;
import android.os.Parcel;
import android.os.Parcelable;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -52,48 +49,14 @@
private final List<TrafficDescriptor> mTrafficDescriptors;
private final List<RouteSelectionDescriptor> mRouteSelectionDescriptor;
- UrspRule(android.hardware.radio.V1_6.UrspRule ur) {
- this(ur.precedence, ur.trafficDescriptors, ur.routeSelectionDescriptor);
- }
-
/** @hide */
- public UrspRule(int precedence,
- List<android.hardware.radio.V1_6.TrafficDescriptor> trafficDescriptors,
- List<android.hardware.radio.V1_6.RouteSelectionDescriptor> routeSelectionDescriptor) {
+ public UrspRule(int precedence, List<TrafficDescriptor> trafficDescriptors,
+ List<RouteSelectionDescriptor> routeSelectionDescriptor) {
mPrecedence = precedence;
- mTrafficDescriptors = new ArrayList<TrafficDescriptor>();
- for (android.hardware.radio.V1_6.TrafficDescriptor td : trafficDescriptors) {
- mTrafficDescriptors.add(convertToTrafficDescriptor(td));
- }
- mRouteSelectionDescriptor = new ArrayList<RouteSelectionDescriptor>();
- for (android.hardware.radio.V1_6.RouteSelectionDescriptor rsd : routeSelectionDescriptor) {
- mRouteSelectionDescriptor.add(new RouteSelectionDescriptor(rsd));
- }
- }
-
- /** Convert an ArrayList of Bytes to an exactly-sized primitive array */
- private byte[] arrayListToPrimitiveArray(ArrayList<Byte> bytes) {
- byte[] ret = new byte[bytes.size()];
- for (int i = 0; i < ret.length; i++) {
- ret[i] = bytes.get(i);
- }
- return ret;
- }
-
- private TrafficDescriptor convertToTrafficDescriptor(
- android.hardware.radio.V1_6.TrafficDescriptor td) {
- String dnn = td.dnn.getDiscriminator() == OptionalDnn.hidl_discriminator.noinit
- ? null : td.dnn.value();
- String osAppId = td.osAppId.getDiscriminator() == OptionalOsAppId.hidl_discriminator.noinit
- ? null : new String(arrayListToPrimitiveArray(td.osAppId.value().osAppId));
- TrafficDescriptor.Builder builder = new TrafficDescriptor.Builder();
- if (dnn != null) {
- builder.setDataNetworkName(dnn);
- }
- if (osAppId != null) {
- builder.setOsAppId(osAppId);
- }
- return builder.build();
+ mTrafficDescriptors = new ArrayList<>();
+ mTrafficDescriptors.addAll(trafficDescriptors);
+ mRouteSelectionDescriptor = new ArrayList<>();
+ mRouteSelectionDescriptor.addAll(routeSelectionDescriptor);
}
private UrspRule(Parcel p) {
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index fe8e671..b73f827 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -566,7 +566,7 @@
int RIL_UNSOL_RINGBACK_TONE = 1029;
int RIL_UNSOL_RESEND_INCALL_MUTE = 1030;
int RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED = 1031;
- int RIL_UNSOl_CDMA_PRL_CHANGED = 1032;
+ int RIL_UNSOL_CDMA_PRL_CHANGED = 1032;
int RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE = 1033;
int RIL_UNSOL_RIL_CONNECTED = 1034;
int RIL_UNSOL_VOICE_RADIO_TECH_CHANGED = 1035;
diff --git a/test-mock/src/android/test/mock/MockContext.java b/test-mock/src/android/test/mock/MockContext.java
index 6046d78..7b449ce 100644
--- a/test-mock/src/android/test/mock/MockContext.java
+++ b/test-mock/src/android/test/mock/MockContext.java
@@ -566,11 +566,26 @@
/** @hide */
@Override
+ @SystemApi
+ public Intent registerReceiverForAllUsers(BroadcastReceiver receiver,
+ IntentFilter filter, String broadcastPermission, Handler scheduler, int flags) {
+ throw new UnsupportedOperationException();
+ }
+
+ /** @hide */
+ @Override
public Intent registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user,
IntentFilter filter, String broadcastPermission, Handler scheduler) {
throw new UnsupportedOperationException();
}
+ /** @hide */
+ @Override
+ public Intent registerReceiverAsUser(BroadcastReceiver receiver, UserHandle user,
+ IntentFilter filter, String broadcastPermission, Handler scheduler, int flags) {
+ throw new UnsupportedOperationException();
+ }
+
@Override
public void unregisterReceiver(BroadcastReceiver receiver) {
throw new UnsupportedOperationException();
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/.project b/tests/Camera2Tests/SmartCamera/SimpleCamera/.project
deleted file mode 100644
index 2517e2d..0000000
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>CameraShoot</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ApkBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/tests/HwAccelerationTest/.project b/tests/HwAccelerationTest/.project
deleted file mode 100644
index 7c04d3c..0000000
--- a/tests/HwAccelerationTest/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>HwAccelerationTest</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ApkBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>