Loading core/java/com/android/internal/app/ChooserActivity.java +7 −8 Original line number Diff line number Diff line Loading @@ -373,7 +373,7 @@ public class ChooserActivity extends ResolverActivity implements Log.i(TAG, "Hiding image preview area. Timed out waiting for preview to load" + " within " + mImageLoadTimeoutMillis + "ms."); collapseParentView(); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { hideStickyContentPreview(); } else if (mChooserMultiProfilePagerAdapter.getCurrentRootAdapter() != null) { mChooserMultiProfilePagerAdapter.getCurrentRootAdapter().hideContentPreview(); Loading Loading @@ -773,7 +773,7 @@ public class ChooserActivity extends ResolverActivity implements Intent[] initialIntents, List<ResolveInfo> rList, boolean filterLastUsed) { if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { mChooserMultiProfilePagerAdapter = createChooserMultiProfilePagerAdapterForTwoProfiles( initialIntents, rList, filterLastUsed); } else { Loading Loading @@ -2434,7 +2434,7 @@ public class ChooserActivity extends ResolverActivity implements offset += findViewById(R.id.content_preview_container).getHeight(); } if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { offset += findViewById(R.id.tabs).getHeight(); } Loading Loading @@ -2562,7 +2562,7 @@ public class ChooserActivity extends ResolverActivity implements } private void setupScrollListener() { if (mResolverDrawerLayout == null || (hasWorkProfile() && ENABLE_TABBED_VIEW)) { if (mResolverDrawerLayout == null || shouldShowTabs()) { return; } final View chooserHeader = mResolverDrawerLayout.findViewById(R.id.chooser_header); Loading Loading @@ -2613,8 +2613,7 @@ public class ChooserActivity extends ResolverActivity implements * we instead show the content preview as a regular list item. */ private boolean shouldShowStickyContentPreview() { return hasWorkProfile() && ENABLE_TABBED_VIEW return shouldShowTabs() && mMultiProfilePagerAdapter.getListAdapterForUserHandle( UserHandle.of(UserHandle.myUserId())).getCount() > 0 && isSendAction(getTargetIntent()) Loading Loading @@ -2824,7 +2823,7 @@ public class ChooserActivity extends ResolverActivity implements public int getContentPreviewRowCount() { // For the tabbed case we show the sticky content preview above the tabs, // please refer to shouldShowStickyContentPreview if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { return 0; } if (!isSendAction(getTargetIntent())) { Loading @@ -2840,7 +2839,7 @@ public class ChooserActivity extends ResolverActivity implements } public int getProfileRowCount() { if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { return 0; } return mChooserListAdapter.getOtherProfile() == null ? 0 : 1; Loading core/java/com/android/internal/app/ResolverActivity.java +12 −8 Original line number Diff line number Diff line Loading @@ -362,7 +362,7 @@ public class ResolverActivity extends Activity implements mMultiProfilePagerAdapter.getPersonalListAdapter()); mPersonalPackageMonitor.register( this, getMainLooper(), getPersonalProfileUserHandle(), false); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { mWorkPackageMonitor = createPackageMonitor( mMultiProfilePagerAdapter.getWorkListAdapter()); mWorkPackageMonitor.register(this, getMainLooper(), getWorkProfileUserHandle(), false); Loading Loading @@ -390,7 +390,7 @@ public class ResolverActivity extends Activity implements | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); rdl.setOnApplyWindowInsetsListener(this::onApplyWindowInsets); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { rdl.setMaxCollapsedHeight(getResources().getDimensionPixelSize( R.dimen.resolver_empty_state_height_with_tabs)); findViewById(R.id.profile_pager).setMinimumHeight( Loading Loading @@ -419,7 +419,7 @@ public class ResolverActivity extends Activity implements List<ResolveInfo> rList, boolean filterLastUsed) { AbstractMultiProfilePagerAdapter resolverMultiProfilePagerAdapter = null; if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { resolverMultiProfilePagerAdapter = createResolverMultiProfilePagerAdapterForTwoProfiles( initialIntents, rList, filterLastUsed); Loading Loading @@ -500,10 +500,14 @@ public class ResolverActivity extends Activity implements return null; } protected boolean hasWorkProfile() { private boolean hasWorkProfile() { return getWorkProfileUserHandle() != null; } protected boolean shouldShowTabs() { return hasWorkProfile() && ENABLE_TABBED_VIEW; } protected void onProfileClick(View v) { final DisplayResolveInfo dri = mMultiProfilePagerAdapter.getActiveListAdapter().getOtherProfile(); Loading Loading @@ -728,7 +732,7 @@ public class ResolverActivity extends Activity implements if (!mRegistered) { mPersonalPackageMonitor.register(this, getMainLooper(), getPersonalProfileUserHandle(), false); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { if (mWorkPackageMonitor == null) { mWorkPackageMonitor = createPackageMonitor( mMultiProfilePagerAdapter.getWorkListAdapter()); Loading @@ -745,7 +749,7 @@ public class ResolverActivity extends Activity implements @Override protected void onStart() { super.onStart(); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { mWorkProfileStateReceiver = createWorkProfileStateReceiver(); registerWorkProfileStateReceiver(); } Loading Loading @@ -1346,7 +1350,7 @@ public class ResolverActivity extends Activity implements setupViewVisibilities(); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { setupProfileTabs(); } Loading Loading @@ -1569,7 +1573,7 @@ public class ResolverActivity extends Activity implements stub.setVisibility(View.VISIBLE); TextView textView = (TextView) LayoutInflater.from(this).inflate( R.layout.resolver_different_item_header, null, false); if (ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { textView.setGravity(Gravity.CENTER); } stub.addView(textView); Loading packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -190,4 +190,9 @@ public class UsbResolverActivity extends ResolverActivity { } return true; } @Override protected boolean shouldShowTabs() { return false; } } Loading
core/java/com/android/internal/app/ChooserActivity.java +7 −8 Original line number Diff line number Diff line Loading @@ -373,7 +373,7 @@ public class ChooserActivity extends ResolverActivity implements Log.i(TAG, "Hiding image preview area. Timed out waiting for preview to load" + " within " + mImageLoadTimeoutMillis + "ms."); collapseParentView(); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { hideStickyContentPreview(); } else if (mChooserMultiProfilePagerAdapter.getCurrentRootAdapter() != null) { mChooserMultiProfilePagerAdapter.getCurrentRootAdapter().hideContentPreview(); Loading Loading @@ -773,7 +773,7 @@ public class ChooserActivity extends ResolverActivity implements Intent[] initialIntents, List<ResolveInfo> rList, boolean filterLastUsed) { if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { mChooserMultiProfilePagerAdapter = createChooserMultiProfilePagerAdapterForTwoProfiles( initialIntents, rList, filterLastUsed); } else { Loading Loading @@ -2434,7 +2434,7 @@ public class ChooserActivity extends ResolverActivity implements offset += findViewById(R.id.content_preview_container).getHeight(); } if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { offset += findViewById(R.id.tabs).getHeight(); } Loading Loading @@ -2562,7 +2562,7 @@ public class ChooserActivity extends ResolverActivity implements } private void setupScrollListener() { if (mResolverDrawerLayout == null || (hasWorkProfile() && ENABLE_TABBED_VIEW)) { if (mResolverDrawerLayout == null || shouldShowTabs()) { return; } final View chooserHeader = mResolverDrawerLayout.findViewById(R.id.chooser_header); Loading Loading @@ -2613,8 +2613,7 @@ public class ChooserActivity extends ResolverActivity implements * we instead show the content preview as a regular list item. */ private boolean shouldShowStickyContentPreview() { return hasWorkProfile() && ENABLE_TABBED_VIEW return shouldShowTabs() && mMultiProfilePagerAdapter.getListAdapterForUserHandle( UserHandle.of(UserHandle.myUserId())).getCount() > 0 && isSendAction(getTargetIntent()) Loading Loading @@ -2824,7 +2823,7 @@ public class ChooserActivity extends ResolverActivity implements public int getContentPreviewRowCount() { // For the tabbed case we show the sticky content preview above the tabs, // please refer to shouldShowStickyContentPreview if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { return 0; } if (!isSendAction(getTargetIntent())) { Loading @@ -2840,7 +2839,7 @@ public class ChooserActivity extends ResolverActivity implements } public int getProfileRowCount() { if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { return 0; } return mChooserListAdapter.getOtherProfile() == null ? 0 : 1; Loading
core/java/com/android/internal/app/ResolverActivity.java +12 −8 Original line number Diff line number Diff line Loading @@ -362,7 +362,7 @@ public class ResolverActivity extends Activity implements mMultiProfilePagerAdapter.getPersonalListAdapter()); mPersonalPackageMonitor.register( this, getMainLooper(), getPersonalProfileUserHandle(), false); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { mWorkPackageMonitor = createPackageMonitor( mMultiProfilePagerAdapter.getWorkListAdapter()); mWorkPackageMonitor.register(this, getMainLooper(), getWorkProfileUserHandle(), false); Loading Loading @@ -390,7 +390,7 @@ public class ResolverActivity extends Activity implements | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); rdl.setOnApplyWindowInsetsListener(this::onApplyWindowInsets); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { rdl.setMaxCollapsedHeight(getResources().getDimensionPixelSize( R.dimen.resolver_empty_state_height_with_tabs)); findViewById(R.id.profile_pager).setMinimumHeight( Loading Loading @@ -419,7 +419,7 @@ public class ResolverActivity extends Activity implements List<ResolveInfo> rList, boolean filterLastUsed) { AbstractMultiProfilePagerAdapter resolverMultiProfilePagerAdapter = null; if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { resolverMultiProfilePagerAdapter = createResolverMultiProfilePagerAdapterForTwoProfiles( initialIntents, rList, filterLastUsed); Loading Loading @@ -500,10 +500,14 @@ public class ResolverActivity extends Activity implements return null; } protected boolean hasWorkProfile() { private boolean hasWorkProfile() { return getWorkProfileUserHandle() != null; } protected boolean shouldShowTabs() { return hasWorkProfile() && ENABLE_TABBED_VIEW; } protected void onProfileClick(View v) { final DisplayResolveInfo dri = mMultiProfilePagerAdapter.getActiveListAdapter().getOtherProfile(); Loading Loading @@ -728,7 +732,7 @@ public class ResolverActivity extends Activity implements if (!mRegistered) { mPersonalPackageMonitor.register(this, getMainLooper(), getPersonalProfileUserHandle(), false); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { if (mWorkPackageMonitor == null) { mWorkPackageMonitor = createPackageMonitor( mMultiProfilePagerAdapter.getWorkListAdapter()); Loading @@ -745,7 +749,7 @@ public class ResolverActivity extends Activity implements @Override protected void onStart() { super.onStart(); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { mWorkProfileStateReceiver = createWorkProfileStateReceiver(); registerWorkProfileStateReceiver(); } Loading Loading @@ -1346,7 +1350,7 @@ public class ResolverActivity extends Activity implements setupViewVisibilities(); if (hasWorkProfile() && ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { setupProfileTabs(); } Loading Loading @@ -1569,7 +1573,7 @@ public class ResolverActivity extends Activity implements stub.setVisibility(View.VISIBLE); TextView textView = (TextView) LayoutInflater.from(this).inflate( R.layout.resolver_different_item_header, null, false); if (ENABLE_TABBED_VIEW) { if (shouldShowTabs()) { textView.setGravity(Gravity.CENTER); } stub.addView(textView); Loading
packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -190,4 +190,9 @@ public class UsbResolverActivity extends ResolverActivity { } return true; } @Override protected boolean shouldShowTabs() { return false; } }