From 1207ce470ef66a064ed6fa903b660501bfd4dbbc Mon Sep 17 00:00:00 2001 From: Evan Severson Date: Thu, 24 Jun 2021 13:57:10 -0700 Subject: [PATCH] Do not tell app the user is leaving When the app opens the mic or camera when it's blocked we should not send the lifecycle event onUserLeaveHint() since the user wasn't trying to leave. Test: Create test app to observe onUserLeaveHint() Bug: 189484786 Change-Id: I635ed2617b2283c3a6df535236f95132d4ec53c1 --- .../core/java/com/android/server/SensorPrivacyService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/SensorPrivacyService.java b/services/core/java/com/android/server/SensorPrivacyService.java index 71609d2b557dc..0a10e9d8aba27 100644 --- a/services/core/java/com/android/server/SensorPrivacyService.java +++ b/services/core/java/com/android/server/SensorPrivacyService.java @@ -29,6 +29,7 @@ import static android.app.AppOpsManager.OP_RECORD_AUDIO; import static android.app.AppOpsManager.OP_RECORD_AUDIO_HOTWORD; import static android.content.Intent.EXTRA_PACKAGE_NAME; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; +import static android.content.Intent.FLAG_ACTIVITY_NO_USER_ACTION; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.hardware.SensorPrivacyManager.EXTRA_ALL_SENSORS; import static android.hardware.SensorPrivacyManager.EXTRA_SENSOR; @@ -485,7 +486,8 @@ public final class SensorPrivacyService extends SystemService { options.setLaunchTaskId(info.mTaskId); options.setTaskOverlay(true, true); - dialogIntent.addFlags(FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); + dialogIntent.addFlags( + FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | FLAG_ACTIVITY_NO_USER_ACTION); dialogIntent.putExtra(EXTRA_PACKAGE_NAME, info.mPackageName); if (sensors.size() == 1) {