From 9ac588b0dddc5068a39798c4f75594cba780f1b3 Mon Sep 17 00:00:00 2001 From: Mehdi Alizadeh Date: Mon, 15 Apr 2019 17:25:46 -0700 Subject: [PATCH] Check before closing the CloseGuard if not closed yet Bug: 130435945 Test: atest AppPredictionServiceTest Change-Id: I19d866d54e6b7e74e0399e2910ab9c9c71d13f51 --- core/java/android/app/prediction/AppPredictor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/prediction/AppPredictor.java b/core/java/android/app/prediction/AppPredictor.java index 3f2f2090bf33d..cd635d635ce16 100644 --- a/core/java/android/app/prediction/AppPredictor.java +++ b/core/java/android/app/prediction/AppPredictor.java @@ -271,7 +271,9 @@ public final class AppPredictor { if (mCloseGuard != null) { mCloseGuard.warnIfOpen(); } - destroy(); + if (!mIsClosed.get()) { + destroy(); + } } finally { super.finalize(); }