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
Loading
Please register or sign in to comment