Merge "Document AutofillValue.forText() thread safety..."
diff --git a/apct-tests/perftests/core/src/android/os/BinderCallsStatsPerfTest.java b/apct-tests/perftests/core/src/android/os/BinderCallsStatsPerfTest.java
index ba072da..e4a8503 100644
--- a/apct-tests/perftests/core/src/android/os/BinderCallsStatsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/os/BinderCallsStatsPerfTest.java
@@ -59,7 +59,7 @@
int i = 0;
while (state.keepRunning()) {
BinderCallsStats.CallSession s = mBinderCallsStats.callStarted(b, i % 100);
- mBinderCallsStats.callEnded(s);
+ mBinderCallsStats.callEnded(s, 0, 0);
i++;
}
}
@@ -71,7 +71,7 @@
mBinderCallsStats = new BinderCallsStats(false);
while (state.keepRunning()) {
BinderCallsStats.CallSession s = mBinderCallsStats.callStarted(b, 0);
- mBinderCallsStats.callEnded(s);
+ mBinderCallsStats.callEnded(s, 0, 0);
}
}
diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt
index 0cb1938..bb9836d 100644
--- a/config/hiddenapi-light-greylist.txt
+++ b/config/hiddenapi-light-greylist.txt
@@ -875,6 +875,7 @@
Landroid/app/ProgressDialog;->mProgress:Landroid/widget/ProgressBar;
Landroid/app/ProgressDialog;->mProgressNumber:Landroid/widget/TextView;
Landroid/app/QueuedWork;->addFinisher(Ljava/lang/Runnable;)V
+Landroid/app/QueuedWork;->getHandler()Landroid/os/Handler;
Landroid/app/QueuedWork;->removeFinisher(Ljava/lang/Runnable;)V
Landroid/app/QueuedWork;->sFinishers:Ljava/util/LinkedList;
Landroid/app/ResourcesManager;-><init>()V
@@ -1853,6 +1854,7 @@
Landroid/content/res/ObbInfo;->salt:[B
Landroid/content/res/Resources$Theme;->mThemeImpl:Landroid/content/res/ResourcesImpl$ThemeImpl;
Landroid/content/res/Resources$Theme;->resolveAttributes([I[I)Landroid/content/res/TypedArray;
+Landroid/content/res/Resources;-><init>()V
Landroid/content/res/Resources;-><init>(Ljava/lang/ClassLoader;)V
Landroid/content/res/Resources;->getCompatibilityInfo()Landroid/content/res/CompatibilityInfo;
Landroid/content/res/Resources;->getDisplayAdjustments()Landroid/view/DisplayAdjustments;
@@ -1894,6 +1896,7 @@
Landroid/content/res/ResourcesKey;->mSplitResDirs:[Ljava/lang/String;
Landroid/content/res/StringBlock;-><init>(JZ)V
Landroid/content/res/StringBlock;->get(I)Ljava/lang/CharSequence;
+Landroid/content/res/ThemedResourceCache;->mThemedEntries:Landroid/util/ArrayMap;
Landroid/content/res/ThemedResourceCache;->onConfigurationChange(I)V
Landroid/content/res/TypedArray;->extractThemeAttrs()[I
Landroid/content/res/TypedArray;->extractThemeAttrs([I)[I
@@ -5757,6 +5760,7 @@
Landroid/util/MathUtils;->constrain(III)I
Landroid/util/MathUtils;->lerp(FFF)F
Landroid/util/MathUtils;->max(II)F
+Landroid/util/NtpTrustedTime;->currentTimeMillis()J
Landroid/util/NtpTrustedTime;->forceRefresh()Z
Landroid/util/NtpTrustedTime;->getCachedNtpTime()J
Landroid/util/NtpTrustedTime;->getCachedNtpTimeReference()J
@@ -6428,6 +6432,7 @@
Landroid/view/ViewGroup$MarginLayoutParams;->endMargin:I
Landroid/view/ViewGroup$MarginLayoutParams;->setMarginsRelative(IIII)V
Landroid/view/ViewGroup$MarginLayoutParams;->startMargin:I
+Landroid/view/ViewGroup$TouchTarget;-><init>()V
Landroid/view/ViewGroup$TouchTarget;->child:Landroid/view/View;
Landroid/view/ViewGroup;->addTransientView(Landroid/view/View;I)V
Landroid/view/ViewGroup;->cancelTouchTarget(Landroid/view/View;)V
@@ -7087,6 +7092,7 @@
Landroid/widget/RemoteViewsAdapter;->saveRemoteViewsCache()V
Landroid/widget/RemoteViewsAdapter;->setRemoteViewsOnClickHandler(Landroid/widget/RemoteViews$OnClickHandler;)V
Landroid/widget/RemoteViewsAdapter;->setVisibleRangeHint(II)V
+Landroid/widget/ScrollBarDrawable;-><init>()V
Landroid/widget/ScrollBarDrawable;->mVerticalThumb:Landroid/graphics/drawable/Drawable;
Landroid/widget/ScrollBarDrawable;->setHorizontalThumbDrawable(Landroid/graphics/drawable/Drawable;)V
Landroid/widget/ScrollBarDrawable;->setVerticalThumbDrawable(Landroid/graphics/drawable/Drawable;)V
@@ -7256,6 +7262,7 @@
Landroid/widget/TextView;->startMarquee()V
Landroid/widget/TextView;->startStopMarquee(Z)V
Landroid/widget/TextView;->stopTextActionMode()V
+Landroid/widget/TextView;->updateTextServicesLocaleLocked()V
Landroid/widget/TextView;->viewportToContentVerticalOffset()I
Landroid/widget/TimePicker;->mDelegate:Landroid/widget/TimePicker$TimePickerDelegate;
Landroid/widget/Toast$TN;->handleHide()V
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 07c3eef..a55af1d 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -6756,7 +6756,7 @@
* Should be unique amongst all individuals in the conversation, and should be
* consistent during re-posts of the notification.
*
- * @see Message#Message(CharSequence, long, CharSequence)
+ * @see Message#Notification.MessagingStyle.Message(CharSequence, long, CharSequence)
*
* @return this object for method chaining
*
@@ -6776,7 +6776,7 @@
* Should be <code>null</code> for messages by the current user, in which case
* the platform will insert the user set in {@code MessagingStyle(Person)}.
*
- * @see Message#Message(CharSequence, long, CharSequence)
+ * @see Message#Notification.MessagingStyle.Message(CharSequence, long, CharSequence)
*
* @return this object for method chaining
*/
diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java
index 89517cd..2f3bf63 100644
--- a/core/java/android/content/pm/PackageInstaller.java
+++ b/core/java/android/content/pm/PackageInstaller.java
@@ -1236,8 +1236,6 @@
/**
* Sets the UID that initiated the package installation. This is informational
* and may be used as a signal for anti-malware purposes.
- *
- * @see Intent#EXTRA_ORIGINATING_UID
*/
public void setOriginatingUid(int originatingUid) {
this.originatingUid = originatingUid;
diff --git a/core/java/android/nfc/tech/MifareClassic.java b/core/java/android/nfc/tech/MifareClassic.java
index 8c92288..02819a6 100644
--- a/core/java/android/nfc/tech/MifareClassic.java
+++ b/core/java/android/nfc/tech/MifareClassic.java
@@ -318,7 +318,7 @@
* <p>Successful authentication of a sector with key A enables other
* I/O operations on that sector. The set of operations granted by key A
* key depends on the ACL bits set in that sector. For more information
- * see the MIFARE Classic specification on {@see http://www.nxp.com}.
+ * see the MIFARE Classic specification on <a href="http://www.nxp.com">http://www.nxp.com</a>.
*
* <p>A failed authentication attempt causes an implicit reconnection to the
* tag, so authentication to other sectors will be lost.
@@ -345,7 +345,7 @@
* <p>Successful authentication of a sector with key B enables other
* I/O operations on that sector. The set of operations granted by key B
* depends on the ACL bits set in that sector. For more information
- * see the MIFARE Classic specification on {@see http://www.nxp.com}.
+ * see the MIFARE Classic specification on <a href="http://www.nxp.com">http://www.nxp.com</a>.
*
* <p>A failed authentication attempt causes an implicit reconnection to the
* tag, so authentication to other sectors will be lost.
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index 7e7d617..1e6f1ac 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -760,6 +760,8 @@
}
}
checkParcel(this, code, reply, "Unreasonably large binder reply buffer");
+ int replySizeBytes = reply.dataSize();
+ int requestSizeBytes = data.dataSize();
reply.recycle();
data.recycle();
@@ -769,7 +771,7 @@
// to the main transaction loop to wait for another incoming transaction. Either
// way, strict mode begone!
StrictMode.clearGatheredViolations();
- binderCallsStats.callEnded(callSession);
+ binderCallsStats.callEnded(callSession, requestSizeBytes, replySizeBytes);
return res;
}
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 3c3eb54..3d4ce61 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -16,6 +16,7 @@
package android.os;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -381,6 +382,7 @@
/**
* Retrieve a new Parcel object from the pool.
*/
+ @NonNull
public static Parcel obtain() {
final Parcel[] pool = sOwnedPool;
synchronized (pool) {
@@ -432,7 +434,7 @@
*
* @hide
*/
- public void setReadWriteHelper(ReadWriteHelper helper) {
+ public void setReadWriteHelper(@Nullable ReadWriteHelper helper) {
mReadWriteHelper = helper != null ? helper : ReadWriteHelper.DEFAULT;
}
@@ -543,7 +545,7 @@
/**
* Set the bytes in data to be the raw bytes of this Parcel.
*/
- public final void unmarshall(byte[] data, int offset, int length) {
+ public final void unmarshall(@NonNull byte[] data, int offset, int length) {
updateNativeSize(nativeUnmarshall(mNativePtr, data, offset, length));
}
@@ -565,6 +567,7 @@
}
/** @hide */
+ @Nullable
public final Object getClassCookie(Class clz) {
return mClassCookies != null ? mClassCookies.get(clz) : null;
}
@@ -615,7 +618,7 @@
* growing {@link #dataCapacity} if needed.
* @param b Bytes to place into the parcel.
*/
- public final void writeByteArray(byte[] b) {
+ public final void writeByteArray(@Nullable byte[] b) {
writeByteArray(b, 0, (b != null) ? b.length : 0);
}
@@ -626,7 +629,7 @@
* @param offset Index of first byte to be written.
* @param len Number of bytes to write.
*/
- public final void writeByteArray(byte[] b, int offset, int len) {
+ public final void writeByteArray(@Nullable byte[] b, int offset, int len) {
if (b == null) {
writeInt(-1);
return;
@@ -642,7 +645,7 @@
* {@hide}
* {@SystemApi}
*/
- public final void writeBlob(byte[] b) {
+ public final void writeBlob(@Nullable byte[] b) {
writeBlob(b, 0, (b != null) ? b.length : 0);
}
@@ -655,7 +658,7 @@
* {@hide}
* {@SystemApi}
*/
- public final void writeBlob(byte[] b, int offset, int len) {
+ public final void writeBlob(@Nullable byte[] b, int offset, int len) {
if (b == null) {
writeInt(-1);
return;
@@ -700,7 +703,7 @@
* Write a string value into the parcel at the current dataPosition(),
* growing dataCapacity() if needed.
*/
- public final void writeString(String val) {
+ public final void writeString(@Nullable String val) {
mReadWriteHelper.writeString(this, val);
}
@@ -711,7 +714,7 @@
*
* @hide
*/
- public void writeStringNoHelper(String val) {
+ public void writeStringNoHelper(@Nullable String val) {
nativeWriteString(mNativePtr, val);
}
@@ -731,7 +734,7 @@
* growing dataCapacity() if needed.
* @hide
*/
- public final void writeCharSequence(CharSequence val) {
+ public final void writeCharSequence(@Nullable CharSequence val) {
TextUtils.writeToParcel(val, this, 0);
}
@@ -761,7 +764,7 @@
* accepts contextual flags and will close the original file descriptor
* if {@link Parcelable#PARCELABLE_WRITE_RETURN_VALUE} is set.</p>
*/
- public final void writeFileDescriptor(FileDescriptor val) {
+ public final void writeFileDescriptor(@NonNull FileDescriptor val) {
updateNativeSize(nativeWriteFileDescriptor(mNativePtr, val));
}
@@ -786,7 +789,7 @@
* {@hide}
* This will be the new name for writeFileDescriptor, for consistency.
**/
- public final void writeRawFileDescriptor(FileDescriptor val) {
+ public final void writeRawFileDescriptor(@NonNull FileDescriptor val) {
nativeWriteFileDescriptor(mNativePtr, val);
}
@@ -796,7 +799,7 @@
*
* @param value The array of objects to be written.
*/
- public final void writeRawFileDescriptorArray(FileDescriptor[] value) {
+ public final void writeRawFileDescriptorArray(@Nullable FileDescriptor[] value) {
if (value != null) {
int N = value.length;
writeInt(N);
@@ -830,7 +833,7 @@
* this method, since the Bundle class provides a type-safe API that
* allows you to avoid mysterious type errors at the point of marshalling.
*/
- public final void writeMap(Map val) {
+ public final void writeMap(@Nullable Map val) {
writeMapInternal((Map<String, Object>) val);
}
@@ -838,7 +841,7 @@
* Flatten a Map into the parcel at the current dataPosition(),
* growing dataCapacity() if needed. The Map keys must be String objects.
*/
- /* package */ void writeMapInternal(Map<String,Object> val) {
+ /* package */ void writeMapInternal(@Nullable Map<String,Object> val) {
if (val == null) {
writeInt(-1);
return;
@@ -855,7 +858,7 @@
* Flatten an ArrayMap into the parcel at the current dataPosition(),
* growing dataCapacity() if needed. The Map keys must be String objects.
*/
- /* package */ void writeArrayMapInternal(ArrayMap<String, Object> val) {
+ /* package */ void writeArrayMapInternal(@Nullable ArrayMap<String, Object> val) {
if (val == null) {
writeInt(-1);
return;
@@ -884,7 +887,7 @@
/**
* @hide For testing only.
*/
- public void writeArrayMap(ArrayMap<String, Object> val) {
+ public void writeArrayMap(@Nullable ArrayMap<String, Object> val) {
writeArrayMapInternal(val);
}
@@ -907,7 +910,7 @@
* Flatten a Bundle into the parcel at the current dataPosition(),
* growing dataCapacity() if needed.
*/
- public final void writeBundle(Bundle val) {
+ public final void writeBundle(@Nullable Bundle val) {
if (val == null) {
writeInt(-1);
return;
@@ -920,7 +923,7 @@
* Flatten a PersistableBundle into the parcel at the current dataPosition(),
* growing dataCapacity() if needed.
*/
- public final void writePersistableBundle(PersistableBundle val) {
+ public final void writePersistableBundle(@Nullable PersistableBundle val) {
if (val == null) {
writeInt(-1);
return;
@@ -933,7 +936,7 @@
* Flatten a Size into the parcel at the current dataPosition(),
* growing dataCapacity() if needed.
*/
- public final void writeSize(Size val) {
+ public final void writeSize(@NonNull Size val) {
writeInt(val.getWidth());
writeInt(val.getHeight());
}
@@ -942,7 +945,7 @@
* Flatten a SizeF into the parcel at the current dataPosition(),
* growing dataCapacity() if needed.
*/
- public final void writeSizeF(SizeF val) {
+ public final void writeSizeF(@NonNull SizeF val) {
writeFloat(val.getWidth());
writeFloat(val.getHeight());
}
@@ -952,7 +955,7 @@
* dataCapacity() if needed. The List values are written using
* {@link #writeValue} and must follow the specification there.
*/
- public final void writeList(List val) {
+ public final void writeList(@Nullable List val) {
if (val == null) {
writeInt(-1);
return;
@@ -971,7 +974,7 @@
* growing dataCapacity() if needed. The array values are written using
* {@link #writeValue} and must follow the specification there.
*/
- public final void writeArray(Object[] val) {
+ public final void writeArray(@Nullable Object[] val) {
if (val == null) {
writeInt(-1);
return;
@@ -991,7 +994,7 @@
* values are written using {@link #writeValue} and must follow the
* specification there.
*/
- public final void writeSparseArray(SparseArray<Object> val) {
+ public final void writeSparseArray(@Nullable SparseArray<Object> val) {
if (val == null) {
writeInt(-1);
return;
@@ -1006,7 +1009,7 @@
}
}
- public final void writeSparseBooleanArray(SparseBooleanArray val) {
+ public final void writeSparseBooleanArray(@Nullable SparseBooleanArray val) {
if (val == null) {
writeInt(-1);
return;
@@ -1024,7 +1027,7 @@
/**
* @hide
*/
- public final void writeSparseIntArray(SparseIntArray val) {
+ public final void writeSparseIntArray(@Nullable SparseIntArray val) {
if (val == null) {
writeInt(-1);
return;
@@ -1039,7 +1042,7 @@
}
}
- public final void writeBooleanArray(boolean[] val) {
+ public final void writeBooleanArray(@Nullable boolean[] val) {
if (val != null) {
int N = val.length;
writeInt(N);
@@ -1051,6 +1054,7 @@
}
}
+ @Nullable
public final boolean[] createBooleanArray() {
int N = readInt();
// >>2 as a fast divide-by-4 works in the create*Array() functions
@@ -1067,7 +1071,7 @@
}
}
- public final void readBooleanArray(boolean[] val) {
+ public final void readBooleanArray(@NonNull boolean[] val) {
int N = readInt();
if (N == val.length) {
for (int i=0; i<N; i++) {
@@ -1078,7 +1082,7 @@
}
}
- public final void writeCharArray(char[] val) {
+ public final void writeCharArray(@Nullable char[] val) {
if (val != null) {
int N = val.length;
writeInt(N);
@@ -1090,6 +1094,7 @@
}
}
+ @Nullable
public final char[] createCharArray() {
int N = readInt();
if (N >= 0 && N <= (dataAvail() >> 2)) {
@@ -1103,7 +1108,7 @@
}
}
- public final void readCharArray(char[] val) {
+ public final void readCharArray(@NonNull char[] val) {
int N = readInt();
if (N == val.length) {
for (int i=0; i<N; i++) {
@@ -1114,7 +1119,7 @@
}
}
- public final void writeIntArray(int[] val) {
+ public final void writeIntArray(@Nullable int[] val) {
if (val != null) {
int N = val.length;
writeInt(N);
@@ -1126,6 +1131,7 @@
}
}
+ @Nullable
public final int[] createIntArray() {
int N = readInt();
if (N >= 0 && N <= (dataAvail() >> 2)) {
@@ -1139,7 +1145,7 @@
}
}
- public final void readIntArray(int[] val) {
+ public final void readIntArray(@NonNull int[] val) {
int N = readInt();
if (N == val.length) {
for (int i=0; i<N; i++) {
@@ -1150,7 +1156,7 @@
}
}
- public final void writeLongArray(long[] val) {
+ public final void writeLongArray(@Nullable long[] val) {
if (val != null) {
int N = val.length;
writeInt(N);
@@ -1162,6 +1168,7 @@
}
}
+ @Nullable
public final long[] createLongArray() {
int N = readInt();
// >>3 because stored longs are 64 bits
@@ -1176,7 +1183,7 @@
}
}
- public final void readLongArray(long[] val) {
+ public final void readLongArray(@NonNull long[] val) {
int N = readInt();
if (N == val.length) {
for (int i=0; i<N; i++) {
@@ -1187,7 +1194,7 @@
}
}
- public final void writeFloatArray(float[] val) {
+ public final void writeFloatArray(@Nullable float[] val) {
if (val != null) {
int N = val.length;
writeInt(N);
@@ -1199,6 +1206,7 @@
}
}
+ @Nullable
public final float[] createFloatArray() {
int N = readInt();
// >>2 because stored floats are 4 bytes
@@ -1213,7 +1221,7 @@
}
}
- public final void readFloatArray(float[] val) {
+ public final void readFloatArray(@NonNull float[] val) {
int N = readInt();
if (N == val.length) {
for (int i=0; i<N; i++) {
@@ -1224,7 +1232,7 @@
}
}
- public final void writeDoubleArray(double[] val) {
+ public final void writeDoubleArray(@Nullable double[] val) {
if (val != null) {
int N = val.length;
writeInt(N);
@@ -1236,6 +1244,7 @@
}
}
+ @Nullable
public final double[] createDoubleArray() {
int N = readInt();
// >>3 because stored doubles are 8 bytes
@@ -1250,7 +1259,7 @@
}
}
- public final void readDoubleArray(double[] val) {
+ public final void readDoubleArray(@NonNull double[] val) {
int N = readInt();
if (N == val.length) {
for (int i=0; i<N; i++) {
@@ -1261,7 +1270,7 @@
}
}
- public final void writeStringArray(String[] val) {
+ public final void writeStringArray(@Nullable String[] val) {
if (val != null) {
int N = val.length;
writeInt(N);
@@ -1273,6 +1282,7 @@
}
}
+ @Nullable
public final String[] createStringArray() {
int N = readInt();
if (N >= 0) {
@@ -1286,7 +1296,7 @@
}
}
- public final void readStringArray(String[] val) {
+ public final void readStringArray(@NonNull String[] val) {
int N = readInt();
if (N == val.length) {
for (int i=0; i<N; i++) {
@@ -1297,7 +1307,7 @@
}
}
- public final void writeBinderArray(IBinder[] val) {
+ public final void writeBinderArray(@Nullable IBinder[] val) {
if (val != null) {
int N = val.length;
writeInt(N);
@@ -1312,7 +1322,7 @@
/**
* @hide
*/
- public final void writeCharSequenceArray(CharSequence[] val) {
+ public final void writeCharSequenceArray(@Nullable CharSequence[] val) {
if (val != null) {
int N = val.length;
writeInt(N);
@@ -1327,7 +1337,7 @@
/**
* @hide
*/
- public final void writeCharSequenceList(ArrayList<CharSequence> val) {
+ public final void writeCharSequenceList(@Nullable ArrayList<CharSequence> val) {
if (val != null) {
int N = val.size();
writeInt(N);
@@ -1339,6 +1349,7 @@
}
}
+ @Nullable
public final IBinder[] createBinderArray() {
int N = readInt();
if (N >= 0) {
@@ -1352,7 +1363,7 @@
}
}
- public final void readBinderArray(IBinder[] val) {
+ public final void readBinderArray(@NonNull IBinder[] val) {
int N = readInt();
if (N == val.length) {
for (int i=0; i<N; i++) {
@@ -1377,14 +1388,14 @@
* @see #readTypedList
* @see Parcelable
*/
- public final <T extends Parcelable> void writeTypedList(List<T> val) {
+ public final <T extends Parcelable> void writeTypedList(@Nullable List<T> val) {
writeTypedList(val, 0);
}
/**
* @hide
*/
- public <T extends Parcelable> void writeTypedList(List<T> val, int parcelableFlags) {
+ public <T extends Parcelable> void writeTypedList(@Nullable List<T> val, int parcelableFlags) {
if (val == null) {
writeInt(-1);
return;
@@ -1409,7 +1420,7 @@
* @see #createStringArrayList
* @see #readStringList
*/
- public final void writeStringList(List<String> val) {
+ public final void writeStringList(@Nullable List<String> val) {
if (val == null) {
writeInt(-1);
return;
@@ -1434,7 +1445,7 @@
* @see #createBinderArrayList
* @see #readBinderList
*/
- public final void writeBinderList(List<IBinder> val) {
+ public final void writeBinderList(@Nullable List<IBinder> val) {
if (val == null) {
writeInt(-1);
return;
@@ -1456,7 +1467,7 @@
* @see #readParcelableList(List, ClassLoader)
* @hide
*/
- public final <T extends Parcelable> void writeParcelableList(List<T> val, int flags) {
+ public final <T extends Parcelable> void writeParcelableList(@Nullable List<T> val, int flags) {
if (val == null) {
writeInt(-1);
return;
@@ -1489,7 +1500,7 @@
* @see #writeParcelableArray
* @see Parcelable.Creator
*/
- public final <T extends Parcelable> void writeTypedArray(T[] val,
+ public final <T extends Parcelable> void writeTypedArray(@Nullable T[] val,
int parcelableFlags) {
if (val != null) {
int N = val.length;
@@ -1511,7 +1522,8 @@
*
* @see #readTypedObject
*/
- public final <T extends Parcelable> void writeTypedObject(T val, int parcelableFlags) {
+ public final <T extends Parcelable> void writeTypedObject(@Nullable T val,
+ int parcelableFlags) {
if (val != null) {
writeInt(1);
val.writeToParcel(this, parcelableFlags);
@@ -1563,7 +1575,7 @@
* Binder calls (where {@link Parcelable#PARCELABLE_WRITE_RETURN_VALUE}
* should be used).</p>
*/
- public final void writeValue(Object v) {
+ public final void writeValue(@Nullable Object v) {
if (v == null) {
writeInt(VAL_NULL);
} else if (v instanceof String) {
@@ -1675,7 +1687,7 @@
* @param parcelableFlags Contextual flags as per
* {@link Parcelable#writeToParcel(Parcel, int) Parcelable.writeToParcel()}.
*/
- public final void writeParcelable(Parcelable p, int parcelableFlags) {
+ public final void writeParcelable(@Nullable Parcelable p, int parcelableFlags) {
if (p == null) {
writeString(null);
return;
@@ -1685,7 +1697,7 @@
}
/** @hide */
- public final void writeParcelableCreator(Parcelable p) {
+ public final void writeParcelableCreator(@NonNull Parcelable p) {
String name = p.getClass().getName();
writeString(name);
}
@@ -1696,7 +1708,7 @@
* overhead is extremely large, and this approach will be much slower than
* using the other approaches to writing data in to a Parcel.
*/
- public final void writeSerializable(Serializable s) {
+ public final void writeSerializable(@Nullable Serializable s) {
if (s == null) {
writeString(null);
return;
@@ -1747,7 +1759,7 @@
* @see #writeNoException
* @see #readException
*/
- public final void writeException(Exception e) {
+ public final void writeException(@NonNull Exception e) {
int code = 0;
if (e instanceof Parcelable
&& (e.getClass().getClassLoader() == Parcelable.class.getClassLoader())) {
@@ -2001,6 +2013,7 @@
/**
* Read a string value from the parcel at the current dataPosition().
*/
+ @Nullable
public final String readString() {
return mReadWriteHelper.readString(this);
}
@@ -2012,6 +2025,7 @@
*
* @hide
*/
+ @Nullable
public String readStringNoHelper() {
return nativeReadString(mNativePtr);
}
@@ -2027,6 +2041,7 @@
* Read a CharSequence value from the parcel at the current dataPosition().
* @hide
*/
+ @Nullable
public final CharSequence readCharSequence() {
return TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(this);
}
@@ -2056,6 +2071,7 @@
* Read and return a new array of FileDescriptors from the parcel.
* @return the FileDescriptor array, or null if the array is null.
**/
+ @Nullable
public final FileDescriptor[] createRawFileDescriptorArray() {
int N = readInt();
if (N < 0) {
@@ -2110,7 +2126,7 @@
* been written with {@link #writeBundle}. Read into an existing Map object
* from the parcel at the current dataPosition().
*/
- public final void readMap(Map outVal, ClassLoader loader) {
+ public final void readMap(@NonNull Map outVal, @Nullable ClassLoader loader) {
int N = readInt();
readMapInternal(outVal, N, loader);
}
@@ -2120,7 +2136,7 @@
* dataPosition(), using the given class loader to load any enclosed
* Parcelables. If it is null, the default class loader is used.
*/
- public final void readList(List outVal, ClassLoader loader) {
+ public final void readList(@NonNull List outVal, @Nullable ClassLoader loader) {
int N = readInt();
readListInternal(outVal, N, loader);
}
@@ -2132,7 +2148,8 @@
* class loader to load any enclosed Parcelables. Returns null if
* the previously written map object was null.
*/
- public final HashMap readHashMap(ClassLoader loader)
+ @Nullable
+ public final HashMap readHashMap(@Nullable ClassLoader loader)
{
int N = readInt();
if (N < 0) {
@@ -2148,6 +2165,7 @@
* dataPosition(). Returns null if the previously written Bundle object was
* null.
*/
+ @Nullable
public final Bundle readBundle() {
return readBundle(null);
}
@@ -2158,7 +2176,8 @@
* loader of the Bundle for later retrieval of Parcelable objects.
* Returns null if the previously written Bundle object was null.
*/
- public final Bundle readBundle(ClassLoader loader) {
+ @Nullable
+ public final Bundle readBundle(@Nullable ClassLoader loader) {
int length = readInt();
if (length < 0) {
if (Bundle.DEBUG) Log.d(TAG, "null bundle: length=" + length);
@@ -2177,6 +2196,7 @@
* dataPosition(). Returns null if the previously written Bundle object was
* null.
*/
+ @Nullable
public final PersistableBundle readPersistableBundle() {
return readPersistableBundle(null);
}
@@ -2187,7 +2207,8 @@
* loader of the Bundle for later retrieval of Parcelable objects.
* Returns null if the previously written Bundle object was null.
*/
- public final PersistableBundle readPersistableBundle(ClassLoader loader) {
+ @Nullable
+ public final PersistableBundle readPersistableBundle(@Nullable ClassLoader loader) {
int length = readInt();
if (length < 0) {
if (Bundle.DEBUG) Log.d(TAG, "null bundle: length=" + length);
@@ -2204,6 +2225,7 @@
/**
* Read a Size from the parcel at the current dataPosition().
*/
+ @NonNull
public final Size readSize() {
final int width = readInt();
final int height = readInt();
@@ -2213,6 +2235,7 @@
/**
* Read a SizeF from the parcel at the current dataPosition().
*/
+ @NonNull
public final SizeF readSizeF() {
final float width = readFloat();
final float height = readFloat();
@@ -2222,6 +2245,7 @@
/**
* Read and return a byte[] object from the parcel.
*/
+ @Nullable
public final byte[] createByteArray() {
return nativeCreateByteArray(mNativePtr);
}
@@ -2230,7 +2254,7 @@
* Read a byte[] object from the parcel and copy it into the
* given byte array.
*/
- public final void readByteArray(byte[] val) {
+ public final void readByteArray(@NonNull byte[] val) {
boolean valid = nativeReadByteArray(mNativePtr, val, (val != null) ? val.length : 0);
if (!valid) {
throw new RuntimeException("bad array lengths");
@@ -2242,6 +2266,7 @@
* {@hide}
* {@SystemApi}
*/
+ @Nullable
public final byte[] readBlob() {
return nativeReadBlob(mNativePtr);
}
@@ -2250,6 +2275,7 @@
* Read and return a String[] object from the parcel.
* {@hide}
*/
+ @Nullable
public final String[] readStringArray() {
String[] array = null;
@@ -2271,6 +2297,7 @@
* Read and return a CharSequence[] object from the parcel.
* {@hide}
*/
+ @Nullable
public final CharSequence[] readCharSequenceArray() {
CharSequence[] array = null;
@@ -2292,6 +2319,7 @@
* Read and return an ArrayList<CharSequence> object from the parcel.
* {@hide}
*/
+ @Nullable
public final ArrayList<CharSequence> readCharSequenceList() {
ArrayList<CharSequence> array = null;
@@ -2313,7 +2341,8 @@
* null. The given class loader will be used to load any enclosed
* Parcelables.
*/
- public final ArrayList readArrayList(ClassLoader loader) {
+ @Nullable
+ public final ArrayList readArrayList(@Nullable ClassLoader loader) {
int N = readInt();
if (N < 0) {
return null;
@@ -2329,7 +2358,8 @@
* null. The given class loader will be used to load any enclosed
* Parcelables.
*/
- public final Object[] readArray(ClassLoader loader) {
+ @Nullable
+ public final Object[] readArray(@Nullable ClassLoader loader) {
int N = readInt();
if (N < 0) {
return null;
@@ -2345,7 +2375,8 @@
* null. The given class loader will be used to load any enclosed
* Parcelables.
*/
- public final SparseArray readSparseArray(ClassLoader loader) {
+ @Nullable
+ public final SparseArray readSparseArray(@Nullable ClassLoader loader) {
int N = readInt();
if (N < 0) {
return null;
@@ -2360,6 +2391,7 @@
* dataPosition(). Returns null if the previously written list object was
* null.
*/
+ @Nullable
public final SparseBooleanArray readSparseBooleanArray() {
int N = readInt();
if (N < 0) {
@@ -2375,6 +2407,7 @@
* dataPosition(). Returns null if the previously written array object was null.
* @hide
*/
+ @Nullable
public final SparseIntArray readSparseIntArray() {
int N = readInt();
if (N < 0) {
@@ -2398,7 +2431,8 @@
*
* @see #writeTypedList
*/
- public final <T> ArrayList<T> createTypedArrayList(Parcelable.Creator<T> c) {
+ @Nullable
+ public final <T> ArrayList<T> createTypedArrayList(@NonNull Parcelable.Creator<T> c) {
int N = readInt();
if (N < 0) {
return null;
@@ -2423,7 +2457,7 @@
*
* @see #writeTypedList
*/
- public final <T> void readTypedList(List<T> list, Parcelable.Creator<T> c) {
+ public final <T> void readTypedList(@NonNull List<T> list, @NonNull Parcelable.Creator<T> c) {
int M = list.size();
int N = readInt();
int i = 0;
@@ -2449,6 +2483,7 @@
*
* @see #writeStringList
*/
+ @Nullable
public final ArrayList<String> createStringArrayList() {
int N = readInt();
if (N < 0) {
@@ -2473,6 +2508,7 @@
*
* @see #writeBinderList
*/
+ @Nullable
public final ArrayList<IBinder> createBinderArrayList() {
int N = readInt();
if (N < 0) {
@@ -2492,7 +2528,7 @@
*
* @see #writeStringList
*/
- public final void readStringList(List<String> list) {
+ public final void readStringList(@NonNull List<String> list) {
int M = list.size();
int N = readInt();
int i = 0;
@@ -2513,7 +2549,7 @@
*
* @see #writeBinderList
*/
- public final void readBinderList(List<IBinder> list) {
+ public final void readBinderList(@NonNull List<IBinder> list) {
int M = list.size();
int N = readInt();
int i = 0;
@@ -2536,7 +2572,9 @@
* @see #writeParcelableList(List, int)
* @hide
*/
- public final <T extends Parcelable> List<T> readParcelableList(List<T> list, ClassLoader cl) {
+ @NonNull
+ public final <T extends Parcelable> List<T> readParcelableList(@NonNull List<T> list,
+ @Nullable ClassLoader cl) {
final int N = readInt();
if (N == -1) {
list.clear();
@@ -2569,7 +2607,8 @@
*
* @see #writeTypedArray
*/
- public final <T> T[] createTypedArray(Parcelable.Creator<T> c) {
+ @Nullable
+ public final <T> T[] createTypedArray(@NonNull Parcelable.Creator<T> c) {
int N = readInt();
if (N < 0) {
return null;
@@ -2581,7 +2620,7 @@
return l;
}
- public final <T> void readTypedArray(T[] val, Parcelable.Creator<T> c) {
+ public final <T> void readTypedArray(@NonNull T[] val, @NonNull Parcelable.Creator<T> c) {
int N = readInt();
if (N == val.length) {
for (int i=0; i<N; i++) {
@@ -2612,7 +2651,8 @@
*
* @see #writeTypedObject
*/
- public final <T> T readTypedObject(Parcelable.Creator<T> c) {
+ @Nullable
+ public final <T> T readTypedObject(@NonNull Parcelable.Creator<T> c) {
if (readInt() != 0) {
return c.createFromParcel(this);
} else {
@@ -2633,7 +2673,7 @@
*
* @see #writeTypedArray
*/
- public final <T extends Parcelable> void writeParcelableArray(T[] value,
+ public final <T extends Parcelable> void writeParcelableArray(@Nullable T[] value,
int parcelableFlags) {
if (value != null) {
int N = value.length;
@@ -2651,7 +2691,8 @@
* used to load any enclosed Parcelables. If it is null, the default class
* loader will be used.
*/
- public final Object readValue(ClassLoader loader) {
+ @Nullable
+ public final Object readValue(@Nullable ClassLoader loader) {
int type = readInt();
switch (type) {
@@ -2764,7 +2805,8 @@
* was an error trying to instantiate the Parcelable.
*/
@SuppressWarnings("unchecked")
- public final <T extends Parcelable> T readParcelable(ClassLoader loader) {
+ @Nullable
+ public final <T extends Parcelable> T readParcelable(@Nullable ClassLoader loader) {
Parcelable.Creator<?> creator = readParcelableCreator(loader);
if (creator == null) {
return null;
@@ -2779,8 +2821,9 @@
/** @hide */
@SuppressWarnings("unchecked")
- public final <T extends Parcelable> T readCreator(Parcelable.Creator<?> creator,
- ClassLoader loader) {
+ @Nullable
+ public final <T extends Parcelable> T readCreator(@NonNull Parcelable.Creator<?> creator,
+ @Nullable ClassLoader loader) {
if (creator instanceof Parcelable.ClassLoaderCreator<?>) {
Parcelable.ClassLoaderCreator<?> classLoaderCreator =
(Parcelable.ClassLoaderCreator<?>) creator;
@@ -2790,7 +2833,8 @@
}
/** @hide */
- public final Parcelable.Creator<?> readParcelableCreator(ClassLoader loader) {
+ @Nullable
+ public final Parcelable.Creator<?> readParcelableCreator(@Nullable ClassLoader loader) {
String name = readString();
if (name == null) {
return null;
@@ -2866,7 +2910,8 @@
* Parcelables.
* @return the Parcelable array, or null if the array is null
*/
- public final Parcelable[] readParcelableArray(ClassLoader loader) {
+ @Nullable
+ public final Parcelable[] readParcelableArray(@Nullable ClassLoader loader) {
int N = readInt();
if (N < 0) {
return null;
@@ -2879,8 +2924,9 @@
}
/** @hide */
- public final <T extends Parcelable> T[] readParcelableArray(ClassLoader loader,
- Class<T> clazz) {
+ @Nullable
+ public final <T extends Parcelable> T[] readParcelableArray(@Nullable ClassLoader loader,
+ @NonNull Class<T> clazz) {
int N = readInt();
if (N < 0) {
return null;
@@ -2897,11 +2943,13 @@
* @return the Serializable object, or null if the Serializable name
* wasn't found in the parcel.
*/
+ @Nullable
public final Serializable readSerializable() {
return readSerializable(null);
}
- private final Serializable readSerializable(final ClassLoader loader) {
+ @Nullable
+ private final Serializable readSerializable(@Nullable final ClassLoader loader) {
String name = readString();
if (name == null) {
// For some reason we were unable to read the name of the Serializable (either there
@@ -3016,8 +3064,8 @@
destroy();
}
- /* package */ void readMapInternal(Map outVal, int N,
- ClassLoader loader) {
+ /* package */ void readMapInternal(@NonNull Map outVal, int N,
+ @Nullable ClassLoader loader) {
while (N > 0) {
Object key = readValue(loader);
Object value = readValue(loader);
@@ -3026,8 +3074,8 @@
}
}
- /* package */ void readArrayMapInternal(ArrayMap outVal, int N,
- ClassLoader loader) {
+ /* package */ void readArrayMapInternal(@NonNull ArrayMap outVal, int N,
+ @Nullable ClassLoader loader) {
if (DEBUG_ARRAY_MAP) {
RuntimeException here = new RuntimeException("here");
here.fillInStackTrace();
@@ -3047,8 +3095,8 @@
outVal.validate();
}
- /* package */ void readArrayMapSafelyInternal(ArrayMap outVal, int N,
- ClassLoader loader) {
+ /* package */ void readArrayMapSafelyInternal(@NonNull ArrayMap outVal, int N,
+ @Nullable ClassLoader loader) {
if (DEBUG_ARRAY_MAP) {
RuntimeException here = new RuntimeException("here");
here.fillInStackTrace();
@@ -3067,7 +3115,7 @@
/**
* @hide For testing only.
*/
- public void readArrayMap(ArrayMap outVal, ClassLoader loader) {
+ public void readArrayMap(@NonNull ArrayMap outVal, @Nullable ClassLoader loader) {
final int N = readInt();
if (N < 0) {
return;
@@ -3082,7 +3130,7 @@
*
* @hide
*/
- public @Nullable ArraySet<? extends Object> readArraySet(ClassLoader loader) {
+ public @Nullable ArraySet<? extends Object> readArraySet(@Nullable ClassLoader loader) {
final int size = readInt();
if (size < 0) {
return null;
@@ -3095,8 +3143,8 @@
return result;
}
- private void readListInternal(List outVal, int N,
- ClassLoader loader) {
+ private void readListInternal(@NonNull List outVal, int N,
+ @Nullable ClassLoader loader) {
while (N > 0) {
Object value = readValue(loader);
//Log.d(TAG, "Unmarshalling value=" + value);
@@ -3105,8 +3153,8 @@
}
}
- private void readArrayInternal(Object[] outVal, int N,
- ClassLoader loader) {
+ private void readArrayInternal(@NonNull Object[] outVal, int N,
+ @Nullable ClassLoader loader) {
for (int i = 0; i < N; i++) {
Object value = readValue(loader);
//Log.d(TAG, "Unmarshalling value=" + value);
@@ -3114,8 +3162,8 @@
}
}
- private void readSparseArrayInternal(SparseArray outVal, int N,
- ClassLoader loader) {
+ private void readSparseArrayInternal(@NonNull SparseArray outVal, int N,
+ @Nullable ClassLoader loader) {
while (N > 0) {
int key = readInt();
Object value = readValue(loader);
@@ -3126,7 +3174,7 @@
}
- private void readSparseBooleanArrayInternal(SparseBooleanArray outVal, int N) {
+ private void readSparseBooleanArrayInternal(@NonNull SparseBooleanArray outVal, int N) {
while (N > 0) {
int key = readInt();
boolean value = this.readByte() == 1;
@@ -3136,7 +3184,7 @@
}
}
- private void readSparseIntArrayInternal(SparseIntArray outVal, int N) {
+ private void readSparseIntArrayInternal(@NonNull SparseIntArray outVal, int N) {
while (N > 0) {
int key = readInt();
int value = readInt();
diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java
index d96316a..a80dced 100644
--- a/core/java/android/provider/DocumentsContract.java
+++ b/core/java/android/provider/DocumentsContract.java
@@ -157,8 +157,6 @@
* <li>When supplying information in {@link DocumentsProvider#queryChildDocuments}, include
* {@link Document#FLAG_SUPPORTS_SETTINGS} in the flags for each document that supports
* settings.
- *
- * @see DocumentsContact#Document#FLAG_SUPPORTS_SETTINGS
*/
public static final String
ACTION_DOCUMENT_SETTINGS = "android.provider.action.DOCUMENT_SETTINGS";
@@ -434,7 +432,7 @@
* Flag indicating that a Web link can be obtained for the document.
*
* @see #COLUMN_FLAGS
- * @see DocumentsContract#createWebLinkIntent(PackageManager, Uri, Bundle)
+ * @see DocumentsProvider#createWebLinkIntent(String, Bundle)
*/
public static final int FLAG_WEB_LINKABLE = 1 << 12;
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 1da6602..4b45e32 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -203,7 +203,7 @@
/**
* The name of the Intent-extra used to control the orientation of a ViewImage or a MovieView.
* This is an int property that overrides the activity's requestedOrientation.
- * @see android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
+ * @see android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED
*/
public static final String EXTRA_SCREEN_ORIENTATION = "android.intent.extra.screenOrientation";
diff --git a/core/java/android/service/restrictions/RestrictionsReceiver.java b/core/java/android/service/restrictions/RestrictionsReceiver.java
index b830cb1..e8d481a 100644
--- a/core/java/android/service/restrictions/RestrictionsReceiver.java
+++ b/core/java/android/service/restrictions/RestrictionsReceiver.java
@@ -58,7 +58,6 @@
* @param request the request data bundle containing at a minimum a request id.
*
* @see RestrictionsManager#REQUEST_TYPE_APPROVAL
- * @see RestrictionsManager#REQUEST_TYPE_LOCAL_APPROVAL
* @see RestrictionsManager#REQUEST_KEY_ID
*/
public abstract void onRequestPermission(Context context,
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index ba7288d..a0daa07 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -676,7 +676,8 @@
* Flatten a CharSequence and whatever styles can be copied across processes
* into the parcel.
*/
- public static void writeToParcel(CharSequence cs, Parcel p, int parcelableFlags) {
+ public static void writeToParcel(@Nullable CharSequence cs, @NonNull Parcel p,
+ int parcelableFlags) {
if (cs instanceof Spanned) {
p.writeInt(0);
p.writeString(cs.toString());
diff --git a/core/java/android/text/style/EasyEditSpan.java b/core/java/android/text/style/EasyEditSpan.java
index 9ee0b07..305b3306 100644
--- a/core/java/android/text/style/EasyEditSpan.java
+++ b/core/java/android/text/style/EasyEditSpan.java
@@ -39,7 +39,6 @@
*
* @see #TEXT_DELETED
* @see #TEXT_MODIFIED
- * @see #getPendingIntent()
*/
public static final String EXTRA_TEXT_CHANGED_TYPE =
"android.text.style.EXTRA_TEXT_CHANGED_TYPE";
diff --git a/core/java/android/text/style/LocaleSpan.java b/core/java/android/text/style/LocaleSpan.java
index 479ff0e..a3a4bf8 100644
--- a/core/java/android/text/style/LocaleSpan.java
+++ b/core/java/android/text/style/LocaleSpan.java
@@ -97,7 +97,7 @@
* @return The {@link Locale} for this span. If multiple locales are associated with this
* span, only the first locale is returned. {@code null} if no {@link Locale} is specified.
*
- * @see LocaleList#get()
+ * @see LocaleList#get(int)
* @see #getLocales()
*/
@Nullable
diff --git a/core/java/android/text/style/TtsSpan.java b/core/java/android/text/style/TtsSpan.java
index d72a48d..f9a1a0d 100644
--- a/core/java/android/text/style/TtsSpan.java
+++ b/core/java/android/text/style/TtsSpan.java
@@ -1082,7 +1082,7 @@
* Sets the {@link #ARG_UNIT} argument.
* @param unit The unit of the measure.
* @return This instance.
- * @see TtsSpan.ARG_UNIT
+ * @see TtsSpan#ARG_UNIT
*/
public MeasureBuilder setUnit(String unit) {
return setStringArgument(TtsSpan.ARG_UNIT, unit);
diff --git a/core/java/android/transition/Scene.java b/core/java/android/transition/Scene.java
index 4267a65..15ad7de 100644
--- a/core/java/android/transition/Scene.java
+++ b/core/java/android/transition/Scene.java
@@ -224,8 +224,7 @@
* @param action The runnable whose {@link Runnable#run() run()} method will
* be called when this scene is entered
* @see #setExitAction(Runnable)
- * @see Scene#Scene(ViewGroup, int, Context)
- * @see Scene#Scene(ViewGroup, ViewGroup)
+ * @see Scene#Scene(ViewGroup, View)
*/
public void setEnterAction(Runnable action) {
mEnterAction = action;
@@ -245,8 +244,7 @@
* if an enter action is set.
*
* @see #setEnterAction(Runnable)
- * @see Scene#Scene(ViewGroup, int, Context)
- * @see Scene#Scene(ViewGroup, ViewGroup)
+ * @see Scene#Scene(ViewGroup, View)
*/
public void setExitAction(Runnable action) {
mExitAction = action;
diff --git a/core/java/android/view/KeyCharacterMap.java b/core/java/android/view/KeyCharacterMap.java
index 02202db..b7b56e8 100644
--- a/core/java/android/view/KeyCharacterMap.java
+++ b/core/java/android/view/KeyCharacterMap.java
@@ -123,7 +123,7 @@
/**
* Modifier keys may be chorded with character keys.
*
- * @see {#link #getModifierBehavior()} for more details.
+ * @see #getModifierBehavior()
*/
public static final int MODIFIER_BEHAVIOR_CHORDED = 0;
@@ -131,7 +131,7 @@
* Modifier keys may be chorded with character keys or they may toggle
* into latched or locked states when pressed independently.
*
- * @see {#link #getModifierBehavior()} for more details.
+ * @see #getModifierBehavior()
*/
public static final int MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED = 1;
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index dd5abaa..35546f8 100644
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -2900,7 +2900,7 @@
*
* @param symbolicName The symbolic name of the keycode.
* @return The keycode or {@link #KEYCODE_UNKNOWN} if not found.
- * @see #keycodeToString(int)
+ * @see #keyCodeToString(int)
*/
public static int keyCodeFromString(@NonNull String symbolicName) {
try {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index fed2426..42e1adc 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3421,7 +3421,7 @@
*
* @see WindowManager.LayoutParams#layoutInDisplayCutoutMode
* @see WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
- * @see WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
+ * @see WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
* @see WindowManager.LayoutParams#LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
*/
public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 0x00000400;
@@ -17303,7 +17303,6 @@
*
* @see #computeHorizontalScrollExtent()
* @see #computeHorizontalScrollOffset()
- * @see android.widget.ScrollBarDrawable
*/
protected int computeHorizontalScrollRange() {
return getWidth();
@@ -17324,7 +17323,6 @@
*
* @see #computeHorizontalScrollRange()
* @see #computeHorizontalScrollExtent()
- * @see android.widget.ScrollBarDrawable
*/
protected int computeHorizontalScrollOffset() {
return mScrollX;
@@ -17345,7 +17343,6 @@
*
* @see #computeHorizontalScrollRange()
* @see #computeHorizontalScrollOffset()
- * @see android.widget.ScrollBarDrawable
*/
protected int computeHorizontalScrollExtent() {
return getWidth();
@@ -17364,7 +17361,6 @@
*
* @see #computeVerticalScrollExtent()
* @see #computeVerticalScrollOffset()
- * @see android.widget.ScrollBarDrawable
*/
protected int computeVerticalScrollRange() {
return getHeight();
@@ -17385,7 +17381,6 @@
*
* @see #computeVerticalScrollRange()
* @see #computeVerticalScrollExtent()
- * @see android.widget.ScrollBarDrawable
*/
protected int computeVerticalScrollOffset() {
return mScrollY;
@@ -17406,7 +17401,6 @@
*
* @see #computeVerticalScrollRange()
* @see #computeVerticalScrollOffset()
- * @see android.widget.ScrollBarDrawable
*/
protected int computeVerticalScrollExtent() {
return getHeight();
@@ -17741,7 +17735,6 @@
* @see #computeHorizontalScrollRange()
* @see #computeHorizontalScrollExtent()
* @see #computeHorizontalScrollOffset()
- * @see android.widget.ScrollBarDrawable
* @hide
*/
protected void onDrawHorizontalScrollBar(Canvas canvas, Drawable scrollBar,
@@ -17761,7 +17754,6 @@
* @see #computeVerticalScrollRange()
* @see #computeVerticalScrollExtent()
* @see #computeVerticalScrollOffset()
- * @see android.widget.ScrollBarDrawable
* @hide
*/
protected void onDrawVerticalScrollBar(Canvas canvas, Drawable scrollBar,
@@ -27124,7 +27116,7 @@
* @param arguments A {@link Bundle} holding any arguments relevant for this request.
* May be {@code null} if the if the service provided no arguments.
*
- * @see AccessibilityNodeInfo#setExtraAvailableData
+ * @see AccessibilityNodeInfo#setAvailableExtraData(List)
*/
public void addExtraDataToAccessibilityNodeInfo(@NonNull View host,
@NonNull AccessibilityNodeInfo info, @NonNull String extraDataKey,
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 37aca26..2090be4 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -485,7 +485,6 @@
* @see #TYPE_APPLICATION_PANEL
* @see #TYPE_APPLICATION_MEDIA
* @see #TYPE_APPLICATION_SUB_PANEL
- * @see #TYPE_APPLICATION_ABOVE_SUB_PANEL
* @see #TYPE_APPLICATION_ATTACHED_DIALOG
* @see #TYPE_STATUS_BAR
* @see #TYPE_SEARCH_BAR
diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java
index 7946e9e..fde9c0d 100644
--- a/core/java/android/view/accessibility/AccessibilityEvent.java
+++ b/core/java/android/view/accessibility/AccessibilityEvent.java
@@ -481,7 +481,7 @@
/**
* Represents the event of scrolling a view. This event type is generally not sent directly.
- * @see View#onScrollChanged(int, int, int, int)
+ * @see android.view.View#onScrollChanged(int, int, int, int)
*/
public static final int TYPE_VIEW_SCROLLED = 0x00001000;
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index 6bacdfe..e8e6537 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -577,7 +577,7 @@
* Integer argument specifying the start index of the requested text location data. Must be
* valid inside the CharSequence returned by {@link #getText()}.
*
- * {@see EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY}
+ * @see #EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY
*/
public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX =
"android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX";
@@ -586,7 +586,7 @@
* Integer argument specifying the end index of the requested text location data. Must be
* positive.
*
- * {@see EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY}
+ * @see #EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY
*/
public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH =
"android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH";
diff --git a/core/java/android/view/accessibility/AccessibilityNodeProvider.java b/core/java/android/view/accessibility/AccessibilityNodeProvider.java
index 73733a0..4b25378 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeProvider.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeProvider.java
@@ -116,7 +116,7 @@
* the info's {@link AccessibilityNodeInfo#getExtras} method.
* @param arguments A {@link Bundle} holding any arguments relevant for this request.
*
- * @see AccessibilityNodeInfo#setExtraAvailableData
+ * @see AccessibilityNodeInfo#setAvailableExtraData(List)
*/
public void addExtraDataToAccessibilityNodeInfo(
int virtualViewId, AccessibilityNodeInfo info, String extraDataKey, Bundle arguments) {
diff --git a/core/java/android/view/accessibility/AccessibilityRequestPreparer.java b/core/java/android/view/accessibility/AccessibilityRequestPreparer.java
index 25f830a..4dcb187 100644
--- a/core/java/android/view/accessibility/AccessibilityRequestPreparer.java
+++ b/core/java/android/view/accessibility/AccessibilityRequestPreparer.java
@@ -85,8 +85,8 @@
* are complete.
*
* @see View#addExtraDataToAccessibilityNodeInfo(AccessibilityNodeInfo, String, Bundle)
- * @see AccessibilityDelegate#addExtraDataToAccessibilityNodeInfo(View, AccessibilityNodeInfo,
- * String, Bundle)
+ * @see View.AccessibilityDelegate#addExtraDataToAccessibilityNodeInfo(
+ * View, AccessibilityNodeInfo, String, Bundle)
* @see AccessibilityNodeProvider#addExtraDataToAccessibilityNodeInfo(
* int, AccessibilityNodeInfo, String, Bundle)
*/
diff --git a/core/java/android/view/inputmethod/InputMethodSession.java b/core/java/android/view/inputmethod/InputMethodSession.java
index 1d82abb..de15f33 100644
--- a/core/java/android/view/inputmethod/InputMethodSession.java
+++ b/core/java/android/view/inputmethod/InputMethodSession.java
@@ -117,7 +117,6 @@
*
* @return Whether the input method wants to handle this event.
*
- * @see #dispatchKeyUp
* @see android.view.KeyEvent
*/
public void dispatchKeyEvent(int seq, KeyEvent event, EventCallback callback);
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 298c61e..97b62a8 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -6408,7 +6408,6 @@
* @param listener The recycler listener to be notified of views set aside
* in the recycler.
*
- * @see android.widget.AbsListView.RecycleBin
* @see android.widget.AbsListView.RecyclerListener
*/
public void setRecyclerListener(RecyclerListener listener) {
@@ -6594,7 +6593,6 @@
* inside the RecycleBin's scrap heap. This listener is used to free resources
* associated to Views placed in the RecycleBin.
*
- * @see android.widget.AbsListView.RecycleBin
* @see android.widget.AbsListView#setRecyclerListener(android.widget.AbsListView.RecyclerListener)
*/
public static interface RecyclerListener {
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index 3aae849..4b76c18 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -473,10 +473,10 @@
* @see #getUseDefaultMargins()
* @see #setAlignmentMode(int)
*
- * @see MarginLayoutParams#leftMargin
- * @see MarginLayoutParams#topMargin
- * @see MarginLayoutParams#rightMargin
- * @see MarginLayoutParams#bottomMargin
+ * @see ViewGroup.MarginLayoutParams#leftMargin
+ * @see ViewGroup.MarginLayoutParams#topMargin
+ * @see ViewGroup.MarginLayoutParams#rightMargin
+ * @see ViewGroup.MarginLayoutParams#bottomMargin
*
* @attr ref android.R.styleable#GridLayout_useDefaultMargins
*/
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index c354634..df07f26 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -4573,10 +4573,6 @@
}
public void noteLongPartialWakelockStart(String name, String historyName, int uid) {
- StatsLog.write_non_chained(StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED,
- uid, null, name, historyName,
- StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED__STATE__ON);
-
uid = mapUid(uid);
noteLongPartialWakeLockStartInternal(name, historyName, uid);
}
@@ -4587,9 +4583,6 @@
for (int i = 0; i < N; ++i) {
final int uid = mapUid(workSource.get(i));
noteLongPartialWakeLockStartInternal(name, historyName, uid);
- StatsLog.write_non_chained(StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED,
- workSource.get(i), workSource.getName(i), name, historyName,
- StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED__STATE__ON);
}
final ArrayList<WorkChain> workChains = workSource.getWorkChains();
@@ -4598,10 +4591,6 @@
final WorkChain workChain = workChains.get(i);
final int uid = workChain.getAttributionUid();
noteLongPartialWakeLockStartInternal(name, historyName, uid);
-
- StatsLog.write(StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED,
- workChain.getUids(), workChain.getTags(), name, historyName,
- StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED__STATE__ON);
}
}
}
@@ -4621,9 +4610,6 @@
}
public void noteLongPartialWakelockFinish(String name, String historyName, int uid) {
- StatsLog.write_non_chained(StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED, uid, null,
- name, historyName, StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED__STATE__OFF);
-
uid = mapUid(uid);
noteLongPartialWakeLockFinishInternal(name, historyName, uid);
}
@@ -4634,9 +4620,6 @@
for (int i = 0; i < N; ++i) {
final int uid = mapUid(workSource.get(i));
noteLongPartialWakeLockFinishInternal(name, historyName, uid);
- StatsLog.write_non_chained(StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED,
- workSource.get(i), workSource.getName(i), name, historyName,
- StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED__STATE__OFF);
}
final ArrayList<WorkChain> workChains = workSource.getWorkChains();
@@ -4645,9 +4628,6 @@
final WorkChain workChain = workChains.get(i);
final int uid = workChain.getAttributionUid();
noteLongPartialWakeLockFinishInternal(name, historyName, uid);
- StatsLog.write(StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED,
- workChain.getUids(), workChain.getTags(), name, historyName,
- StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED__STATE__OFF);
}
}
}
diff --git a/core/java/com/android/internal/os/BinderCallsStats.java b/core/java/com/android/internal/os/BinderCallsStats.java
index ec89d81..fbb99e4 100644
--- a/core/java/com/android/internal/os/BinderCallsStats.java
+++ b/core/java/com/android/internal/os/BinderCallsStats.java
@@ -92,7 +92,7 @@
return s;
}
- public void callEnded(CallSession s) {
+ public void callEnded(CallSession s, int parcelRequestSize, int parcelReplySize) {
Preconditions.checkNotNull(s);
synchronized (mLock) {
long duration;
@@ -110,7 +110,7 @@
// callCount is always incremented, but time only once per sampling interval
long samplesCount = cs.callCount / PERIODIC_SAMPLING_INTERVAL + 1;
duration = cs.cpuTimeMicros / samplesCount;
- latencyDuration = cs.latencyMicros/ samplesCount;
+ latencyDuration = cs.latencyMicros / samplesCount;
}
}
@@ -129,6 +129,11 @@
callStat.cpuTimeMicros += duration;
callStat.latencyMicros += latencyDuration;
callStat.exceptionCount += s.exceptionThrown ? 1 : 0;
+ callStat.maxLatencyMicros = Math.max(callStat.maxLatencyMicros, latencyDuration);
+ callStat.maxRequestSizeBytes =
+ Math.max(callStat.maxRequestSizeBytes, parcelRequestSize);
+ callStat.maxReplySizeBytes =
+ Math.max(callStat.maxReplySizeBytes, parcelReplySize);
} else {
// update sampled timings in the beginning of each interval
if (s.cpuTimeStarted >= 0) {
@@ -184,8 +189,9 @@
StringBuilder sb = new StringBuilder();
if (mDetailedTracking) {
pw.println("Per-UID raw data " + datasetSizeDesc
- + "(uid, call_desc, cpu_time_micros, latency_time_micros, exception_count, "
- + "call_count):");
+ + "(uid, call_desc, cpu_time_micros, latency_time_micros, "
+ + "max_latency_time_micros, exception_count, max_request_size_bytes, "
+ + "max_reply_size_bytes, call_count):");
List<UidEntry> topEntries = verbose ? entries
: getHighestValues(entries, value -> value.cpuTimeMicros, 0.9);
for (UidEntry uidEntry : topEntries) {
@@ -195,7 +201,10 @@
.append(uidEntry.uid).append(",").append(e)
.append(',').append(e.cpuTimeMicros)
.append(',').append(e.latencyMicros)
+ .append(',').append(e.maxLatencyMicros)
.append(',').append(e.exceptionCount)
+ .append(',').append(e.maxRequestSizeBytes)
+ .append(',').append(e.maxReplySizeBytes)
.append(',').append(e.callCount);
pw.println(sb);
}
@@ -280,6 +289,9 @@
public int msg;
public long cpuTimeMicros;
public long latencyMicros;
+ public long maxLatencyMicros;
+ public long maxRequestSizeBytes;
+ public long maxReplySizeBytes;
public long callCount;
public long exceptionCount;
diff --git a/core/proto/android/service/usb.proto b/core/proto/android/service/usb.proto
index c363710..9f58611 100644
--- a/core/proto/android/service/usb.proto
+++ b/core/proto/android/service/usb.proto
@@ -278,6 +278,8 @@
optional int32 user_id = 1;
repeated UsbSettingsDevicePermissionProto device_permissions = 2;
repeated UsbSettingsAccessoryPermissionProto accessory_permissions = 3;
+ repeated UsbDeviceAttachedActivities device_attached_activities = 4;
+ repeated UsbAccessoryAttachedActivities accessory_attached_activities = 5;
}
message UsbSettingsDevicePermissionProto {
@@ -343,3 +345,17 @@
optional string model = 2;
optional string version = 3;
}
+
+message UsbDeviceAttachedActivities {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ optional android.content.ComponentNameProto activity = 1;
+ repeated UsbDeviceFilterProto filters = 2;
+}
+
+message UsbAccessoryAttachedActivities {
+ option (android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ optional android.content.ComponentNameProto activity = 1;
+ repeated UsbAccessoryFilterProto filters = 2;
+}
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 3ea95ed..d2684ce 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -8854,7 +8854,7 @@
<attr name="fontWeight" format="integer" />
<!-- The index of the font in the ttc (TrueType Collection) font file. If the font file
referenced is not in the ttc format, this attribute needs not be specified.
- {@see android.graphics.Typeface#Builder.setTtcIndex(int)}.
+ {@link android.graphics.Typeface.Builder#setTtcIndex(int)}.
The default value is 0. More details about the TrueType Collection font format can be found
here: https://en.wikipedia.org/wiki/TrueType#TrueType_Collection. -->
<attr name="ttcIndex" format="integer" />
diff --git a/core/tests/coretests/src/android/os/ParcelNullabilityTest.java b/core/tests/coretests/src/android/os/ParcelNullabilityTest.java
new file mode 100644
index 0000000..516dc0a
--- /dev/null
+++ b/core/tests/coretests/src/android/os/ParcelNullabilityTest.java
@@ -0,0 +1,391 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import android.support.test.runner.AndroidJUnit4;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.util.ArrayMap;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public final class ParcelNullabilityTest {
+ @Test
+ public void nullByteArray() {
+ Parcel p = Parcel.obtain();
+ p.writeByteArray(null);
+
+ assertNull(throughBytes(p).createByteArray());
+ }
+
+ @Test
+ public void nullBlob() {
+ Parcel p = Parcel.obtain();
+ p.writeBlob(null);
+
+ assertNull(throughBytes(p).readBlob());
+ }
+
+ @Test
+ public void nullString() {
+ Parcel p = Parcel.obtain();
+ p.writeString(null);
+
+ assertNull(throughBytes(p).readString());
+ }
+
+ @Test
+ public void nullCharSequence() {
+ Parcel p = Parcel.obtain();
+ p.writeCharSequence(null);
+
+ assertNull(throughBytes(p).readCharSequence());
+ }
+
+ @Test
+ public void nullStrongBinder() {
+ Parcel p = Parcel.obtain();
+ p.writeStrongBinder(null);
+
+ assertNull(throughBytes(p).readStrongBinder());
+ }
+
+ @Test
+ public void nullStringInterface() {
+ Parcel p = Parcel.obtain();
+ p.writeStrongInterface(null);
+
+ assertNull(throughBytes(p).readStrongBinder());
+ }
+
+ @Test
+ public void nullFileDescriptor() {
+ Parcel p = Parcel.obtain();
+ try {
+ p.writeFileDescriptor(null);
+ fail();
+ } catch (RuntimeException expected) {
+ }
+ }
+
+ @Test
+ public void nullRawFileDescriptor() {
+ Parcel p = Parcel.obtain();
+ try {
+ p.writeRawFileDescriptor(null);
+ fail();
+ } catch (RuntimeException expected) {
+ }
+ }
+
+ @Test
+ public void nullRawFileDescriptorArray() {
+ Parcel p = Parcel.obtain();
+ p.writeRawFileDescriptorArray(null);
+
+ assertNull(throughBytes(p).createRawFileDescriptorArray());
+ }
+
+ @Test
+ public void nullMap() {
+ Parcel p = Parcel.obtain();
+ p.writeMap(null);
+
+ Map<Object, Object> map = new HashMap<>();
+ throughBytes(p).readMap(map, null);
+ assertTrue(map.isEmpty());
+ }
+
+ @Test
+ public void nullArrayMap() {
+ Parcel p = Parcel.obtain();
+ p.writeArrayMap(null);
+
+ ArrayMap<Object, Object> map = new ArrayMap<>();
+ throughBytes(p).readArrayMap(map, null);
+ assertTrue(map.isEmpty());
+ }
+
+ @Test
+ public void nullArraySet() {
+ Parcel p = Parcel.obtain();
+ p.writeArraySet(null);
+
+ assertNull(throughBytes(p).readArraySet(null));
+ }
+
+ @Test
+ public void nullBundle() {
+ Parcel p = Parcel.obtain();
+ p.writeBundle(null);
+
+ assertNull(throughBytes(p).readBundle());
+ }
+
+ @Test
+ public void nullPersistableBundle() {
+ Parcel p = Parcel.obtain();
+ p.writePersistableBundle(null);
+
+ assertNull(throughBytes(p).readPersistableBundle());
+ }
+
+ @Test
+ public void nullSize() {
+ Parcel p = Parcel.obtain();
+ try {
+ p.writeSize(null);
+ fail();
+ } catch (RuntimeException expected) {
+ }
+ }
+
+ @Test
+ public void nullSizeF() {
+ Parcel p = Parcel.obtain();
+ try {
+ p.writeSizeF(null);
+ fail();
+ } catch (RuntimeException expected) {
+ }
+ }
+
+ @Test
+ public void nullList() {
+ Parcel p = Parcel.obtain();
+ p.writeList(null);
+
+ List<Object> map = new ArrayList<>();
+ throughBytes(p).readList(map, null);
+ assertTrue(map.isEmpty());
+ }
+
+ @Test
+ public void nullArray() {
+ Parcel p = Parcel.obtain();
+ p.writeArray(null);
+
+ assertNull(throughBytes(p).readArray(null));
+ }
+
+ @Test
+ public void nullSparseArray() {
+ Parcel p = Parcel.obtain();
+ p.writeSparseArray(null);
+
+ assertNull(throughBytes(p).readSparseArray(null));
+ }
+
+ @Test
+ public void nullSparseBooleanArray() {
+ Parcel p = Parcel.obtain();
+ p.writeSparseBooleanArray(null);
+
+ assertNull(throughBytes(p).readSparseBooleanArray());
+ }
+
+ @Test
+ public void nullSparseIntArray() {
+ Parcel p = Parcel.obtain();
+ p.writeSparseIntArray(null);
+
+ assertNull(throughBytes(p).readSparseIntArray());
+ }
+
+ @Test
+ public void nullBooleanArray() {
+ Parcel p = Parcel.obtain();
+ p.writeBooleanArray(null);
+
+ assertNull(throughBytes(p).createBooleanArray());
+ }
+
+ @Test
+ public void nullCharArray() {
+ Parcel p = Parcel.obtain();
+ p.writeCharArray(null);
+
+ assertNull(throughBytes(p).createCharArray());
+ }
+
+ @Test
+ public void nullIntArray() {
+ Parcel p = Parcel.obtain();
+ p.writeIntArray(null);
+
+ assertNull(throughBytes(p).createIntArray());
+ }
+
+ @Test
+ public void nullLongArray() {
+ Parcel p = Parcel.obtain();
+ p.writeLongArray(null);
+
+ assertNull(throughBytes(p).createLongArray());
+ }
+
+ @Test
+ public void nullFloatArray() {
+ Parcel p = Parcel.obtain();
+ p.writeFloatArray(null);
+
+ assertNull(throughBytes(p).createFloatArray());
+ }
+
+ @Test
+ public void nullDoubleArray() {
+ Parcel p = Parcel.obtain();
+ p.writeDoubleArray(null);
+
+ assertNull(throughBytes(p).createDoubleArray());
+ }
+
+ @Test
+ public void nullStringArray() {
+ Parcel p = Parcel.obtain();
+ p.writeStringArray(null);
+
+ assertNull(throughBytes(p).createStringArray());
+ }
+
+ @Test
+ public void nullCharSequenceArray() {
+ Parcel p = Parcel.obtain();
+ p.writeCharSequenceArray(null);
+
+ assertNull(throughBytes(p).readCharSequenceArray());
+ }
+
+ @Test
+ public void nullCharSequenceList() {
+ Parcel p = Parcel.obtain();
+ p.writeCharSequenceList(null);
+
+ assertNull(throughBytes(p).readCharSequenceList());
+ }
+
+ @Test
+ public void nullBinderArray() {
+ Parcel p = Parcel.obtain();
+ p.writeBinderArray(null);
+
+ assertNull(throughBytes(p).createBinderArray());
+ }
+
+ @Test
+ public void nullTypedList() {
+ Parcel p = Parcel.obtain();
+ p.writeTypedList(null);
+
+ assertNull(throughBytes(p).createTypedArrayList(null));
+ }
+
+ @Test
+ public void nullStringList() {
+ Parcel p = Parcel.obtain();
+ p.writeStringList(null);
+
+ assertNull(throughBytes(p).createStringArrayList());
+ }
+
+ @Test
+ public void nullBinderList() {
+ Parcel p = Parcel.obtain();
+ p.writeBinderList(null);
+
+ assertNull(throughBytes(p).createBinderArrayList());
+ }
+
+ @Test
+ public void nullParcelableList() {
+ Parcel p = Parcel.obtain();
+ p.writeParcelableList(null, 0);
+
+ List<Object> list = new ArrayList<>();
+ throughBytes(p).readParcelableList(null, null);
+ assertTrue(list.isEmpty());
+ }
+
+ @Test
+ public void nullTypedArray() {
+ Parcel p = Parcel.obtain();
+ p.writeTypedArray(null, 0);
+
+ assertNull(throughBytes(p).createTypedArray(null));
+ }
+
+ @Test
+ public void nullTypedObject() {
+ Parcel p = Parcel.obtain();
+ p.writeTypedObject(null, 0);
+
+ assertNull(throughBytes(p).readTypedObject(null));
+ }
+
+ @Test
+ public void nullValue() {
+ Parcel p = Parcel.obtain();
+ p.writeValue(null);
+
+ assertNull(throughBytes(p).readValue(null));
+ }
+
+ @Test
+ public void nullParcelable() {
+ Parcel p = Parcel.obtain();
+ p.writeParcelable(null, 0);
+
+ assertNull(throughBytes(p).readParcelable(null));
+ }
+
+ @Test
+ public void nullSerializable() {
+ Parcel p = Parcel.obtain();
+ p.writeSerializable(null);
+
+ assertNull(throughBytes(p).readSerializable());
+ }
+
+ @Test
+ public void nullException() {
+ Parcel p = Parcel.obtain();
+ try {
+ p.writeException(null);
+ fail();
+ } catch (RuntimeException expected) {
+ }
+ }
+
+ private static Parcel throughBytes(Parcel p) {
+ byte[] bytes = p.marshall();
+ p = Parcel.obtain();
+ p.unmarshall(bytes, 0, bytes.length);
+ p.setDataPosition(0);
+ return p;
+ }
+}
diff --git a/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java b/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java
index ba61137..b7fef13 100644
--- a/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/BinderCallsStatsTest.java
@@ -35,7 +35,9 @@
@RunWith(AndroidJUnit4.class)
@Presubmit
public class BinderCallsStatsTest {
- public static final int TEST_UID = 1;
+ private static final int TEST_UID = 1;
+ private static final int REQUEST_SIZE = 2;
+ private static final int REPLY_SIZE = 3;
@Test
public void testDetailedOff() {
@@ -43,7 +45,7 @@
Binder binder = new Binder();
BinderCallsStats.CallSession callSession = bcs.callStarted(binder, 1);
bcs.time += 10;
- bcs.callEnded(callSession);
+ bcs.callEnded(callSession, REQUEST_SIZE, REPLY_SIZE);
SparseArray<BinderCallsStats.UidEntry> uidEntries = bcs.getUidEntries();
assertEquals(1, uidEntries.size());
@@ -66,7 +68,7 @@
callSession = bcs.callStarted(binder, 1);
bcs.time += 20;
- bcs.callEnded(callSession);
+ bcs.callEnded(callSession, REQUEST_SIZE, REPLY_SIZE);
uidEntry = bcs.getUidEntries().get(TEST_UID);
assertEquals(2, uidEntry.callCount);
@@ -79,7 +81,7 @@
callSession = bcs.callStarted(binder, 2);
bcs.time += 50;
- bcs.callEnded(callSession);
+ bcs.callEnded(callSession, REQUEST_SIZE, REPLY_SIZE);
uidEntry = bcs.getUidEntries().get(TEST_UID);
assertEquals(3, uidEntry.callCount);
@@ -95,7 +97,7 @@
Binder binder = new Binder();
BinderCallsStats.CallSession callSession = bcs.callStarted(binder, 1);
bcs.time += 10;
- bcs.callEnded(callSession);
+ bcs.callEnded(callSession, REQUEST_SIZE, REPLY_SIZE);
SparseArray<BinderCallsStats.UidEntry> uidEntries = bcs.getUidEntries();
assertEquals(1, uidEntries.size());
@@ -117,7 +119,7 @@
callSession = bcs.callStarted(binder, 1);
bcs.time += 20;
- bcs.callEnded(callSession);
+ bcs.callEnded(callSession, REQUEST_SIZE, REPLY_SIZE);
uidEntry = bcs.getUidEntries().get(TEST_UID);
assertEquals(2, uidEntry.callCount);
@@ -127,7 +129,7 @@
callSession = bcs.callStarted(binder, 2);
bcs.time += 50;
- bcs.callEnded(callSession);
+ bcs.callEnded(callSession, REQUEST_SIZE, REPLY_SIZE);
uidEntry = bcs.getUidEntries().get(TEST_UID);
assertEquals(3, uidEntry.callCount);
@@ -138,6 +140,21 @@
}
@Test
+ public void testParcelSize() {
+ TestBinderCallsStats bcs = new TestBinderCallsStats(true);
+ Binder binder = new Binder();
+ BinderCallsStats.CallSession callSession = bcs.callStarted(binder, 1);
+ bcs.time += 10;
+ bcs.callEnded(callSession, REQUEST_SIZE, REPLY_SIZE);
+
+ List<BinderCallsStats.CallStat> callStatsList =
+ bcs.getUidEntries().get(TEST_UID).getCallStatsList();
+
+ assertEquals(REQUEST_SIZE, callStatsList.get(0).maxRequestSizeBytes);
+ assertEquals(REPLY_SIZE, callStatsList.get(0).maxReplySizeBytes);
+ }
+
+ @Test
public void testGetHighestValues() {
List<Integer> list = Arrays.asList(1, 2, 3, 4);
List<Integer> highestValues = BinderCallsStats
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index 0ff958f..c6f8415 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -1229,6 +1229,7 @@
if (config == null) {
throw new IllegalArgumentException("Config must not be null");
}
+ source.endRecording();
if (source.requiresHardwareAcceleration() && config != Config.HARDWARE) {
StrictMode.noteSlowCall("GPU readback");
}
diff --git a/graphics/java/android/graphics/Picture.java b/graphics/java/android/graphics/Picture.java
index 7030628..f2d0227 100644
--- a/graphics/java/android/graphics/Picture.java
+++ b/graphics/java/android/graphics/Picture.java
@@ -123,6 +123,9 @@
* drawn to a hardware-accelerated canvas. If this returns true then this Picture can only
* be drawn to another Picture or to a Canvas where canvas.isHardwareAccelerated() is true.
*
+ * Note this value is only updated after recording has finished by a call to
+ * {@link #endRecording()}. Prior to that it will be the default value of false.
+ *
* @return true if the Picture can only be drawn to a hardware-accelerated canvas,
* false otherwise.
*/
diff --git a/keystore/java/android/security/keystore/KeyGenParameterSpec.java b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
index b2e0f67..452024c 100644
--- a/keystore/java/android/security/keystore/KeyGenParameterSpec.java
+++ b/keystore/java/android/security/keystore/KeyGenParameterSpec.java
@@ -1132,7 +1132,7 @@
* <p>This authorization applies only to secret key and private key operations. Public key
* operations are not restricted.
*
- * @see {@link android.security.ConfirmationPrompter ConfirmationPrompter} class for
+ * See {@link android.security.ConfirmationPrompt} class for
* more details about user confirmations.
*/
@NonNull
diff --git a/keystore/java/android/security/keystore/KeyProtection.java b/keystore/java/android/security/keystore/KeyProtection.java
index 081042b..3357fdf 100644
--- a/keystore/java/android/security/keystore/KeyProtection.java
+++ b/keystore/java/android/security/keystore/KeyProtection.java
@@ -806,7 +806,7 @@
* <p>This authorization applies only to secret key and private key operations. Public key
* operations are not restricted.
*
- * @see {@link android.security.ConfirmationPrompter ConfirmationPrompter} class for
+ * See {@link android.security.ConfirmationPrompt} class for
* more details about user confirmations.
*/
@NonNull
diff --git a/media/java/android/media/MediaCodecList.java b/media/java/android/media/MediaCodecList.java
index a442fe3..2e47865 100644
--- a/media/java/android/media/MediaCodecList.java
+++ b/media/java/android/media/MediaCodecList.java
@@ -225,7 +225,7 @@
* <code class=prettyprint>format.setString(MediaFormat.KEY_FRAME_RATE, null)</code>
* to clear any existing frame rate setting in the format.
*
- * @see MediaCodecInfo.CodecCapabilities.isFormatSupported(MediaFormat) for format keys
+ * @see MediaCodecInfo.CodecCapabilities#isFormatSupported(MediaFormat) for format keys
* considered per android versions when evaluating suitable codecs.
*
* @param format An encoder media format with optional feature directives.
diff --git a/media/java/android/media/SyncParams.java b/media/java/android/media/SyncParams.java
index c56b140..5d1575a 100644
--- a/media/java/android/media/SyncParams.java
+++ b/media/java/android/media/SyncParams.java
@@ -86,7 +86,7 @@
/**
* Use audio track for sync source. This requires audio data and an audio track.
*
- * @see android.media.AudioTrack#getTimeStamp(android.media.AudioTimestamp)
+ * @see android.media.AudioTrack#getTimestamp(android.media.AudioTimestamp)
*/
public static final int SYNC_SOURCE_AUDIO = 2;
@@ -137,9 +137,6 @@
* This will make audio play faster or slower as required by the sync source
* without changing its pitch, as long as it is supported for the playback
* rate.
- *
- * @see MediaSync#PLAYBACK_RATE_AUDIO_MODE_STRETCH
- * @see MediaPlayer#PLAYBACK_RATE_AUDIO_MODE_STRETCH
*/
public static final int AUDIO_ADJUST_MODE_STRETCH = 1;
@@ -149,9 +146,6 @@
* This will make audio play faster or slower as required by the sync source
* by changing its pitch (making it lower to play slower, and higher to play
* faster.)
- *
- * @see MediaSync#PLAYBACK_RATE_AUDIO_MODE_RESAMPLE
- * @see MediaPlayer#PLAYBACK_RATE_AUDIO_MODE_RESAMPLE
*/
public static final int AUDIO_ADJUST_MODE_RESAMPLE = 2;
diff --git a/media/lib/tvremote/Android.bp b/media/lib/tvremote/Android.bp
new file mode 100644
index 0000000..5f101a3
--- /dev/null
+++ b/media/lib/tvremote/Android.bp
@@ -0,0 +1,24 @@
+//
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+java_sdk_library {
+ name: "com.android.media.tv.remoteprovider",
+ srcs: ["java/**/*.java"],
+ api_packages: ["com.android.media.tv.remoteprovider"],
+ dex_preopt: {
+ enabled: false,
+ }
+}
diff --git a/media/lib/tvremote/Android.mk b/media/lib/tvremote/Android.mk
deleted file mode 100644
index 1ffdd62..0000000
--- a/media/lib/tvremote/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Copyright (C) 2016 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.
-#
-LOCAL_PATH := $(call my-dir)
-
-# the tvremoteprovider library
-# ============================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= com.android.media.tv.remoteprovider
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, java)
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_JAVA_LIBRARY)
-
-
-# ==== com.android.media.tvremote.xml lib def ========================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := com.android.media.tv.remoteprovider.xml
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_CLASS := ETC
-
-# This will install the file in /system/etc/permissions
-#
-LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
-
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-include $(BUILD_PREBUILT)
diff --git a/media/lib/tvremote/api/current.txt b/media/lib/tvremote/api/current.txt
new file mode 100644
index 0000000..eea9e9c
--- /dev/null
+++ b/media/lib/tvremote/api/current.txt
@@ -0,0 +1,21 @@
+package com.android.media.tv.remoteprovider {
+
+ public abstract class TvRemoteProvider {
+ ctor public TvRemoteProvider(android.content.Context);
+ method public void clearInputBridge(android.os.IBinder) throws java.lang.RuntimeException;
+ method public void closeInputBridge(android.os.IBinder) throws java.lang.RuntimeException;
+ method public android.os.IBinder getBinder();
+ method public final android.content.Context getContext();
+ method public void onInputBridgeConnected(android.os.IBinder);
+ method public void openRemoteInputBridge(android.os.IBinder, java.lang.String, int, int, int) throws java.lang.RuntimeException;
+ method public void sendKeyDown(android.os.IBinder, int) throws java.lang.RuntimeException;
+ method public void sendKeyUp(android.os.IBinder, int) throws java.lang.RuntimeException;
+ method public void sendPointerDown(android.os.IBinder, int, int, int) throws java.lang.RuntimeException;
+ method public void sendPointerSync(android.os.IBinder) throws java.lang.RuntimeException;
+ method public void sendPointerUp(android.os.IBinder, int) throws java.lang.RuntimeException;
+ method public void sendTimestamp(android.os.IBinder, long) throws java.lang.RuntimeException;
+ field public static final java.lang.String SERVICE_INTERFACE = "com.android.media.tv.remoteprovider.TvRemoteProvider";
+ }
+
+}
+
diff --git a/media/lib/tvremote/api/removed.txt b/media/lib/tvremote/api/removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/media/lib/tvremote/api/removed.txt
diff --git a/media/lib/tvremote/api/system-current.txt b/media/lib/tvremote/api/system-current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/media/lib/tvremote/api/system-current.txt
diff --git a/media/lib/tvremote/api/system-removed.txt b/media/lib/tvremote/api/system-removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/media/lib/tvremote/api/system-removed.txt
diff --git a/media/lib/tvremote/api/test-current.txt b/media/lib/tvremote/api/test-current.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/media/lib/tvremote/api/test-current.txt
diff --git a/media/lib/tvremote/api/test-removed.txt b/media/lib/tvremote/api/test-removed.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/media/lib/tvremote/api/test-removed.txt
diff --git a/media/lib/tvremote/com.android.media.tv.remoteprovider.xml b/media/lib/tvremote/com.android.media.tv.remoteprovider.xml
deleted file mode 100644
index dcf479a..0000000
--- a/media/lib/tvremote/com.android.media.tv.remoteprovider.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-
-<permissions>
- <library name="com.android.media.tv.remoteprovider"
- file="/system/framework/com.android.media.tv.remoteprovider.jar" />
-</permissions>
\ No newline at end of file
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 5c0d5dd..3b1872a 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -499,4 +499,7 @@
<!-- On debuggable builds, alert the user if SystemUI PSS goes over this number (in kb) -->
<integer name="watch_heap_limit">256000</integer>
+
+ <!-- Allow dragging the PIP to a location to close it -->
+ <bool name="config_pipEnableDismissDragToEdge">true</bool>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
index 1805f96..02345c9 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
@@ -66,8 +66,7 @@
private static final int SHOW_DISMISS_AFFORDANCE_DELAY = 225;
// Allow dragging the PIP to a location to close it
- private static final boolean ENABLE_DISMISS_DRAG_TO_EDGE = true;
-
+ private final boolean mEnableDimissDragToEdge;
private final Context mContext;
private final IActivityManager mActivityManager;
private final ViewConfiguration mViewConfig;
@@ -101,7 +100,7 @@
private Runnable mShowDismissAffordance = new Runnable() {
@Override
public void run() {
- if (ENABLE_DISMISS_DRAG_TO_EDGE) {
+ if (mEnableDimissDragToEdge) {
mDismissViewController.showDismissTarget();
}
}
@@ -200,6 +199,8 @@
R.dimen.pip_expanded_shortest_edge_size);
mImeOffset = res.getDimensionPixelSize(R.dimen.pip_ime_offset);
+ mEnableDimissDragToEdge = res.getBoolean(R.bool.config_pipEnableDismissDragToEdge);
+
// Register the listener for input consumer touch events
inputConsumerController.setTouchListener(this::handleTouchEvent);
inputConsumerController.setRegistrationListener(this::onRegistrationChanged);
@@ -598,7 +599,7 @@
mMenuController.pokeMenu();
}
- if (ENABLE_DISMISS_DRAG_TO_EDGE) {
+ if (mEnableDimissDragToEdge) {
mDismissViewController.createDismissTarget();
mHandler.postDelayed(mShowDismissAffordance, SHOW_DISMISS_AFFORDANCE_DELAY);
}
@@ -613,7 +614,7 @@
if (touchState.startedDragging()) {
mSavedSnapFraction = -1f;
- if (ENABLE_DISMISS_DRAG_TO_EDGE) {
+ if (mEnableDimissDragToEdge) {
mHandler.removeCallbacks(mShowDismissAffordance);
mDismissViewController.showDismissTarget();
}
@@ -629,7 +630,7 @@
if (!touchState.allowDraggingOffscreen() || !ENABLE_MINIMIZE) {
left = Math.max(mMovementBounds.left, Math.min(mMovementBounds.right, left));
}
- if (ENABLE_DISMISS_DRAG_TO_EDGE) {
+ if (mEnableDimissDragToEdge) {
// Allow pip to move past bottom bounds
top = Math.max(mMovementBounds.top, top);
} else {
@@ -644,7 +645,7 @@
mTmpBounds.offsetTo((int) left, (int) top);
mMotionHelper.movePip(mTmpBounds);
- if (ENABLE_DISMISS_DRAG_TO_EDGE) {
+ if (mEnableDimissDragToEdge) {
updateDismissFraction();
}
@@ -666,7 +667,7 @@
@Override
public boolean onUp(PipTouchState touchState) {
- if (ENABLE_DISMISS_DRAG_TO_EDGE) {
+ if (mEnableDimissDragToEdge) {
// Clean up the dismiss target regardless of the touch state in case the touch
// enabled state changes while the user is interacting
cleanUpDismissTarget();
@@ -686,7 +687,7 @@
vel.y, isFling);
final boolean isFlingToBot = isFling && vel.y > 0 && !isHorizontal
&& (mMovementWithinDismiss || isUpWithinDimiss);
- if (ENABLE_DISMISS_DRAG_TO_EDGE) {
+ if (mEnableDimissDragToEdge) {
// Check if the user dragged or flung the PiP offscreen to dismiss it
if (mMotionHelper.shouldDismissPip() || isFlingToBot) {
MetricsLoggerWrapper.logPictureInPictureDismissByDrag(mContext,
@@ -830,7 +831,7 @@
pw.println(innerPrefix + "mIsShelfShowing=" + mIsShelfShowing);
pw.println(innerPrefix + "mShelfHeight=" + mShelfHeight);
pw.println(innerPrefix + "mSavedSnapFraction=" + mSavedSnapFraction);
- pw.println(innerPrefix + "mEnableDragToEdgeDismiss=" + ENABLE_DISMISS_DRAG_TO_EDGE);
+ pw.println(innerPrefix + "mEnableDragToEdgeDismiss=" + mEnableDimissDragToEdge);
pw.println(innerPrefix + "mEnableMinimize=" + ENABLE_MINIMIZE);
mSnapAlgorithm.dump(pw, innerPrefix);
mTouchState.dump(pw, innerPrefix);
diff --git a/services/core/java/com/android/server/power/Notifier.java b/services/core/java/com/android/server/power/Notifier.java
index eecf17a..d445611 100644
--- a/services/core/java/com/android/server/power/Notifier.java
+++ b/services/core/java/com/android/server/power/Notifier.java
@@ -47,6 +47,7 @@
import android.provider.Settings;
import android.util.EventLog;
import android.util.Slog;
+import android.util.StatsLog;
import android.view.inputmethod.InputMethodManagerInternal;
import com.android.internal.app.IBatteryStats;
@@ -231,8 +232,13 @@
try {
if (workSource != null) {
mBatteryStats.noteLongPartialWakelockStartFromSource(tag, historyTag, workSource);
+ StatsLog.write(StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED, workSource,
+ tag, historyTag, StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED__STATE__ON);
} else {
mBatteryStats.noteLongPartialWakelockStart(tag, historyTag, ownerUid);
+ StatsLog.write_non_chained(StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED,
+ ownerUid, null, tag, historyTag,
+ StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED__STATE__ON);
}
} catch (RemoteException ex) {
// Ignore
@@ -249,8 +255,13 @@
try {
if (workSource != null) {
mBatteryStats.noteLongPartialWakelockFinishFromSource(tag, historyTag, workSource);
+ StatsLog.write(StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED, workSource,
+ tag, historyTag, StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED__STATE__OFF);
} else {
mBatteryStats.noteLongPartialWakelockFinish(tag, historyTag, ownerUid);
+ StatsLog.write_non_chained(StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED,
+ ownerUid, null, tag, historyTag,
+ StatsLog.LONG_PARTIAL_WAKELOCK_STATE_CHANGED__STATE__OFF);
}
} catch (RemoteException ex) {
// Ignore
diff --git a/services/net/java/android/net/ip/IpClient.java b/services/net/java/android/net/ip/IpClient.java
index 63ae09a..7f821ff 100644
--- a/services/net/java/android/net/ip/IpClient.java
+++ b/services/net/java/android/net/ip/IpClient.java
@@ -231,10 +231,10 @@
// TODO: Find an lighter weight approach.
private class LoggingCallbackWrapper extends Callback {
private static final String PREFIX = "INVOKE ";
- private Callback mCallback;
+ private final Callback mCallback;
public LoggingCallbackWrapper(Callback callback) {
- mCallback = callback;
+ mCallback = (callback != null) ? callback : new Callback();
}
private void log(String msg) {
@@ -605,6 +605,13 @@
private static final int EVENT_DHCPACTION_TIMEOUT = 11;
private static final int EVENT_READ_PACKET_FILTER_COMPLETE = 12;
+ // Internal commands to use instead of trying to call transitionTo() inside
+ // a given State's enter() method. Calling transitionTo() from enter/exit
+ // encounters a Log.wtf() that can cause trouble on eng builds.
+ private static final int CMD_JUMP_STARTED_TO_RUNNING = 100;
+ private static final int CMD_JUMP_RUNNING_TO_STOPPING = 101;
+ private static final int CMD_JUMP_STOPPING_TO_STOPPED = 102;
+
private static final int MAX_LOG_RECORDS = 500;
private static final int MAX_PACKET_RECORDS = 100;
@@ -1418,6 +1425,9 @@
resetLinkProperties();
if (mStartTimeMillis > 0) {
+ // Completed a life-cycle; send a final empty LinkProperties
+ // (cleared in resetLinkProperties() above) and record an event.
+ mCallback.onLinkPropertiesChange(new LinkProperties(mLinkProperties));
recordMetric(IpManagerEvent.COMPLETE_LIFECYCLE);
mStartTimeMillis = 0;
}
@@ -1476,13 +1486,17 @@
public void enter() {
if (mDhcpClient == null) {
// There's no DHCPv4 for which to wait; proceed to stopped.
- transitionTo(mStoppedState);
+ deferMessage(obtainMessage(CMD_JUMP_STOPPING_TO_STOPPED));
}
}
@Override
public boolean processMessage(Message msg) {
switch (msg.what) {
+ case CMD_JUMP_STOPPING_TO_STOPPED:
+ transitionTo(mStoppedState);
+ break;
+
case CMD_STOP:
break;
@@ -1516,7 +1530,7 @@
}
if (readyToProceed()) {
- transitionTo(mRunningState);
+ deferMessage(obtainMessage(CMD_JUMP_STARTED_TO_RUNNING));
} else {
// Clear all IPv4 and IPv6 before proceeding to RunningState.
// Clean up any leftover state from an abnormal exit from
@@ -1533,6 +1547,10 @@
@Override
public boolean processMessage(Message msg) {
switch (msg.what) {
+ case CMD_JUMP_STARTED_TO_RUNNING:
+ transitionTo(mRunningState);
+ break;
+
case CMD_STOP:
transitionTo(mStoppingState);
break;
@@ -1561,7 +1579,7 @@
return HANDLED;
}
- boolean readyToProceed() {
+ private boolean readyToProceed() {
return (!mLinkProperties.hasIPv4Address() &&
!mLinkProperties.hasGlobalIPv6Address());
}
@@ -1593,13 +1611,13 @@
if (mConfiguration.mEnableIPv6 && !startIPv6()) {
doImmediateProvisioningFailure(IpManagerEvent.ERROR_STARTING_IPV6);
- transitionTo(mStoppingState);
+ enqueueJumpToStoppingState();
return;
}
if (mConfiguration.mEnableIPv4 && !startIPv4()) {
doImmediateProvisioningFailure(IpManagerEvent.ERROR_STARTING_IPV4);
- transitionTo(mStoppingState);
+ enqueueJumpToStoppingState();
return;
}
@@ -1607,7 +1625,7 @@
if ((config != null) && !applyInitialConfig(config)) {
// TODO introduce a new IpManagerEvent constant to distinguish this error case.
doImmediateProvisioningFailure(IpManagerEvent.ERROR_INVALID_PROVISIONING);
- transitionTo(mStoppingState);
+ enqueueJumpToStoppingState();
return;
}
@@ -1621,7 +1639,7 @@
if (mConfiguration.mUsingIpReachabilityMonitor && !startIpReachabilityMonitor()) {
doImmediateProvisioningFailure(
IpManagerEvent.ERROR_STARTING_IPREACHABILITYMONITOR);
- transitionTo(mStoppingState);
+ enqueueJumpToStoppingState();
return;
}
}
@@ -1658,6 +1676,10 @@
resetLinkProperties();
}
+ private void enqueueJumpToStoppingState() {
+ deferMessage(obtainMessage(CMD_JUMP_RUNNING_TO_STOPPING));
+ }
+
private ConnectivityPacketTracker createPacketTracker() {
try {
return new ConnectivityPacketTracker(
@@ -1688,6 +1710,7 @@
@Override
public boolean processMessage(Message msg) {
switch (msg.what) {
+ case CMD_JUMP_RUNNING_TO_STOPPING:
case CMD_STOP:
transitionTo(mStoppingState);
break;
diff --git a/services/usb/java/com/android/server/usb/UsbProfileGroupSettingsManager.java b/services/usb/java/com/android/server/usb/UsbProfileGroupSettingsManager.java
index 43f189b..7a906d0 100644
--- a/services/usb/java/com/android/server/usb/UsbProfileGroupSettingsManager.java
+++ b/services/usb/java/com/android/server/usb/UsbProfileGroupSettingsManager.java
@@ -445,38 +445,38 @@
});
}
- // Checks to see if a package matches a device or accessory.
- // Only one of device and accessory should be non-null.
- private boolean packageMatchesLocked(ResolveInfo info, String metaDataName,
- UsbDevice device, UsbAccessory accessory) {
- if (isForwardMatch(info)) {
- return true;
- }
-
+ /**
+ * Get {@link DeviceFilter} for all devices an activity should be launched for.
+ *
+ * @param pm The package manager used to get the device filter files
+ * @param info The {@link ResolveInfo} for the activity that can handle usb device attached
+ * events
+ *
+ * @return The list of {@link DeviceFilter} the activity should be called for or {@code null} if
+ * none
+ */
+ @Nullable
+ static ArrayList<DeviceFilter> getDeviceFilters(@NonNull PackageManager pm,
+ @NonNull ResolveInfo info) {
+ ArrayList<DeviceFilter> filters = null;
ActivityInfo ai = info.activityInfo;
XmlResourceParser parser = null;
try {
- parser = ai.loadXmlMetaData(mPackageManager, metaDataName);
+ parser = ai.loadXmlMetaData(pm, UsbManager.ACTION_USB_DEVICE_ATTACHED);
if (parser == null) {
Slog.w(TAG, "no meta-data for " + info);
- return false;
+ return null;
}
XmlUtils.nextElement(parser);
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
String tagName = parser.getName();
- if (device != null && "usb-device".equals(tagName)) {
- DeviceFilter filter = DeviceFilter.read(parser);
- if (filter.matches(device)) {
- return true;
+ if ("usb-device".equals(tagName)) {
+ if (filters == null) {
+ filters = new ArrayList<>(1);
}
- }
- else if (accessory != null && "usb-accessory".equals(tagName)) {
- AccessoryFilter filter = AccessoryFilter.read(parser);
- if (filter.matches(accessory)) {
- return true;
- }
+ filters.add(DeviceFilter.read(parser));
}
XmlUtils.nextElement(parser);
}
@@ -485,6 +485,84 @@
} finally {
if (parser != null) parser.close();
}
+ return filters;
+ }
+
+ /**
+ * Get {@link AccessoryFilter} for all accessories an activity should be launched for.
+ *
+ * @param pm The package manager used to get the accessory filter files
+ * @param info The {@link ResolveInfo} for the activity that can handle usb accessory attached
+ * events
+ *
+ * @return The list of {@link AccessoryFilter} the activity should be called for or {@code null}
+ * if none
+ */
+ static @Nullable ArrayList<AccessoryFilter> getAccessoryFilters(@NonNull PackageManager pm,
+ @NonNull ResolveInfo info) {
+ ArrayList<AccessoryFilter> filters = null;
+ ActivityInfo ai = info.activityInfo;
+
+ XmlResourceParser parser = null;
+ try {
+ parser = ai.loadXmlMetaData(pm, UsbManager.ACTION_USB_ACCESSORY_ATTACHED);
+ if (parser == null) {
+ Slog.w(TAG, "no meta-data for " + info);
+ return null;
+ }
+
+ XmlUtils.nextElement(parser);
+ while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
+ String tagName = parser.getName();
+ if ("usb-accessory".equals(tagName)) {
+ if (filters == null) {
+ filters = new ArrayList<>(1);
+ }
+ filters.add(AccessoryFilter.read(parser));
+ }
+ XmlUtils.nextElement(parser);
+ }
+ } catch (Exception e) {
+ Slog.w(TAG, "Unable to load component info " + info.toString(), e);
+ } finally {
+ if (parser != null) parser.close();
+ }
+ return filters;
+ }
+
+ // Checks to see if a package matches a device or accessory.
+ // Only one of device and accessory should be non-null.
+ private boolean packageMatchesLocked(ResolveInfo info, UsbDevice device,
+ UsbAccessory accessory) {
+ if (isForwardMatch(info)) {
+ return true;
+ }
+
+ if (device != null) {
+ ArrayList<DeviceFilter> deviceFilters = getDeviceFilters(mPackageManager, info);
+ if (deviceFilters != null) {
+ int numDeviceFilters = deviceFilters.size();
+ for (int i = 0; i < numDeviceFilters; i++) {
+ if (deviceFilters.get(i).matches(device)) {
+ return true;
+ }
+ }
+ }
+ }
+
+ if (accessory != null) {
+ ArrayList<AccessoryFilter> accessoryFilters = getAccessoryFilters(mPackageManager,
+ info);
+ if (accessoryFilters != null) {
+ int numAccessoryFilters = accessoryFilters.size();
+ for (int i = 0; i < numAccessoryFilters; i++) {
+ if (accessoryFilters.get(i).matches(accessory)) {
+ return true;
+ }
+ }
+ }
+ }
+
return false;
}
@@ -502,8 +580,8 @@
ArrayList<ResolveInfo> resolveInfos = new ArrayList<>();
int numProfiles = profiles.size();
for (int i = 0; i < numProfiles; i++) {
- resolveInfos.addAll(mPackageManager.queryIntentActivitiesAsUser(intent,
- PackageManager.GET_META_DATA, profiles.get(i).id));
+ resolveInfos.addAll(mSettingsManager.getSettingsForUser(profiles.get(i).id)
+ .queryIntentActivities(intent));
}
return resolveInfos;
@@ -629,7 +707,7 @@
int count = resolveInfos.size();
for (int i = 0; i < count; i++) {
ResolveInfo resolveInfo = resolveInfos.get(i);
- if (packageMatchesLocked(resolveInfo, intent.getAction(), device, null)) {
+ if (packageMatchesLocked(resolveInfo, device, null)) {
matches.add(resolveInfo);
}
}
@@ -644,7 +722,7 @@
int count = resolveInfos.size();
for (int i = 0; i < count; i++) {
ResolveInfo resolveInfo = resolveInfos.get(i);
- if (packageMatchesLocked(resolveInfo, intent.getAction(), null, accessory)) {
+ if (packageMatchesLocked(resolveInfo, null, accessory)) {
matches.add(resolveInfo);
}
}
diff --git a/services/usb/java/com/android/server/usb/UsbSettingsManager.java b/services/usb/java/com/android/server/usb/UsbSettingsManager.java
index caf05a3..9221825 100644
--- a/services/usb/java/com/android/server/usb/UsbSettingsManager.java
+++ b/services/usb/java/com/android/server/usb/UsbSettingsManager.java
@@ -33,6 +33,8 @@
import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.dump.DualDumpOutputStream;
+import java.util.List;
+
/**
* Maintains all {@link UsbUserSettingsManager} for all users.
*/
@@ -140,9 +142,10 @@
long token = dump.start(idName, id);
synchronized (mSettingsByUser) {
- int numUsers = mSettingsByUser.size();
+ List<UserInfo> users = mUserManager.getUsers();
+ int numUsers = users.size();
for (int i = 0; i < numUsers; i++) {
- mSettingsByUser.valueAt(i).dump(dump, "user_settings",
+ getSettingsForUser(users.get(i).id).dump(dump, "user_settings",
UsbSettingsManagerProto.USER_SETTINGS);
}
}
diff --git a/services/usb/java/com/android/server/usb/UsbUserSettingsManager.java b/services/usb/java/com/android/server/usb/UsbUserSettingsManager.java
index 8409506..24a2d72 100644
--- a/services/usb/java/com/android/server/usb/UsbUserSettingsManager.java
+++ b/services/usb/java/com/android/server/usb/UsbUserSettingsManager.java
@@ -16,14 +16,22 @@
package com.android.server.usb;
+import static com.android.internal.util.dump.DumpUtils.writeComponentName;
+import static com.android.server.usb.UsbProfileGroupSettingsManager.getAccessoryFilters;
+import static com.android.server.usb.UsbProfileGroupSettingsManager.getDeviceFilters;
+
import android.annotation.NonNull;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
+import android.hardware.usb.AccessoryFilter;
+import android.hardware.usb.DeviceFilter;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbConstants;
import android.hardware.usb.UsbDevice;
@@ -32,6 +40,8 @@
import android.os.Binder;
import android.os.Process;
import android.os.UserHandle;
+import android.service.usb.UsbAccessoryAttachedActivities;
+import android.service.usb.UsbDeviceAttachedActivities;
import android.service.usb.UsbSettingsAccessoryPermissionProto;
import android.service.usb.UsbSettingsDevicePermissionProto;
import android.service.usb.UsbUserSettingsManagerProto;
@@ -40,7 +50,9 @@
import com.android.internal.util.dump.DualDumpOutputStream;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
class UsbUserSettingsManager {
private static final String TAG = "UsbUserSettingsManager";
@@ -305,6 +317,18 @@
}
}
+ /**
+ * Get all activities that can handle the device/accessory attached intent.
+ *
+ * @param intent The intent to handle
+ *
+ * @return The resolve infos of the activities that can handle the intent
+ */
+ List<ResolveInfo> queryIntentActivities(@NonNull Intent intent) {
+ return mPackageManager.queryIntentActivitiesAsUser(intent, PackageManager.GET_META_DATA,
+ mUser.getIdentifier());
+ }
+
public void dump(@NonNull DualDumpOutputStream dump, @NonNull String idName, long id) {
long token = dump.start(idName, id);
@@ -341,6 +365,59 @@
dump.end(accessoryPermissionToken);
}
+
+ List<ResolveInfo> deviceAttachedActivities = queryIntentActivities(
+ new Intent(UsbManager.ACTION_USB_DEVICE_ATTACHED));
+ int numDeviceAttachedActivities = deviceAttachedActivities.size();
+ for (int activityNum = 0; activityNum < numDeviceAttachedActivities; activityNum++) {
+ ResolveInfo deviceAttachedActivity = deviceAttachedActivities.get(activityNum);
+
+ long deviceAttachedActivityToken = dump.start("device_attached_activities",
+ UsbUserSettingsManagerProto.DEVICE_ATTACHED_ACTIVITIES);
+
+ writeComponentName(dump, "activity", UsbDeviceAttachedActivities.ACTIVITY,
+ new ComponentName(deviceAttachedActivity.activityInfo.packageName,
+ deviceAttachedActivity.activityInfo.name));
+
+ ArrayList<DeviceFilter> deviceFilters = getDeviceFilters(mPackageManager,
+ deviceAttachedActivity);
+ if (deviceFilters != null) {
+ int numDeviceFilters = deviceFilters.size();
+ for (int filterNum = 0; filterNum < numDeviceFilters; filterNum++) {
+ deviceFilters.get(filterNum).dump(dump, "filters",
+ UsbDeviceAttachedActivities.FILTERS);
+ }
+ }
+
+ dump.end(deviceAttachedActivityToken);
+ }
+
+ List<ResolveInfo> accessoryAttachedActivities =
+ queryIntentActivities(new Intent(UsbManager.ACTION_USB_ACCESSORY_ATTACHED));
+ int numAccessoryAttachedActivities = accessoryAttachedActivities.size();
+ for (int activityNum = 0; activityNum < numAccessoryAttachedActivities; activityNum++) {
+ ResolveInfo accessoryAttachedActivity =
+ accessoryAttachedActivities.get(activityNum);
+
+ long accessoryAttachedActivityToken = dump.start("accessory_attached_activities",
+ UsbUserSettingsManagerProto.ACCESSORY_ATTACHED_ACTIVITIES);
+
+ writeComponentName(dump, "activity", UsbAccessoryAttachedActivities.ACTIVITY,
+ new ComponentName(accessoryAttachedActivity.activityInfo.packageName,
+ accessoryAttachedActivity.activityInfo.name));
+
+ ArrayList<AccessoryFilter> accessoryFilters = getAccessoryFilters(mPackageManager,
+ accessoryAttachedActivity);
+ if (accessoryFilters != null) {
+ int numAccessoryFilters = accessoryFilters.size();
+ for (int filterNum = 0; filterNum < numAccessoryFilters; filterNum++) {
+ accessoryFilters.get(filterNum).dump(dump, "filters",
+ UsbAccessoryAttachedActivities.FILTERS);
+ }
+ }
+
+ dump.end(accessoryAttachedActivityToken);
+ }
}
dump.end(token);
diff --git a/tests/net/java/android/net/ip/IpClientTest.java b/tests/net/java/android/net/ip/IpClientTest.java
index e9e880d..89453e0 100644
--- a/tests/net/java/android/net/ip/IpClientTest.java
+++ b/tests/net/java/android/net/ip/IpClientTest.java
@@ -133,9 +133,18 @@
verify(mNMService, times(1)).registerObserver(arg.capture());
mObserver = arg.getValue();
reset(mNMService);
+ // Verify IpClient doesn't call onLinkPropertiesChange() when it starts.
+ verify(mCb, never()).onLinkPropertiesChange(any());
+ reset(mCb);
return ipc;
}
+ private static LinkProperties makeEmptyLinkProperties(String iface) {
+ final LinkProperties empty = new LinkProperties();
+ empty.setInterfaceName(iface);
+ return empty;
+ }
+
@Test
public void testNullInterfaceNameMostDefinitelyThrows() throws Exception {
setTestInterfaceParams(null);
@@ -197,6 +206,8 @@
ipc.shutdown();
verify(mNMService, timeout(100).times(1)).disableIpv6(iface);
verify(mNMService, timeout(100).times(1)).clearInterfaceAddresses(iface);
+ verify(mCb, timeout(100).times(1))
+ .onLinkPropertiesChange(eq(makeEmptyLinkProperties(iface)));
}
@Test
@@ -246,6 +257,8 @@
ipc.shutdown();
verify(mNMService, timeout(100).times(1)).disableIpv6(iface);
verify(mNMService, timeout(100).times(1)).clearInterfaceAddresses(iface);
+ verify(mCb, timeout(100).times(1))
+ .onLinkPropertiesChange(eq(makeEmptyLinkProperties(iface)));
}
@Test
diff --git a/tools/stats_log_api_gen/main.cpp b/tools/stats_log_api_gen/main.cpp
index 638549d..a6de2ab 100644
--- a/tools/stats_log_api_gen/main.cpp
+++ b/tools/stats_log_api_gen/main.cpp
@@ -656,6 +656,75 @@
}
}
+static void write_java_work_source_method(FILE* out, const set<vector<java_type_t>>& signatures) {
+ fprintf(out, "\n // WorkSource methods.\n");
+ for (set<vector<java_type_t>>::const_iterator signature = signatures.begin();
+ signature != signatures.end(); signature++) {
+ // Determine if there is Attribution in this signature.
+ int attributionArg = -1;
+ int argIndexMax = 0;
+ for (vector<java_type_t>::const_iterator arg = signature->begin();
+ arg != signature->end(); arg++) {
+ argIndexMax++;
+ if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) {
+ if (attributionArg > -1) {
+ fprintf(stderr, "An atom contains multiple AttributionNode fields.\n");
+ fprintf(stderr, "This is not supported. Aborting WorkSource method writing.\n");
+ fprintf(out, "\n// Invalid for WorkSource: more than one attribution chain.\n");
+ return;
+ }
+ attributionArg = argIndexMax;
+ }
+ }
+ if (attributionArg < 0) {
+ continue;
+ }
+
+ // Method header (signature)
+ fprintf(out, " public static void write(int code");
+ int argIndex = 1;
+ for (vector<java_type_t>::const_iterator arg = signature->begin();
+ arg != signature->end(); arg++) {
+ if (*arg == JAVA_TYPE_ATTRIBUTION_CHAIN) {
+ fprintf(out, ", WorkSource ws");
+ } else {
+ fprintf(out, ", %s arg%d", java_type_name(*arg), argIndex);
+ }
+ argIndex++;
+ }
+ fprintf(out, ") {\n");
+
+ // write_non_chained() component. TODO: Remove when flat uids are no longer needed.
+ fprintf(out, " for (int i = 0; i < ws.size(); ++i) {\n");
+ fprintf(out, " write_non_chained(code");
+ for (int argIndex = 1; argIndex <= argIndexMax; argIndex++) {
+ if (argIndex == attributionArg) {
+ fprintf(out, ", ws.get(i), ws.getName(i)");
+ } else {
+ fprintf(out, ", arg%d", argIndex);
+ }
+ }
+ fprintf(out, ");\n");
+ fprintf(out, " }\n"); // close flor-loop
+
+ // write() component.
+ fprintf(out, " ArrayList<WorkSource.WorkChain> workChains = ws.getWorkChains();\n");
+ fprintf(out, " if (workChains != null) {\n");
+ fprintf(out, " for (WorkSource.WorkChain wc : workChains) {\n");
+ fprintf(out, " write(code");
+ for (int argIndex = 1; argIndex <= argIndexMax; argIndex++) {
+ if (argIndex == attributionArg) {
+ fprintf(out, ", wc.getUids(), wc.getTags()");
+ } else {
+ fprintf(out, ", arg%d", argIndex);
+ }
+ }
+ fprintf(out, ");\n");
+ fprintf(out, " }\n"); // close for-loop
+ fprintf(out, " }\n"); // close if
+ fprintf(out, " }\n"); // close method
+ }
+}
static int
write_stats_log_java(FILE* out, const Atoms& atoms, const AtomDecl &attributionDecl)
@@ -665,6 +734,9 @@
fprintf(out, "\n");
fprintf(out, "package android.util;\n");
fprintf(out, "\n");
+ fprintf(out, "import android.os.WorkSource;\n");
+ fprintf(out, "import java.util.ArrayList;\n");
+ fprintf(out, "\n");
fprintf(out, "\n");
fprintf(out, "/**\n");
fprintf(out, " * API For logging statistics events.\n");
@@ -720,6 +792,7 @@
fprintf(out, " // Write methods\n");
write_java_method(out, "write", atoms.signatures, attributionDecl);
write_java_method(out, "write_non_chained", atoms.non_chained_signatures, attributionDecl);
+ write_java_work_source_method(out, atoms.signatures);
fprintf(out, "}\n");