summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-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()
}