summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-04-23 03:24:39 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-04-23 03:24:39 +0000
commitb4b571d55554ce2d0c1120f920195d792d3cfccd (patch)
tree823978b345fe03e4f53be9c2371611c1c1613897
parentcb10c1675f9bf72baeea662acd7553405ad559cc (diff)
parenta6a3fe4434af644d01acd21da0c976c4483501bc (diff)
Merge "Remove scrollable preview flag" into main
-rw-r--r--aconfig/FeatureFlags.aconfig7
-rw-r--r--java/res/layout/chooser_grid.xml97
-rw-r--r--java/res/layout/chooser_list_per_profile.xml34
-rw-r--r--java/src/com/android/intentresolver/ChooserActivity.java26
-rw-r--r--java/src/com/android/intentresolver/grid/ChooserGridAdapter.java21
-rw-r--r--java/src/com/android/intentresolver/profiles/ChooserMultiProfilePagerAdapter.java22
-rw-r--r--tests/activity/src/com/android/intentresolver/ChooserActivityTest.java2
-rw-r--r--tests/unit/src/com/android/intentresolver/contentpreview/FileContentPreviewUiTest.kt4
-rw-r--r--tests/unit/src/com/android/intentresolver/contentpreview/FilesPlusTextContentPreviewUiTest.kt8
-rw-r--r--tests/unit/src/com/android/intentresolver/contentpreview/TextContentPreviewUiTest.kt8
-rw-r--r--tests/unit/src/com/android/intentresolver/contentpreview/UnifiedContentPreviewUiTest.kt4
11 files changed, 36 insertions, 197 deletions
diff --git a/aconfig/FeatureFlags.aconfig b/aconfig/FeatureFlags.aconfig
index 583d8502..02f1c872 100644
--- a/aconfig/FeatureFlags.aconfig
+++ b/aconfig/FeatureFlags.aconfig
@@ -16,13 +16,6 @@ flag {
}
flag {
- name: "scrollable_preview"
- namespace: "intentresolver"
- description: "Makes preview scrollable with multiple profiles"
- bug: "287102904"
-}
-
-flag {
name: "target_data_caching"
namespace: "intentresolver"
description: "Enables caching target icons and labels in a local DB"
diff --git a/java/res/layout/chooser_grid.xml b/java/res/layout/chooser_grid.xml
deleted file mode 100644
index 8320b284..00000000
--- a/java/res/layout/chooser_grid.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* Copyright 2015, The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
--->
-<com.android.intentresolver.widget.ResolverDrawerLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- app:maxCollapsedHeight="0dp"
- app:maxCollapsedHeightSmall="56dp"
- android:maxWidth="@dimen/chooser_width"
- android:id="@androidprv:id/contentPanel">
-
- <RelativeLayout
- android:id="@androidprv:id/chooser_header"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- app:layout_alwaysShow="true"
- android:elevation="0dp"
- android:background="@drawable/bottomsheet_background">
-
- <View
- android:id="@androidprv:id/drag"
- android:layout_width="64dp"
- android:layout_height="4dp"
- android:background="@drawable/ic_drag_handle"
- android:layout_marginTop="@dimen/chooser_edge_margin_thin"
- android:layout_marginBottom="@dimen/chooser_edge_margin_thin"
- android:layout_centerHorizontal="true"
- android:layout_alignParentTop="true" />
-
- <TextView android:id="@android:id/title"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:textAppearance="@android:style/TextAppearance.DeviceDefault.WindowTitle"
- android:gravity="center"
- android:paddingBottom="@dimen/chooser_view_spacing"
- android:paddingLeft="24dp"
- android:paddingRight="24dp"
- android:visibility="gone"
- android:layout_below="@androidprv:id/drag"
- android:layout_centerHorizontal="true"/>
- </RelativeLayout>
-
- <FrameLayout
- android:id="@androidprv:id/content_preview_container"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:visibility="gone" />
-
- <TabHost
- android:id="@androidprv:id/profile_tabhost"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_centerHorizontal="true"
- android:background="?androidprv:attr/materialColorSurfaceContainer">
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
- <TabWidget
- android:id="@android:id/tabs"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:visibility="gone">
- </TabWidget>
- <FrameLayout
- android:id="@android:id/tabcontent"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
- <com.android.intentresolver.ResolverViewPager
- android:id="@androidprv:id/profile_pager"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
- </FrameLayout>
- </LinearLayout>
- </TabHost>
-
-</com.android.intentresolver.widget.ResolverDrawerLayout>
diff --git a/java/res/layout/chooser_list_per_profile.xml b/java/res/layout/chooser_list_per_profile.xml
deleted file mode 100644
index ef82090c..00000000
--- a/java/res/layout/chooser_list_per_profile.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
- ~ Copyright (C) 2019 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <androidx.recyclerview.widget.RecyclerView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:layoutManager="com.android.intentresolver.ChooserGridLayoutManager"
- android:id="@androidprv:id/resolver_list"
- android:clipToPadding="false"
- android:background="?androidprv:attr/materialColorSurfaceContainer"
- android:scrollbars="none"
- android:elevation="1dp"
- android:nestedScrollingEnabled="true" />
-
- <include layout="@layout/resolver_empty_states" />
-</RelativeLayout>
diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java
index b712788c..b712edf4 100644
--- a/java/src/com/android/intentresolver/ChooserActivity.java
+++ b/java/src/com/android/intentresolver/ChooserActivity.java
@@ -506,8 +506,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
mProfiles,
mProfileAvailability,
mRequest.getInitialIntents(),
- mMaxTargetsPerRow,
- mFeatureFlags);
+ mMaxTargetsPerRow);
if (!configureContentView(mTargetDataLoader)) {
mPersonalPackageMonitor = createPackageMonitor(
@@ -728,8 +727,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
mProfiles,
mProfileAvailability,
mRequest.getInitialIntents(),
- mMaxTargetsPerRow,
- mFeatureFlags);
+ mMaxTargetsPerRow);
mChooserMultiProfilePagerAdapter.setCurrentPage(currentPage);
if (mPersonalPackageMonitor != null) {
mPersonalPackageMonitor.unregister();
@@ -1191,9 +1189,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
boolean rebuildCompleted = mChooserMultiProfilePagerAdapter.rebuildTabs(
mProfiles.getWorkProfilePresent());
- mLayoutId = mFeatureFlags.scrollablePreview()
- ? R.layout.chooser_grid_scrollable_preview
- : R.layout.chooser_grid;
+ mLayoutId = R.layout.chooser_grid_scrollable_preview;
setContentView(mLayoutId);
mTabHost = findViewById(com.android.internal.R.id.profile_tabhost);
@@ -1362,8 +1358,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
mProfiles,
mProfileAvailability,
mRequest.getInitialIntents(),
- mMaxTargetsPerRow,
- mFeatureFlags);
+ mMaxTargetsPerRow);
}
private ChooserMultiProfilePagerAdapter createMultiProfilePagerAdapter(
@@ -1373,8 +1368,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
ProfileHelper profileHelper,
ProfileAvailability profileAvailability,
List<Intent> initialIntents,
- int maxTargetsPerRow,
- FeatureFlags featureFlags) {
+ int maxTargetsPerRow) {
Log.d(TAG, "createMultiProfilePagerAdapter");
Profile launchedAs = profileHelper.getLaunchedAsProfile();
@@ -1418,8 +1412,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
launchedAs.getType().ordinal(),
profileHelper.getWorkHandle(),
profileHelper.getCloneHandle(),
- maxTargetsPerRow,
- featureFlags);
+ maxTargetsPerRow);
}
protected EmptyStateProvider createBlockerEmptyStateProvider() {
@@ -1576,9 +1569,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
getResources(),
getLayoutInflater(),
parent,
- mFeatureFlags.scrollablePreview()
- ? findViewById(R.id.chooser_headline_row_container)
- : null);
+ findViewById(R.id.chooser_headline_row_container));
if (layout != null) {
adjustPreviewWidth(getResources().getConfiguration().orientation, layout);
@@ -2477,8 +2468,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements
ResolverListAdapter adapter = mChooserMultiProfilePagerAdapter.getListAdapterForUserHandle(
UserHandle.of(UserHandle.myUserId()));
boolean isEmpty = adapter == null || adapter.getCount() == 0;
- return (mFeatureFlags.scrollablePreview() || mProfiles.getWorkProfilePresent())
- && (!isEmpty || shouldShowContentPreviewWhenEmpty());
+ return !isEmpty || shouldShowContentPreviewWhenEmpty();
}
/**
diff --git a/java/src/com/android/intentresolver/grid/ChooserGridAdapter.java b/java/src/com/android/intentresolver/grid/ChooserGridAdapter.java
index ba76a4a0..cda69b9e 100644
--- a/java/src/com/android/intentresolver/grid/ChooserGridAdapter.java
+++ b/java/src/com/android/intentresolver/grid/ChooserGridAdapter.java
@@ -149,9 +149,7 @@ public final class ChooserGridAdapter extends RecyclerView.Adapter<RecyclerView.
@Override
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
- if (mFeatureFlags.scrollablePreview()) {
- mRecyclerView = recyclerView;
- }
+ mRecyclerView = recyclerView;
}
@Override
@@ -212,22 +210,7 @@ public final class ChooserGridAdapter extends RecyclerView.Adapter<RecyclerView.
* This area includes the content preview (if present) and action row.
*/
public int getSystemRowCount() {
- // For the tabbed case we show the sticky content preview above the tabs,
- // please refer to shouldShowStickyContentPreview
- if (mChooserActivityDelegate.shouldShowTabs()
- || mFeatureFlags.scrollablePreview()) {
- return 0;
- }
-
- if (!mShouldShowContentPreview) {
- return 0;
- }
-
- if (mChooserListAdapter == null || mChooserListAdapter.getCount() == 0) {
- return 0;
- }
-
- return 1;
+ return 0;
}
public int getFooterRowCount() {
diff --git a/java/src/com/android/intentresolver/profiles/ChooserMultiProfilePagerAdapter.java b/java/src/com/android/intentresolver/profiles/ChooserMultiProfilePagerAdapter.java
index 4d0f4a49..8aee0da1 100644
--- a/java/src/com/android/intentresolver/profiles/ChooserMultiProfilePagerAdapter.java
+++ b/java/src/com/android/intentresolver/profiles/ChooserMultiProfilePagerAdapter.java
@@ -27,7 +27,6 @@ import androidx.viewpager.widget.PagerAdapter;
import com.android.intentresolver.ChooserListAdapter;
import com.android.intentresolver.ChooserRecyclerViewAccessibilityDelegate;
-import com.android.intentresolver.FeatureFlags;
import com.android.intentresolver.R;
import com.android.intentresolver.emptystate.EmptyStateProvider;
import com.android.intentresolver.grid.ChooserGridAdapter;
@@ -56,8 +55,7 @@ public class ChooserMultiProfilePagerAdapter extends MultiProfilePagerAdapter<
@ProfileType int defaultProfile,
UserHandle workProfileUserHandle,
UserHandle cloneProfileUserHandle,
- int maxTargetsPerRow,
- FeatureFlags featureFlags) {
+ int maxTargetsPerRow) {
this(
context,
new ChooserProfileAdapterBinder(maxTargetsPerRow),
@@ -67,8 +65,7 @@ public class ChooserMultiProfilePagerAdapter extends MultiProfilePagerAdapter<
defaultProfile,
workProfileUserHandle,
cloneProfileUserHandle,
- new BottomPaddingOverrideSupplier(context),
- featureFlags);
+ new BottomPaddingOverrideSupplier(context));
}
private ChooserMultiProfilePagerAdapter(
@@ -80,10 +77,9 @@ public class ChooserMultiProfilePagerAdapter extends MultiProfilePagerAdapter<
@ProfileType int defaultProfile,
UserHandle workProfileUserHandle,
UserHandle cloneProfileUserHandle,
- BottomPaddingOverrideSupplier bottomPaddingOverrideSupplier,
- FeatureFlags featureFlags) {
+ BottomPaddingOverrideSupplier bottomPaddingOverrideSupplier) {
super(
- gridAdapter -> gridAdapter.getListAdapter(),
+ gridAdapter -> gridAdapter.getListAdapter(),
adapterBinder,
tabs,
emptyStateProvider,
@@ -91,7 +87,7 @@ public class ChooserMultiProfilePagerAdapter extends MultiProfilePagerAdapter<
defaultProfile,
workProfileUserHandle,
cloneProfileUserHandle,
- () -> makeProfileView(context, featureFlags),
+ () -> makeProfileView(context),
bottomPaddingOverrideSupplier);
mAdapterBinder = adapterBinder;
mBottomPaddingOverrideSupplier = bottomPaddingOverrideSupplier;
@@ -116,12 +112,10 @@ public class ChooserMultiProfilePagerAdapter extends MultiProfilePagerAdapter<
}
}
- private static ViewGroup makeProfileView(
- Context context, FeatureFlags featureFlags) {
+ private static ViewGroup makeProfileView(Context context) {
LayoutInflater inflater = LayoutInflater.from(context);
- ViewGroup rootView = featureFlags.scrollablePreview()
- ? (ViewGroup) inflater.inflate(R.layout.chooser_list_per_profile_wrap, null, false)
- : (ViewGroup) inflater.inflate(R.layout.chooser_list_per_profile, null, false);
+ ViewGroup rootView =
+ (ViewGroup) inflater.inflate(R.layout.chooser_list_per_profile_wrap, null, false);
RecyclerView recyclerView = rootView.findViewById(com.android.internal.R.id.resolver_list);
recyclerView.setAccessibilityDelegateCompat(
new ChooserRecyclerViewAccessibilityDelegate(recyclerView));
diff --git a/tests/activity/src/com/android/intentresolver/ChooserActivityTest.java b/tests/activity/src/com/android/intentresolver/ChooserActivityTest.java
index cfbb1c0b..66f7650d 100644
--- a/tests/activity/src/com/android/intentresolver/ChooserActivityTest.java
+++ b/tests/activity/src/com/android/intentresolver/ChooserActivityTest.java
@@ -88,7 +88,6 @@ import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Bundle;
import android.os.UserHandle;
-import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.provider.DeviceConfig;
@@ -2229,7 +2228,6 @@ public class ChooserActivityTest {
}
@Test
- @RequiresFlagsEnabled(Flags.FLAG_SCROLLABLE_PREVIEW)
public void testWorkTab_previewIsScrollable() {
markOtherProfileAvailability(/* workAvailable= */ true, /* cloneAvailable= */ false);
List<ResolvedComponentInfo> personalResolvedComponentInfos =
diff --git a/tests/unit/src/com/android/intentresolver/contentpreview/FileContentPreviewUiTest.kt b/tests/unit/src/com/android/intentresolver/contentpreview/FileContentPreviewUiTest.kt
index a540dfa2..25e8b239 100644
--- a/tests/unit/src/com/android/intentresolver/contentpreview/FileContentPreviewUiTest.kt
+++ b/tests/unit/src/com/android/intentresolver/contentpreview/FileContentPreviewUiTest.kt
@@ -61,7 +61,9 @@ class FileContentPreviewUiTest {
@Test
fun test_display_titleAndMetadataIsDisplayed() {
val layoutInflater = LayoutInflater.from(context)
- val gridLayout = layoutInflater.inflate(R.layout.chooser_grid, null, false) as ViewGroup
+ val gridLayout =
+ layoutInflater.inflate(R.layout.chooser_grid_scrollable_preview, null, false)
+ as ViewGroup
val previewView =
testSubject.display(
diff --git a/tests/unit/src/com/android/intentresolver/contentpreview/FilesPlusTextContentPreviewUiTest.kt b/tests/unit/src/com/android/intentresolver/contentpreview/FilesPlusTextContentPreviewUiTest.kt
index 259ffdac..bd0a8efa 100644
--- a/tests/unit/src/com/android/intentresolver/contentpreview/FilesPlusTextContentPreviewUiTest.kt
+++ b/tests/unit/src/com/android/intentresolver/contentpreview/FilesPlusTextContentPreviewUiTest.kt
@@ -284,7 +284,9 @@ class FilesPlusTextContentPreviewUiTest {
testMetadataText,
)
val layoutInflater = LayoutInflater.from(context)
- val gridLayout = layoutInflater.inflate(R.layout.chooser_grid, null, false) as ViewGroup
+ val gridLayout =
+ layoutInflater.inflate(R.layout.chooser_grid_scrollable_preview, null, false)
+ as ViewGroup
val previewView =
testSubject.display(context.resources, LayoutInflater.from(context), gridLayout, null)
@@ -373,7 +375,9 @@ class FilesPlusTextContentPreviewUiTest {
testMetadataText,
)
val layoutInflater = LayoutInflater.from(context)
- val gridLayout = layoutInflater.inflate(R.layout.chooser_grid, null, false) as ViewGroup
+ val gridLayout =
+ layoutInflater.inflate(R.layout.chooser_grid_scrollable_preview, null, false)
+ as ViewGroup
loadedFileMetadata?.let(testSubject::updatePreviewMetadata)
return testSubject.display(
diff --git a/tests/unit/src/com/android/intentresolver/contentpreview/TextContentPreviewUiTest.kt b/tests/unit/src/com/android/intentresolver/contentpreview/TextContentPreviewUiTest.kt
index 1c96070c..0416d71a 100644
--- a/tests/unit/src/com/android/intentresolver/contentpreview/TextContentPreviewUiTest.kt
+++ b/tests/unit/src/com/android/intentresolver/contentpreview/TextContentPreviewUiTest.kt
@@ -76,7 +76,9 @@ class TextContentPreviewUiTest {
@Test
fun test_display_headlineIsDisplayed() {
val layoutInflater = LayoutInflater.from(context)
- val gridLayout = layoutInflater.inflate(R.layout.chooser_grid, null, false) as ViewGroup
+ val gridLayout =
+ layoutInflater.inflate(R.layout.chooser_grid_scrollable_preview, null, false)
+ as ViewGroup
val previewView =
testSubject.display(
@@ -125,7 +127,9 @@ class TextContentPreviewUiTest {
@Test
fun test_display_albumHeadlineOverride() {
val layoutInflater = LayoutInflater.from(context)
- val gridLayout = layoutInflater.inflate(R.layout.chooser_grid, null, false) as ViewGroup
+ val gridLayout =
+ layoutInflater.inflate(R.layout.chooser_grid_scrollable_preview, null, false)
+ as ViewGroup
val albumSubject =
TextContentPreviewUi(
diff --git a/tests/unit/src/com/android/intentresolver/contentpreview/UnifiedContentPreviewUiTest.kt b/tests/unit/src/com/android/intentresolver/contentpreview/UnifiedContentPreviewUiTest.kt
index faeaf133..07575be0 100644
--- a/tests/unit/src/com/android/intentresolver/contentpreview/UnifiedContentPreviewUiTest.kt
+++ b/tests/unit/src/com/android/intentresolver/contentpreview/UnifiedContentPreviewUiTest.kt
@@ -276,7 +276,9 @@ class UnifiedContentPreviewUiTest {
testMetadataText,
)
val layoutInflater = LayoutInflater.from(context)
- val gridLayout = layoutInflater.inflate(R.layout.chooser_grid, null, false) as ViewGroup
+ val gridLayout =
+ layoutInflater.inflate(R.layout.chooser_grid_scrollable_preview, null, false)
+ as ViewGroup
val previewView =
testSubject.display(