Make "Recycle" Android Lint rule blocking for PackageInstaller
"Recycle" Android Lint rule checks the code for unclosed Cursor
objects, as well as other unclosed resources. Cursors which are
not closed as soon as they are not used anymore may lead to
Android performance issues:
* if Cursor was created by querying ContentProvider, then it
will hold an active binding to the process that hosts
ContentProvider, which will prevent this process from being
cached or unloaded
* each Cursor can hold an up to 2 MB CursorWindow memory buffer
Changing "Recycle" rule severity to "error" will block the code
with unclosed Cursors from being submitted.
Bug: 266775648
Test: m PackageInstaller
Test: m lint-check
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ab51cb8d9991a74c29896358dfec502955c9b316)
Change-Id: Ice7f02158259e1c2f899d43e8de8dd318fec1016
diff --git a/packages/PackageInstaller/Android.bp b/packages/PackageInstaller/Android.bp
index fd982f5..58224b8 100644
--- a/packages/PackageInstaller/Android.bp
+++ b/packages/PackageInstaller/Android.bp
@@ -47,6 +47,10 @@
"androidx.leanback_leanback",
"androidx.annotation_annotation",
],
+
+ lint: {
+ error_checks: ["Recycle"],
+ },
}
android_app {
@@ -67,6 +71,10 @@
"androidx.leanback_leanback",
],
aaptflags: ["--product tablet"],
+
+ lint: {
+ error_checks: ["Recycle"],
+ },
}
android_app {
@@ -88,4 +96,8 @@
"androidx.annotation_annotation",
],
aaptflags: ["--product tv"],
+
+ lint: {
+ error_checks: ["Recycle"],
+ },
}