Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69f51063 authored by Jiakai Zhang's avatar Jiakai Zhang
Browse files

Ignore I/O errors in the new code path of calculateInstalledSize.

There's a subtle difference between Java's `File.length` and
`Files.size`. The former returns 0 on I/O errors, while the latter
throws IOException when an I/O error occurs.

When an app uses PM shell commands to install an APK, it may place the
APK in its own data directory, where system_server doesn't have access
but installd does. In this case, the old code path of
calculateInstalledSize returns 0 and the installation still succeeds. To
achieve parity, this CL changes the new code path to use `File.length`
too.

Bug: 258223472
Test: atest CtsPackageInstallTestCases
Test: atest NexusLauncherImageTests:com.google.android.apps.nexuslauncher.imagecomparison.AppTitleContrastPillImageTest
Flag: android.content.pm.alternative_for_dexopt_cleanup
Change-Id: If041f831a95f1822624ee0ad556fcafd6676abb4
parent 549084ff
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment