Merge "Disable tabbed view support for UsbResolverActivity."
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index dc801a9..8618bcf 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -373,7 +373,7 @@
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();
@@ -773,7 +773,7 @@
Intent[] initialIntents,
List<ResolveInfo> rList,
boolean filterLastUsed) {
- if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+ if (shouldShowTabs()) {
mChooserMultiProfilePagerAdapter = createChooserMultiProfilePagerAdapterForTwoProfiles(
initialIntents, rList, filterLastUsed);
} else {
@@ -2434,7 +2434,7 @@
offset += findViewById(R.id.content_preview_container).getHeight();
}
- if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+ if (shouldShowTabs()) {
offset += findViewById(R.id.tabs).getHeight();
}
@@ -2562,7 +2562,7 @@
}
private void setupScrollListener() {
- if (mResolverDrawerLayout == null || (hasWorkProfile() && ENABLE_TABBED_VIEW)) {
+ if (mResolverDrawerLayout == null || shouldShowTabs()) {
return;
}
final View chooserHeader = mResolverDrawerLayout.findViewById(R.id.chooser_header);
@@ -2613,8 +2613,7 @@
* 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())
@@ -2824,7 +2823,7 @@
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())) {
@@ -2840,7 +2839,7 @@
}
public int getProfileRowCount() {
- if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+ if (shouldShowTabs()) {
return 0;
}
return mChooserListAdapter.getOtherProfile() == null ? 0 : 1;
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 8f0ffd9..409ae34 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -362,7 +362,7 @@
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);
@@ -390,7 +390,7 @@
| 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(
@@ -419,7 +419,7 @@
List<ResolveInfo> rList,
boolean filterLastUsed) {
AbstractMultiProfilePagerAdapter resolverMultiProfilePagerAdapter = null;
- if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+ if (shouldShowTabs()) {
resolverMultiProfilePagerAdapter =
createResolverMultiProfilePagerAdapterForTwoProfiles(
initialIntents, rList, filterLastUsed);
@@ -500,10 +500,14 @@
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();
@@ -728,7 +732,7 @@
if (!mRegistered) {
mPersonalPackageMonitor.register(this, getMainLooper(),
getPersonalProfileUserHandle(), false);
- if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+ if (shouldShowTabs()) {
if (mWorkPackageMonitor == null) {
mWorkPackageMonitor = createPackageMonitor(
mMultiProfilePagerAdapter.getWorkListAdapter());
@@ -745,7 +749,7 @@
@Override
protected void onStart() {
super.onStart();
- if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+ if (shouldShowTabs()) {
mWorkProfileStateReceiver = createWorkProfileStateReceiver();
registerWorkProfileStateReceiver();
}
@@ -1346,7 +1350,7 @@
setupViewVisibilities();
- if (hasWorkProfile() && ENABLE_TABBED_VIEW) {
+ if (shouldShowTabs()) {
setupProfileTabs();
}
@@ -1569,7 +1573,7 @@
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);
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java
index 2e30d32..0aa965b 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbResolverActivity.java
@@ -190,4 +190,9 @@
}
return true;
}
+
+ @Override
+ protected boolean shouldShowTabs() {
+ return false;
+ }
}