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
Merged-In: Ice7f02158259e1c2f899d43e8de8dd318fec1016
Change-Id: Ic062d53c26cb67e2b6c7070c96ab51bd44c3d824
This commit is contained in:
Andriy Kozachuk
2023-05-15 12:44:31 +00:00
parent 4811f1daee
commit f507d5625e

View File

@@ -46,6 +46,10 @@ android_app {
"xz-java",
"androidx.leanback_leanback",
],
lint: {
error_checks: ["Recycle"],
},
}
android_app {
@@ -64,6 +68,10 @@ android_app {
"androidx.leanback_leanback",
],
aaptflags: ["--product tablet"],
lint: {
error_checks: ["Recycle"],
},
}
android_app {
@@ -82,4 +90,8 @@ android_app {
"androidx.leanback_leanback",
],
aaptflags: ["--product tv"],
lint: {
error_checks: ["Recycle"],
},
}