From 5cc865b9b93265fe21639c9e4db828901d3a49f9 Mon Sep 17 00:00:00 2001 From: lijilou Date: Mon, 16 Dec 2024 16:28:33 +0800 Subject: PackageWatchdog: fix the double close issue. 1 without the IOException happen,the finishWrite method will close the stream. 2 with the IOException happen,the failWrite method will close the stream. so,we no need to close the stream in finally method. Bug: none Flag: EXEMPT minor optimization Change-Id: If2e01149499d4848ccc56323b964637c8894b658 --- services/core/java/com/android/server/PackageWatchdog.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/core/java/com/android/server/PackageWatchdog.java b/services/core/java/com/android/server/PackageWatchdog.java index 81a5b55ab2eb..32be643382aa 100644 --- a/services/core/java/com/android/server/PackageWatchdog.java +++ b/services/core/java/com/android/server/PackageWatchdog.java @@ -1228,8 +1228,6 @@ public class PackageWatchdog { Slog.w(TAG, "Failed to save monitored packages, restoring backup", e); mPolicyFile.failWrite(stream); return false; - } finally { - IoUtils.closeQuietly(stream); } } } -- cgit v1.2.3-59-g8ed1b