diff options
| author | 2023-01-06 11:29:32 +0000 | |
|---|---|---|
| committer | 2023-01-06 11:29:32 +0000 | |
| commit | 8edfdb2a8ea1b1a92bd002ed7aa758b53113465d (patch) | |
| tree | 77ef5c1eb39c0a0862f77a6ba40c13dc51b33c0f /java | |
| parent | c317e6a26b75da0a693cbb14f673ecdd7152c433 (diff) | |
[Chooser/ResolverActivity] Add option to show preview area even if there are no apps in the tab
Add a protected method that could be overriden
to change the default behavior that hides the
content preview area when there are not items
for the current user.
This is needed for the partial screen sharing
feature as we want to show the recents app selector
no matter if we have apps available for the
current profile or not. Recent app selector is
displayed in content preview area.
Test: atest com.android.intentresolver.UnbundledChooserActivityWorkProfileTest
Bug: 233348916
Change-Id: I0fa8da2dd4a690f5be1741d0936f776a3374aee7
Diffstat (limited to 'java')
| -rw-r--r-- | java/src/com/android/intentresolver/ChooserActivity.java | 14 | ||||
| -rw-r--r-- | java/src/com/android/intentresolver/ResolverActivity.java | 6 |
2 files changed, 16 insertions, 4 deletions
diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java index ceab62b2..a3de9d31 100644 --- a/java/src/com/android/intentresolver/ChooserActivity.java +++ b/java/src/com/android/intentresolver/ChooserActivity.java @@ -1946,12 +1946,24 @@ public class ChooserActivity extends ResolverActivity implements private boolean shouldShowStickyContentPreviewNoOrientationCheck() { return shouldShowTabs() - && mMultiProfilePagerAdapter.getListAdapterForUserHandle( + && (mMultiProfilePagerAdapter.getListAdapterForUserHandle( UserHandle.of(UserHandle.myUserId())).getCount() > 0 + || shouldShowContentPreviewWhenEmpty()) && shouldShowContentPreview(); } /** + * This method could be used to override the default behavior when we hide the preview area + * when the current tab doesn't have any items. + * + * @return true if we want to show the content preview area even if the tab for the current + * user is empty + */ + protected boolean shouldShowContentPreviewWhenEmpty() { + return false; + } + + /** * @return true if we want to show the content preview area */ protected boolean shouldShowContentPreview() { diff --git a/java/src/com/android/intentresolver/ResolverActivity.java b/java/src/com/android/intentresolver/ResolverActivity.java index 5573e18a..5f8f3da8 100644 --- a/java/src/com/android/intentresolver/ResolverActivity.java +++ b/java/src/com/android/intentresolver/ResolverActivity.java @@ -202,7 +202,7 @@ public class ResolverActivity extends FragmentActivity implements * <p>Can only be used if there is a work profile. * <p>Possible values can be either {@link #PROFILE_PERSONAL} or {@link #PROFILE_WORK}. */ - static final String EXTRA_SELECTED_PROFILE = + protected static final String EXTRA_SELECTED_PROFILE = "com.android.internal.app.ResolverActivity.EXTRA_SELECTED_PROFILE"; /** @@ -217,8 +217,8 @@ public class ResolverActivity extends FragmentActivity implements static final String EXTRA_CALLING_USER = "com.android.internal.app.ResolverActivity.EXTRA_CALLING_USER"; - static final int PROFILE_PERSONAL = AbstractMultiProfilePagerAdapter.PROFILE_PERSONAL; - static final int PROFILE_WORK = AbstractMultiProfilePagerAdapter.PROFILE_WORK; + protected static final int PROFILE_PERSONAL = AbstractMultiProfilePagerAdapter.PROFILE_PERSONAL; + protected static final int PROFILE_WORK = AbstractMultiProfilePagerAdapter.PROFILE_WORK; private BroadcastReceiver mWorkProfileStateReceiver; private UserHandle mHeaderCreatorUser; |