From c24058b649046bc84c938530567200c377d19faf Mon Sep 17 00:00:00 2001 From: Lian Dongzhou Date: Thu, 8 Feb 2024 11:26:00 +0800 Subject: [PATCH] Fix memory leak on sensormanager Test: Monkey test Google: 2954774 Change-Id: I597f6bc93a7a440fe0e6018025302a27c5ee2b3f Signed-off-by: Jia Jia --- src/com/android/settings/utils/SensorPrivacyManagerHelper.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/utils/SensorPrivacyManagerHelper.kt b/src/com/android/settings/utils/SensorPrivacyManagerHelper.kt index 3fe3ab0d50c..66211656276 100644 --- a/src/com/android/settings/utils/SensorPrivacyManagerHelper.kt +++ b/src/com/android/settings/utils/SensorPrivacyManagerHelper.kt @@ -50,7 +50,7 @@ open class SensorPrivacyManagerHelper(context: Context) : } init { - sensorPrivacyManager = context.getSystemService(SensorPrivacyManager::class.java)!! + sensorPrivacyManager = (context.applicationContext ?: context).getSystemService(SensorPrivacyManager::class.java)!! sensorPrivacyManager.addSensorPrivacyListener(context.mainExecutor, this) }