From f507d5625e52aa22086edfa5474df8c62fab73e2 Mon Sep 17 00:00:00 2001 From: Andriy Kozachuk Date: Mon, 15 May 2023 12:44:31 +0000 Subject: [PATCH] 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 --- packages/PackageInstaller/Android.bp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/PackageInstaller/Android.bp b/packages/PackageInstaller/Android.bp index 47575137558a1..565a51ff6aaed 100644 --- a/packages/PackageInstaller/Android.bp +++ b/packages/PackageInstaller/Android.bp @@ -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"], + }, }