From 5123d58b08470bb23b4114e4228caf4b27b27e27 Mon Sep 17 00:00:00 2001 From: Sim Sun Date: Thu, 21 Dec 2023 14:12:18 -0800 Subject: [PATCH] catch throwable instead exceptoin during deleting backup dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: CredentialProtectedWhileLockedViolation is not a exception, try to catch the throwable to swallow this. java.lang.Object ↳ java.lang.Throwable ↳ android.os.strictmode.Violation ↳ android.os.strictmode.CredentialProtectedWhileLockedViolation https://developer.android.com/reference/android/os/strictmode/CredentialProtectedWhileLockedViolation Reviewed By: phecdarain Differential Revision: D52376686 fbshipit-source-id: 28c2d6fbc249e5165d810b96b9860788903684c7 --- java/com/facebook/soloader/SoLoader.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/com/facebook/soloader/SoLoader.java b/java/com/facebook/soloader/SoLoader.java index d89f73a..ed1d43c 100644 --- a/java/com/facebook/soloader/SoLoader.java +++ b/java/com/facebook/soloader/SoLoader.java @@ -16,6 +16,7 @@ package com.facebook.soloader; +import android.annotation.SuppressLint; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; @@ -452,6 +453,7 @@ private static void addApplicationSoSource(ArrayList soSources, int fl } /** Add the SoSources for recovering the dso if the file is corrupted or missed */ + @SuppressLint("CatchGeneralException") private static void addBackupSoSource( Context context, ArrayList soSources, int backupSoSourceFlags) throws IOException { if ((sFlags & SOLOADER_DISABLE_BACKUP_SOSOURCE) != 0) { @@ -461,7 +463,7 @@ private static void addBackupSoSource( if (backupDir.exists()) { SysUtil.dumbDelete(backupDir); } - } catch (Exception e) { + } catch (Throwable e) { LogUtil.w(TAG, "Failed to delete " + backupDir.getCanonicalPath(), e); } return;