diff options
author | 2024-05-03 11:18:46 -0400 | |
---|---|---|
committer | 2024-05-06 19:26:40 +0000 | |
commit | 2af47ea5c79b9653c673455267f8baac991fb9f0 (patch) | |
tree | 2c03b5daa07fd6e09ad040f375aee1d09da824ab /java | |
parent | 376a1bffa82f90298db92ae17dc572765fdf0972 (diff) |
Dismiss if restarting after private space is locked
Share sheet only dismisses when it is moved to the background.
When private space is set to lock automatically, the private
space profile tab may remain visible, leading to disclosure
risk.
When restarting ChooserActivity, if the private tab was visible
but the private profile has since become locked, the activity
will be finished instead.
Bug: 338125945
Flag: com.android.intentresolver.fix_private_space_locked_on_restart
Test: manual; see description, screencast in bug
Change-Id: I294bf62f0a73f6c1b73f598109814701215cdeb5
Diffstat (limited to 'java')
-rw-r--r-- | java/src/com/android/intentresolver/ChooserActivity.java | 9 | ||||
-rw-r--r-- | java/src/com/android/intentresolver/ProfileAvailability.kt | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java index 1922c05c..f01fd77c 100644 --- a/java/src/com/android/intentresolver/ChooserActivity.java +++ b/java/src/com/android/intentresolver/ChooserActivity.java @@ -416,6 +416,15 @@ public class ChooserActivity extends Hilt_ChooserActivity implements @Override protected final void onRestart() { super.onRestart(); + if (mFeatureFlags.fixPrivateSpaceLockedOnRestart()) { + if (mChooserMultiProfilePagerAdapter.hasPageForProfile(Profile.Type.PRIVATE.ordinal()) + && !mProfileAvailability.isAvailable(mProfiles.getPrivateProfile())) { + Log.d(TAG, "Exiting due to unavailable profile"); + finish(); + return; + } + } + if (!mRegistered) { mPersonalPackageMonitor.register( this, diff --git a/java/src/com/android/intentresolver/ProfileAvailability.kt b/java/src/com/android/intentresolver/ProfileAvailability.kt index c8e78552..43982727 100644 --- a/java/src/com/android/intentresolver/ProfileAvailability.kt +++ b/java/src/com/android/intentresolver/ProfileAvailability.kt @@ -47,7 +47,7 @@ class ProfileAvailability( /** Query current profile availability. An unavailable profile is one which is not active. */ @MainThread - fun isAvailable(profile: Profile): Boolean { + fun isAvailable(profile: Profile?): Boolean { return runBlocking(background) { userInteractor.availability.map { it[profile] == true }.first() } |