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
This commit is contained in:
Evan Severson
2021-06-24 13:57:10 -07:00
parent d616f1ed95
commit 1207ce470e

View File

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