OSDN Git Service

Close ApkAssets in PackageParser
authorWinson <chiuwinson@google.com>
Thu, 7 Mar 2019 20:54:24 +0000 (12:54 -0800)
committerWinson Chiu <chiuwinson@google.com>
Wed, 10 Apr 2019 19:00:35 +0000 (19:00 +0000)
commit7a3d82a58198944bfa9d56709b3ee077e545743c
tree3a44f4cd55edfd6a55be819516b096efebd484f6
parent329a9b0b6fa7bc7e8bdba1c70a6887205f4c51b8
Close ApkAssets in PackageParser

Immediately closes ApkAssets to free up some memory during package
parsing/install process.

This is used instead of implementing AutoCloseable because of
complexities with AssetManager and tracking assets opened
outside of the ApkAssets.java class.

Explained more in b/72056911.

Test: manually booted emulator; closing ApkAssets is used at
boot in PackageParser#parseApkLiteInner
Test: adb install test.apk && sleep 5 && adb uninstall test.package
&& sleep 1 && (adb shell lsof | grep "test.package") prints no
system_server references

Bug: 130182148

Change-Id: Ia471d7065e65bd39b535309de6c6da7ec35bdf12
core/java/android/content/pm/PackageParser.java
core/java/android/content/res/ApkAssets.java
core/java/android/content/res/StringBlock.java