summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author Mark Renouf <mrenouf@google.com> 2024-05-07 16:07:46 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-05-07 16:07:46 +0000
commit1ea03b7df47cc65646f4856e4a7a50c88d2a44c8 (patch)
treec3f1a34de54185d0c3803645115eb939442fee81 /java
parent1d01102df43f30a50f585968bb8eac200dac72bf (diff)
parent2af47ea5c79b9653c673455267f8baac991fb9f0 (diff)
Merge "Dismiss if restarting after private space is locked" into main
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/intentresolver/ChooserActivity.java9
-rw-r--r--java/src/com/android/intentresolver/ProfileAvailability.kt2
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 0e519726..8b78fc7e 100644
--- a/java/src/com/android/intentresolver/ChooserActivity.java
+++ b/java/src/com/android/intentresolver/ChooserActivity.java
@@ -417,6 +417,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()
}