From ceeae6dcff1dddca15b8e3c2781dc1dc3381d1c8 Mon Sep 17 00:00:00 2001 From: Anna Zhuravleva Date: Wed, 17 Apr 2024 17:02:12 +0000 Subject: Block taking recents screenshot if private profile available Sharesheet shows separate tab when private profile is on. User can move sharesheet to the background (e.g. by launching other app using shortcut) and then lock private profile. Recents preview screen shows screenshot of the Sharesheet at the last moment it was in foreground (when the space was unlocked). As a result Recents preview can leak whether private profile exists on device. This change sets setting to show blank screen in the recents when private profile is avaialble. Bug: 333387696 Test: manual, https://buganizer.corp.google.com/issues/333387696#comment8 Change-Id: I8758cd0a311ce93a03d998c4ada8999a6d02246d --- java/src/com/android/intentresolver/ChooserActivity.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'java') diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java index 7e2c9c5a..e68ee7f4 100644 --- a/java/src/com/android/intentresolver/ChooserActivity.java +++ b/java/src/com/android/intentresolver/ChooserActivity.java @@ -509,6 +509,8 @@ public class ChooserActivity extends Hilt_ChooserActivity implements mMaxTargetsPerRow, mFeatureFlags); + maybeDisableRecentsScreenshot(mProfiles, mProfileAvailability); + if (!configureContentView(mTargetDataLoader)) { mPersonalPackageMonitor = createPackageMonitor( mChooserMultiProfilePagerAdapter.getPersonalListAdapter()); @@ -647,6 +649,20 @@ public class ChooserActivity extends Hilt_ChooserActivity implements Tracer.INSTANCE.markLaunched(); } + private void maybeDisableRecentsScreenshot( + ProfileHelper profileHelper, ProfileAvailability profileAvailability) { + for (Profile profile : profileHelper.getProfiles()) { + if (profile.getType() == Profile.Type.PRIVATE) { + if (profileAvailability.isAvailable(profile)) { + // Show blank screen in Recent preview if private profile is available + // to not leak its presence. + setRecentsScreenshotEnabled(false); + } + return; + } + } + } + private void onChooserRequestChanged(ChooserRequest chooserRequest) { // intentional reference comarison if (mRequest == chooserRequest) { -- cgit v1.2.3-59-g8ed1b