Fix memory leak on sensormanager

Test: Monkey test

Google: 2954774
Change-Id: I597f6bc93a7a440fe0e6018025302a27c5ee2b3f
Signed-off-by: Jia Jia <jia.jia@zte.com.cn>
This commit is contained in:
Lian Dongzhou
2024-02-08 11:26:00 +08:00
committed by Joey
parent 767a50a987
commit c24058b649

View File

@@ -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)
}