Avoid infinite loop in case system_server does not have delete access.

This must not ever happen, but if it does then let's crash with a good
error message instead of hanging and getting out of stack memory
exception.

Bug: 269072872
Test: atest ShortcutManagerTest1
Change-Id: I7e4d9ac612c9e4e45d1521e3bebfb787fe21c953
This commit is contained in:
Alex Buynytskyy
2023-05-31 19:53:36 -07:00
parent a584474ac4
commit 884056f84f

View File

@@ -230,7 +230,9 @@ final class ResilientAtomicFile implements Closeable {
+ Log.getStackTraceString(e));
}
mCurrentFile.delete();
if (!mCurrentFile.delete()) {
throw new IllegalStateException("Failed to remove " + mCurrentFile);
}
mCurrentFile = null;
}