summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordwchen <dwchen@google.com>2018-08-20 10:17:48 -0700
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-09-10 23:19:49 +0000
commit181dc252ddec574464882970d3fab290e8b625b5 (patch)
tree176a89d77e3a33b2e5d125b82a3122f401dc5b89
parent706f708d34d6aaa6f954b4eeffc126da61d0eae3 (diff)
downloadbase-181dc252ddec574464882970d3fab290e8b625b5.tar.gz
Fixes possible issue with no-op creator.
Leaving a no-op CREATOR can lead to issues. We throw a run-time exception to prevent anyone from using this. The StatsLogEventWrapper is meant to be write-only since it's only used to send data to statsd. Bug: 112550251 Test: Tested with provided POC app by external researcher. Change-Id: I001d84e2a61a1cd8a4f59aa156ca52f73ad0f6e1 (cherry picked from commit 78622d57ad102c054306b01321b6b2dbec3f9d1d)
-rw-r--r--core/java/android/os/StatsLogEventWrapper.java21
1 files changed, 8 insertions, 13 deletions
diff --git a/core/java/android/os/StatsLogEventWrapper.java b/core/java/android/os/StatsLogEventWrapper.java
index d4d3dc838d91..7b3ea57ba0e9 100644
--- a/core/java/android/os/StatsLogEventWrapper.java
+++ b/core/java/android/os/StatsLogEventWrapper.java
@@ -65,11 +65,17 @@ public final class StatsLogEventWrapper implements Parcelable {
public static final Parcelable.Creator<StatsLogEventWrapper> CREATOR = new
Parcelable.Creator<StatsLogEventWrapper>() {
public StatsLogEventWrapper createFromParcel(Parcel in) {
- return new StatsLogEventWrapper(in);
+ android.util.EventLog.writeEvent(0x534e4554, "112550251",
+ android.os.Binder.getCallingUid(), "");
+ // Purposefully leaving this method not implemented.
+ throw new RuntimeException("Not implemented");
}
public StatsLogEventWrapper[] newArray(int size) {
- return new StatsLogEventWrapper[size];
+ android.util.EventLog.writeEvent(0x534e4554, "112550251",
+ android.os.Binder.getCallingUid(), "");
+ // Purposefully leaving this method not implemented.
+ throw new RuntimeException("Not implemented");
}
};
@@ -120,10 +126,6 @@ public final class StatsLogEventWrapper implements Parcelable {
mStorage.write(bytes, 0, bytes.length);
}
- private StatsLogEventWrapper(Parcel in) {
- readFromParcel(in);
- }
-
/**
* Writes the stored fields to a byte array. Will first write a new-line character to denote
* END_LIST before writing contents to byte array.
@@ -134,13 +136,6 @@ public final class StatsLogEventWrapper implements Parcelable {
}
/**
- * Not implemented.
- */
- public void readFromParcel(Parcel in) {
- // Not needed since this java class is for sending to statsd only.
- }
-
- /**
* Boilerplate for Parcel.
*/
public int describeContents() {