From 373fb4094715ef11a02afcacd0e9839b5b6df8eb Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Mon, 29 Jun 2015 22:07:30 -0700 Subject: [PATCH] Frameworks/base: Remove UsageEvents finalizer The order of finalization between the parcel and the UsageEvents objects is not defined. In the bad case, the parcel will be finalized first and destroy its native pointer, after which the UsageEvents object will recycle it, putting it back into one of the Parcel pools. This will violate the pool invariant. Bug: 22088355 Change-Id: Ifbe7822990cdfc31855d6742dcdea9d9dd0daf1b --- core/java/android/app/usage/UsageEvents.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/core/java/android/app/usage/UsageEvents.java b/core/java/android/app/usage/UsageEvents.java index 369b692a12138..24647f388fc12 100644 --- a/core/java/android/app/usage/UsageEvents.java +++ b/core/java/android/app/usage/UsageEvents.java @@ -372,13 +372,4 @@ public final class UsageEvents implements Parcelable { return new UsageEvents[size]; } }; - - @Override - protected void finalize() throws Throwable { - super.finalize(); - if (mParcel != null) { - mParcel.recycle(); - mParcel = null; - } - } }