Fixing bugs related to pausing of private space. am: e8cc1dbbd0
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/DocumentsUI/+/26224952
Change-Id: I5308a83897585b5f78765902b339a20865e34947
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/Android.bp b/Android.bp
index 598beb6..c4b9ad3 100644
--- a/Android.bp
+++ b/Android.bp
@@ -59,8 +59,6 @@
sdk_version: "system_current",
min_sdk_version: "29",
-
- lint: { strict_updatability_linting: true }
}
platform_compat_config {
@@ -68,39 +66,32 @@
src: ":DocumentsUI",
}
-filegroup {
- name: "DocumentsUI-srcs",
- srcs: [
- "src/**/*.java",
- ":statslog-docsui-java-gen",
- ],
-}
-
java_library {
name: "docsui-statsd",
srcs: [
":statslog-docsui-java-gen",
],
- lint: { strict_updatability_linting: true }
+ libs: [
+ "androidx.annotation_annotation",
+ ],
+ lint: {
+ strict_updatability_linting: true,
+ },
}
genrule {
name: "statslog-docsui-java-gen",
tools: ["stats-log-api-gen"],
cmd: "$(location stats-log-api-gen) --java $(out) --module docsui" +
- " --javaPackage com.android.documentsui --javaClass DocumentsStatsLog --minApiLevel 29",
+ " --javaPackage com.android.documentsui --javaClass DocumentsStatsLog --minApiLevel 29",
out: ["com/android/documentsui/DocumentsStatsLog.java"],
}
android_library {
- name: "DocumentsUI-res-lib",
+ name: "DocumentsUI-lib",
+ defaults: ["documentsui_defaults"],
- manifest: "AndroidManifest.xml",
-
- static_libs: [
- "androidx.appcompat_appcompat",
- "com.google.android.material_material",
- ],
+ manifest: "AndroidManifestLib.xml",
resource_dirs: [
"res",
@@ -110,40 +101,31 @@
"--auto-add-overlay",
],
+ srcs: [
+ "src/**/*.java",
+ ":statslog-docsui-java-gen",
+ ],
+
sdk_version: "system_current",
target_sdk_version: "33",
min_sdk_version: "29",
- lint: { strict_updatability_linting: true }
+ lint: {
+ baseline_filename: "lint-baseline.xml",
+ },
}
android_library {
- name: "DocumentsUIUnitTests-res-lib",
+ name: "DocumentsUIManifestLib",
+ defaults: ["documentsui_defaults"],
- manifest: "AndroidManifestForUnitTests.xml",
+ manifest: "AndroidManifest.xml",
- static_libs: [
- "androidx.appcompat_appcompat",
- "com.google.android.material_material",
- "modules-utils-build_system",
- ],
-
- resource_dirs: [
- "res",
- ],
-
- licenses: [
- "Android-Apache-2.0",
- "packages_apps_DocumentsUI_res_drawable_pd_license",
- ],
-
- aaptflags: [
- "--auto-add-overlay",
- ],
+ resource_dirs: [],
+ libs: ["DocumentsUI-lib"],
sdk_version: "system_current",
target_sdk_version: "33",
min_sdk_version: "29",
- lint: { strict_updatability_linting: true }
}
android_app {
@@ -153,13 +135,8 @@
manifest: "AndroidManifest.xml",
- srcs: [
- ":DocumentsUI-srcs",
- ],
-
- resource_dirs: [
- "res",
- ],
+ static_libs: ["DocumentsUI-lib"],
+ resource_dirs: [],
licenses: [
"Android-Apache-2.0",
@@ -170,6 +147,4 @@
min_sdk_version: "29",
updatable: true,
- lint: { strict_updatability_linting: true }
}
-
diff --git a/AndroidManifestForUnitTests.xml b/AndroidManifestLib.xml
similarity index 100%
rename from AndroidManifestForUnitTests.xml
rename to AndroidManifestLib.xml
diff --git a/lint-baseline.xml b/lint-baseline.xml
index c7db331..a89103e 100644
--- a/lint-baseline.xml
+++ b/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 8.0.0-dev" type="baseline" dependencies="true" variant="all" version="8.0.0-dev">
+<issues format="6" by="lint 8.4.0-alpha01" type="baseline" client="" dependencies="true" name="" variant="all" version="8.4.0-alpha01">
<issue
id="NewApi"
diff --git a/perf-tests/Android.bp b/perf-tests/Android.bp
index d98c36c..4cf6c65 100644
--- a/perf-tests/Android.bp
+++ b/perf-tests/Android.bp
@@ -8,7 +8,6 @@
manifest: "AndroidManifest.xml",
srcs: [
- ":DocumentsUIPerfTests-files",
"src/**/*.java",
],
@@ -23,6 +22,7 @@
],
static_libs: [
+ "DocumentsUIPerfTests-lib",
"androidx.legacy_legacy-support-v4",
"androidx.test.rules",
"androidx.test.espresso.core",
diff --git a/perf-tests/src/com/android/documentsui/FilesActivityPerfTest.java b/perf-tests/src/com/android/documentsui/FilesActivityPerfTest.java
index 33ef73e..f7c295d 100644
--- a/perf-tests/src/com/android/documentsui/FilesActivityPerfTest.java
+++ b/perf-tests/src/com/android/documentsui/FilesActivityPerfTest.java
@@ -24,12 +24,12 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
-import android.test.suitebuilder.annotation.LargeTest;
+
+import androidx.test.filters.LargeTest;
import com.android.documentsui.BaseActivity.EventListener;
import com.android.documentsui.base.RootInfo;
import com.android.documentsui.files.FilesActivity;
-import com.android.documentsui.ActivityTest;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/perf-tests/src/com/android/documentsui/FilesJankPerfTest.java b/perf-tests/src/com/android/documentsui/FilesJankPerfTest.java
index 6dd8044..8054c38 100644
--- a/perf-tests/src/com/android/documentsui/FilesJankPerfTest.java
+++ b/perf-tests/src/com/android/documentsui/FilesJankPerfTest.java
@@ -26,8 +26,8 @@
import android.support.test.jank.GfxMonitor;
import android.support.test.jank.JankTest;
import android.support.test.jank.JankTestBase;
-import android.test.suitebuilder.annotation.LargeTest;
+import androidx.test.filters.LargeTest;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiScrollable;
diff --git a/perfetto_config.pbtx b/perfetto_config.pbtx
new file mode 100644
index 0000000..7c5bfa1
--- /dev/null
+++ b/perfetto_config.pbtx
@@ -0,0 +1,222 @@
+buffers: {
+ size_kb: 63488
+ fill_policy: DISCARD
+}
+buffers: {
+ size_kb: 2048
+ fill_policy: DISCARD
+}
+# Max duration: 1 min
+duration_ms: 60000
+
+data_sources: {
+ config {
+ name: "linux.ftrace"
+
+ # See: https://perfetto.dev/docs/data-sources/atrace#traceconfig
+ ftrace_config {
+ ftrace_events: "ftrace/print"
+
+ # Trace all ContentProvider commands and SQLite queries.
+ # See: https://source.corp.google.com/android-internal/frameworks/base/core/java/android/os/Trace.java?q=TRACE_TAG_DATABASE
+ # See: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/database/sqlite/SQLiteConnection.java
+ # Uncomment to enable.
+ # Note: on a userdebug build it will add a trace for every SQLite command for every
+ # application, which makes traces very-very "noisy".
+ # atrace_categories: "database"
+
+ # Trace Binder IPC transactions.
+ # Uncomment to enable.
+ # Note: on a userdebug build it will add a trace for every Binder transaction for every
+ # application, which makes traces very-very "noisy".
+ # atrace_categories: "binder_driver"
+
+ # ActivityManager, WindowManager, Graphics, View System.
+ # Uncomment to enable.
+ # Note: on a userdebug build it will traces from corresponding category for every
+ # application, which makes traces very-very "noisy".
+ # atrace_categories: "wm"
+ # atrace_categories: "am"
+ atrace_categories: "gfx"
+ atrace_categories: "view"
+
+ # Trace DocumentUI "custom" events.
+ atrace_apps: "com.android.documentsui"
+ atrace_apps: "com.google.android.documentsui"
+
+ # Trace other Providers.
+
+ # authorities="com.android.documentsui.archives" - DocsUI
+ atrace_apps: "com.android.documentsui"
+ atrace_apps: "com.google.android.documentsui"
+
+ # authorities="com.android.externalstorage.documents" - ExternalStorageProvider
+ atrace_apps: "com.android.externalstorage"
+
+ # authorities="com.android.mtp.documents" - Mtp
+ atrace_apps: "com.android.mtp"
+
+ # authorities="com.android.pixellogger.documents" - PixelLogger
+ atrace_apps: "com.android.pixellogger"
+
+ # authorities="com.android.providers.downloads" - DownloadSProvider
+ atrace_apps: "com.android.providers.downloads.documents"
+
+ # authorities="com.android.providers.media.documents" - MediaProvider
+ atrace_apps: "com.android.providers.media.module"
+ atrace_apps: "com.google.android.providers.media.module"
+
+ # authorities="com.android.shell.documents" - Shell (BugreportStorageProvider)
+ # atrace_apps: "android.uid.shell"
+
+ # authorities="com.google.android.apps.docs.storage" - Google Docs
+ atrace_apps: "com.google.android.apps.docs"
+
+ # Google Photos.
+ # atrace_apps: "com.google.android.apps.photos"
+
+ # Trace all apps' events.
+ # Uncomment to enable.
+ # atrace_apps: "*"
+ }
+ }
+}
+
+# This is for getting Thread-to-Process associations and full process names.
+data_sources: {
+ config {
+ name: "linux.process_stats"
+ }
+}
+
+# "Expected Timeline" and "Actual Timeline" jor each process
+# See https://perfetto.dev/docs/data-sources/frametimeline#traceconfig
+data_sources {
+ config {
+ name: "android.surfaceflinger.frametimeline"
+ }
+}
+
+# Memory Profiling
+# See https://perfetto.dev/docs/data-sources/memory-counters
+
+# Android Logcat
+data_sources: {
+ config {
+ name: "android.log"
+ android_log_config {
+ min_prio: PRIO_VERBOSE # Default: PRIO_DEBUG
+
+ log_ids: LID_EVENTS
+ log_ids: LID_CRASH
+ log_ids: LID_KERNEL
+ log_ids: LID_DEFAULT
+ log_ids: LID_RADIO
+ log_ids: LID_SECURITY
+ log_ids: LID_STATS
+ log_ids: LID_SYSTEM
+
+ # If filter_tags non-empty ignores all log messages whose tag doesn't match one of the
+ # specified values.
+ # filter_tags: "AbstractActionHandler"
+ # filter_tags: "ActionModeController"
+ # filter_tags: "Archive"
+ # filter_tags: "ArchiveFileTestRule"
+ # filter_tags: "ArchiveHandle"
+ # filter_tags: "ArchivesProvider"
+ # filter_tags: "CancelFromNotificationUiTest"
+ # filter_tags: "ClipStorage"
+ # filter_tags: "CommandInterceptor"
+ # filter_tags: "CompressJob"
+ # filter_tags: "ConfirmFragment"
+ # filter_tags: "ContentLock"
+ # filter_tags: "CopyJob"
+ # filter_tags: "DebugHelper"
+ # filter_tags: "DeleteJob"
+ # filter_tags: "DirectoryFragment"
+ # filter_tags: "DirectoryLoader"
+ # filter_tags: "DirectoryResult"
+ # filter_tags: "DocumentAccess"
+ # filter_tags: "DocumentClipper"
+ # filter_tags: "DocumentInfo"
+ # filter_tags: "DocumentStack"
+ # filter_tags: "Documents"
+ # filter_tags: "DocumentsApplication"
+ # filter_tags: "DocumentsSwipeRefreshLayout"
+ # filter_tags: "DragStartListener"
+ # filter_tags: "DrawerController"
+ # filter_tags: "EjectRootTask"
+ # filter_tags: "FileCopyUiTest"
+ # filter_tags: "FileDeleteUiTest"
+ # filter_tags: "FileOperationService"
+ # filter_tags: "FileOperations"
+ # filter_tags: "FilesActivity"
+ # filter_tags: "FilesAppPerfTest"
+ # filter_tags: "FocusManager"
+ # filter_tags: "GetRootDocumentTask"
+ # filter_tags: "HeaderItem"
+ # filter_tags: "HeaderMessage"
+ # filter_tags: "IconHelper"
+ # filter_tags: "ItemDragListener"
+ # filter_tags: "Job"
+ # filter_tags: "JumboUrisSupplier"
+ # filter_tags: "LastAccessedProvider"
+ # filter_tags: "LastAccessedStorage"
+ # filter_tags: "LauncherActivity"
+ # filter_tags: "ListDocumentHolder"
+ # filter_tags: "LoadDocStackTask"
+ # filter_tags: "LoadRootTask"
+ # filter_tags: "Loader"
+ # filter_tags: "ManagerActionHandler"
+ # filter_tags: "MenuManager"
+ # filter_tags: "MetadataLoader"
+ # filter_tags: "Metrics"
+ # filter_tags: "Model"
+ # filter_tags: "ModelBackedDocuments"
+ # filter_tags: "MoveJob"
+ # filter_tags: "MultiRootDocsLoader"
+ # filter_tags: "NavigationViewManager"
+ # filter_tags: "OperationDialogFragment"
+ # filter_tags: "PermissionsTest"
+ # filter_tags: "PickActivity"
+ # filter_tags: "PickCountRecordProvider"
+ # filter_tags: "PickCountRecordStorage"
+ # filter_tags: "PickFragment"
+ # filter_tags: "PickerActionHandler"
+ # filter_tags: "PreBootReceiver"
+ # filter_tags: "ProfileTabsController"
+ # filter_tags: "ProvidersCache"
+ # filter_tags: "QuickViewIntentBuilder"
+ # filter_tags: "ReadableArchive"
+ # filter_tags: "RefreshTask"
+ # filter_tags: "ResolvedResourcesJob"
+ # filter_tags: "RootCursorWrapper"
+ # filter_tags: "RootInfo"
+ # filter_tags: "RootItem"
+ # filter_tags: "RootUiTest"
+ # filter_tags: "RootsDragHost"
+ # filter_tags: "RootsFragment"
+ # filter_tags: "RootsListBot"
+ # filter_tags: "SaveFragment"
+ # filter_tags: "ScaleHelper"
+ # filter_tags: "ScopedAccessMetrics"
+ # filter_tags: "SearchFragment"
+ # filter_tags: "SearchHistoryManager"
+ # filter_tags: "SearchManager"
+ # filter_tags: "SectioningDocumentsAdapterWrapper"
+ # filter_tags: "SelectionMetadata"
+ # filter_tags: "SharedInputHandler"
+ # filter_tags: "SortModel"
+ # filter_tags: "SpacerItem"
+ # filter_tags: "State"
+ # filter_tags: "StubProvider"
+ # filter_tags: "TestContextResolver"
+ # filter_tags: "TestNotificationService"
+ # filter_tags: "ThemeOverlayManager"
+ # filter_tags: "ThumbnailLoader"
+ # filter_tags: "UserIdManager"
+ # filter_tags: "WriteableArchive"
+ # filter_tags: "dirlist.DragHost"
+ }
+ }
+}
diff --git a/src/com/android/documentsui/ActionModeController.java b/src/com/android/documentsui/ActionModeController.java
index 89b8ff3..1bd4eea 100644
--- a/src/com/android/documentsui/ActionModeController.java
+++ b/src/com/android/documentsui/ActionModeController.java
@@ -79,7 +79,8 @@
Log.d(TAG, "Starting action mode.");
}
mActionMode = mActivity.startActionMode(this);
- final View closeButton = mActivity.findViewById(R.id.action_mode_close_button);
+ final View closeButton =
+ mActivity.findViewById(androidx.appcompat.R.id.action_mode_close_button);
if (closeButton != null) {
closeButton.setContentDescription(mActivity.getString(android.R.string.cancel));
}
diff --git a/src/com/android/documentsui/NavigationViewManager.java b/src/com/android/documentsui/NavigationViewManager.java
index cd19b65..c376c86 100644
--- a/src/com/android/documentsui/NavigationViewManager.java
+++ b/src/com/android/documentsui/NavigationViewManager.java
@@ -182,7 +182,8 @@
// move directory_header out of the AppBarLayout.
Window window = mActivity.getWindow();
- View actionBar = window.getDecorView().findViewById(R.id.action_mode_bar);
+ View actionBar =
+ window.getDecorView().findViewById(androidx.appcompat.R.id.action_mode_bar);
int dynamicHeaderColor = ContextCompat.getColor(mActivity,
offset == 0 ? mDefaultStatusBarColorResId : R.color.color_surface_header);
if (actionBar != null) {
diff --git a/src/com/android/documentsui/inspector/KeyValueRow.java b/src/com/android/documentsui/inspector/KeyValueRow.java
index 00ef819..349d017 100644
--- a/src/com/android/documentsui/inspector/KeyValueRow.java
+++ b/src/com/android/documentsui/inspector/KeyValueRow.java
@@ -98,9 +98,11 @@
public void setOnClickListener(OnClickListener callback) {
TextView clickable = ((TextView) findViewById(R.id.table_row_value));
mDefaultTextColor = clickable.getTextColors();
- TypedArray ta = getContext().obtainStyledAttributes(R.styleable.TextAppearance);
- int linkColor = ta.getColor(R.styleable.TextAppearance_android_textColorLink,
- mDefaultTextColor.getDefaultColor());
+ TypedArray ta =
+ getContext().obtainStyledAttributes(androidx.appcompat.R.styleable.TextAppearance);
+ int linkColor =
+ ta.getColor(androidx.appcompat.R.styleable.TextAppearance_android_textColorLink,
+ mDefaultTextColor.getDefaultColor());
ta.recycle();
clickable.setTextColor(linkColor);
clickable.setPaintFlags(clickable.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
diff --git a/src/com/android/documentsui/queries/SearchViewManager.java b/src/com/android/documentsui/queries/SearchViewManager.java
index b0c2987..053dc93 100644
--- a/src/com/android/documentsui/queries/SearchViewManager.java
+++ b/src/com/android/documentsui/queries/SearchViewManager.java
@@ -227,7 +227,7 @@
mSearchView.setOnCloseListener(this);
mSearchView.setOnSearchClickListener(this);
mSearchView.setOnQueryTextFocusChangeListener(this);
- final View clearButton = mSearchView.findViewById(R.id.search_close_btn);
+ final View clearButton = mSearchView.findViewById(androidx.appcompat.R.id.search_close_btn);
if (clearButton != null) {
clearButton.setPadding(clearButton.getPaddingStart() + getPixelForDp(4),
clearButton.getPaddingTop(), clearButton.getPaddingEnd() + getPixelForDp(4),
@@ -239,7 +239,7 @@
});
}
if (SdkLevel.isAtLeastU()) {
- final View textView = mSearchView.findViewById(R.id.search_src_text);
+ final View textView = mSearchView.findViewById(androidx.appcompat.R.id.search_src_text);
if (textView != null) {
try {
textView.setIsHandwritingDelegate(true);
diff --git a/src/com/android/documentsui/sorting/SortController.java b/src/com/android/documentsui/sorting/SortController.java
index ccfc3f1..4fc2844 100644
--- a/src/com/android/documentsui/sorting/SortController.java
+++ b/src/com/android/documentsui/sorting/SortController.java
@@ -16,11 +16,11 @@
package com.android.documentsui.sorting;
+import android.view.View;
+
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
-import android.view.View;
-
import com.android.documentsui.BaseActivity;
import com.android.documentsui.Injector;
import com.android.documentsui.MetricConsts;
@@ -67,19 +67,15 @@
final Injector<?> injector = ((BaseActivity)activity).getInjector();
sortModel.setMetricRecorder((SortDimension dimension) -> {
int sortType = MetricConsts.USER_ACTION_UNKNOWN;
- switch (dimension.getId()) {
- case SortModel.SORT_DIMENSION_ID_TITLE:
- sortType = MetricConsts.USER_ACTION_SORT_NAME;
- break;
- case SortModel.SORT_DIMENSION_ID_SIZE:
- sortType = MetricConsts.USER_ACTION_SORT_SIZE;
- break;
- case SortModel.SORT_DIMENSION_ID_DATE:
- sortType = MetricConsts.USER_ACTION_SORT_DATE;
- break;
- case SortModel.SORT_DIMENSION_ID_FILE_TYPE:
- sortType = MetricConsts.USER_ACTION_SORT_TYPE;
- break;
+ final int id = dimension.getId();
+ if (id == SortModel.SORT_DIMENSION_ID_TITLE) {
+ sortType = MetricConsts.USER_ACTION_SORT_NAME;
+ } else if (id == SortModel.SORT_DIMENSION_ID_SIZE) {
+ sortType = MetricConsts.USER_ACTION_SORT_SIZE;
+ } else if (id == SortModel.SORT_DIMENSION_ID_DATE) {
+ sortType = MetricConsts.USER_ACTION_SORT_DATE;
+ } else if (id == SortModel.SORT_DIMENSION_ID_FILE_TYPE) {
+ sortType = MetricConsts.USER_ACTION_SORT_TYPE;
}
Metrics.logUserAction(sortType);
diff --git a/src/com/android/documentsui/sorting/SortListFragment.java b/src/com/android/documentsui/sorting/SortListFragment.java
index 7c33c9d..8d4032c 100644
--- a/src/com/android/documentsui/sorting/SortListFragment.java
+++ b/src/com/android/documentsui/sorting/SortListFragment.java
@@ -20,7 +20,6 @@
import com.android.documentsui.R;
import com.android.documentsui.sorting.SortDimension.SortDirection;
-import com.android.documentsui.sorting.SortModel.SortDimensionId;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialog;
@@ -66,18 +65,15 @@
for (int i = 0; i < mModel.getSize(); ++i) {
SortDimension dimension = mModel.getDimensionAt(i);
if (dimension.getSortCapability() != SortDimension.SORT_CAPABILITY_NONE) {
- switch (dimension.getId()) {
- case SortModel.SORT_DIMENSION_ID_TITLE:
- case SortModel.SORT_DIMENSION_ID_FILE_TYPE:
- addBothDirectionDimension(dimension, true);
- break;
- case SortModel.SORT_DIMENSION_ID_DATE:
- case SortModel.SORT_DIMENSION_ID_SIZE:
- addBothDirectionDimension(dimension, false);
- break;
- default:
- mSortingList.add(new SortItem(dimension));
- break;
+ final int id = dimension.getId();
+ if (id == SortModel.SORT_DIMENSION_ID_TITLE
+ || id == SortModel.SORT_DIMENSION_ID_FILE_TYPE) {
+ addBothDirectionDimension(dimension, true);
+ } else if (id == SortModel.SORT_DIMENSION_ID_DATE
+ || id == SortModel.SORT_DIMENSION_ID_SIZE) {
+ addBothDirectionDimension(dimension, false);
+ } else {
+ mSortingList.add(new SortItem(dimension));
}
}
}
@@ -96,22 +92,21 @@
public static @StringRes int getSheetLabelId(SortDimension dimension, @SortDirection int direction) {
boolean isAscending = direction == SortDimension.SORT_DIRECTION_ASCENDING;
- switch (dimension.getId()) {
- case SortModel.SORT_DIMENSION_ID_TITLE:
- return isAscending ? R.string.sort_dimension_name_ascending :
- R.string.sort_dimension_name_descending;
- case SortModel.SORT_DIMENSION_ID_DATE:
- return isAscending ? R.string.sort_dimension_date_ascending :
- R.string.sort_dimension_date_descending;
- case SortModel.SORT_DIMENSION_ID_FILE_TYPE:
- return isAscending ? R.string.sort_dimension_file_type_ascending :
- R.string.sort_dimension_file_type_descending;
- case SortModel.SORT_DIMENSION_ID_SIZE:
- return isAscending ? R.string.sort_dimension_size_ascending :
- R.string.sort_dimension_size_descending;
- default:
- return dimension.getLabelId();
+ final int id = dimension.getId();
+ if (id == SortModel.SORT_DIMENSION_ID_TITLE) {
+ return isAscending ? R.string.sort_dimension_name_ascending :
+ R.string.sort_dimension_name_descending;
+ } else if (id == SortModel.SORT_DIMENSION_ID_DATE) {
+ return isAscending ? R.string.sort_dimension_date_ascending :
+ R.string.sort_dimension_date_descending;
+ } else if (id == SortModel.SORT_DIMENSION_ID_FILE_TYPE) {
+ return isAscending ? R.string.sort_dimension_file_type_ascending :
+ R.string.sort_dimension_file_type_descending;
+ } else if (id == SortModel.SORT_DIMENSION_ID_SIZE) {
+ return isAscending ? R.string.sort_dimension_size_ascending :
+ R.string.sort_dimension_size_descending;
}
+ return dimension.getLabelId();
}
@Override
@@ -170,7 +165,7 @@
private static class SortItem {
- @SortDimensionId final int id;
+ final int id;
@SortDirection final int direction;
@StringRes final int labelId;
@@ -180,7 +175,7 @@
labelId = dimension.getLabelId();
}
- SortItem(@SortDimensionId int id, @SortDirection int direction, @StringRes int labelId) {
+ SortItem(int id, @SortDirection int direction, @StringRes int labelId) {
this.id = id;
this.direction = direction;
this.labelId = labelId;
diff --git a/src/com/android/documentsui/sorting/SortModel.java b/src/com/android/documentsui/sorting/SortModel.java
index 4e544a9..9bf5b96 100644
--- a/src/com/android/documentsui/sorting/SortModel.java
+++ b/src/com/android/documentsui/sorting/SortModel.java
@@ -47,16 +47,6 @@
* Sort model that contains all columns and their sorting state.
*/
public class SortModel implements Parcelable {
- @IntDef({
- SORT_DIMENSION_ID_UNKNOWN,
- SORT_DIMENSION_ID_TITLE,
- SORT_DIMENSION_ID_SUMMARY,
- SORT_DIMENSION_ID_SIZE,
- SORT_DIMENSION_ID_FILE_TYPE,
- SORT_DIMENSION_ID_DATE
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface SortDimensionId {}
public static final int SORT_DIMENSION_ID_UNKNOWN = 0;
public static final int SORT_DIMENSION_ID_TITLE = android.R.id.title;
public static final int SORT_DIMENSION_ID_SUMMARY = android.R.id.summary;
@@ -239,32 +229,28 @@
// should only be called when R.bool.feature_content_paging is true
final int id = getSortedDimensionId();
- switch (id) {
- case SORT_DIMENSION_ID_UNKNOWN:
- return;
- case SortModel.SORT_DIMENSION_ID_TITLE:
- queryArgs.putStringArray(
- ContentResolver.QUERY_ARG_SORT_COLUMNS,
- new String[]{ Document.COLUMN_DISPLAY_NAME });
- break;
- case SortModel.SORT_DIMENSION_ID_DATE:
- queryArgs.putStringArray(
- ContentResolver.QUERY_ARG_SORT_COLUMNS,
- new String[]{ Document.COLUMN_LAST_MODIFIED });
- break;
- case SortModel.SORT_DIMENSION_ID_SIZE:
- queryArgs.putStringArray(
- ContentResolver.QUERY_ARG_SORT_COLUMNS,
- new String[]{ Document.COLUMN_SIZE });
- break;
- case SortModel.SORT_DIMENSION_ID_FILE_TYPE:
- // Unfortunately sorting by mime type is pretty much guaranteed different from
- // sorting by user-friendly type, so there is no point to guide the provider to sort
- // in a particular order.
- return;
- default:
- throw new IllegalStateException(
- "Unexpected sort dimension id: " + id);
+ if (id == SORT_DIMENSION_ID_UNKNOWN) {
+ return;
+ } else if (id == SortModel.SORT_DIMENSION_ID_TITLE) {
+ queryArgs.putStringArray(
+ ContentResolver.QUERY_ARG_SORT_COLUMNS,
+ new String[]{Document.COLUMN_DISPLAY_NAME});
+ } else if (id == SortModel.SORT_DIMENSION_ID_DATE) {
+ queryArgs.putStringArray(
+ ContentResolver.QUERY_ARG_SORT_COLUMNS,
+ new String[]{Document.COLUMN_LAST_MODIFIED});
+ } else if (id == SortModel.SORT_DIMENSION_ID_SIZE) {
+ queryArgs.putStringArray(
+ ContentResolver.QUERY_ARG_SORT_COLUMNS,
+ new String[]{Document.COLUMN_SIZE});
+ } else if (id == SortModel.SORT_DIMENSION_ID_FILE_TYPE) {
+ // Unfortunately sorting by mime type is pretty much guaranteed different from
+ // sorting by user-friendly type, so there is no point to guide the provider to sort
+ // in a particular order.
+ return;
+ } else {
+ throw new IllegalStateException(
+ "Unexpected sort dimension id: " + id);
}
final SortDimension dimension = getDimensionById(id);
@@ -296,26 +282,22 @@
final int id = getSortedDimensionId();
final String columnName;
- switch (id) {
- case SORT_DIMENSION_ID_UNKNOWN:
- return null;
- case SortModel.SORT_DIMENSION_ID_TITLE:
- columnName = Document.COLUMN_DISPLAY_NAME;
- break;
- case SortModel.SORT_DIMENSION_ID_DATE:
- columnName = Document.COLUMN_LAST_MODIFIED;
- break;
- case SortModel.SORT_DIMENSION_ID_SIZE:
- columnName = Document.COLUMN_SIZE;
- break;
- case SortModel.SORT_DIMENSION_ID_FILE_TYPE:
- // Unfortunately sorting by mime type is pretty much guaranteed different from
- // sorting by user-friendly type, so there is no point to guide the provider to sort
- // in a particular order.
- return null;
- default:
- throw new IllegalStateException(
- "Unexpected sort dimension id: " + id);
+ if (id == SORT_DIMENSION_ID_UNKNOWN) {
+ return null;
+ } else if (id == SortModel.SORT_DIMENSION_ID_TITLE) {
+ columnName = Document.COLUMN_DISPLAY_NAME;
+ } else if (id == SortModel.SORT_DIMENSION_ID_DATE) {
+ columnName = Document.COLUMN_LAST_MODIFIED;
+ } else if (id == SortModel.SORT_DIMENSION_ID_SIZE) {
+ columnName = Document.COLUMN_SIZE;
+ } else if (id == SortModel.SORT_DIMENSION_ID_FILE_TYPE) {
+ // Unfortunately sorting by mime type is pretty much guaranteed different from
+ // sorting by user-friendly type, so there is no point to guide the provider to sort
+ // in a particular order.
+ return null;
+ } else {
+ throw new IllegalStateException(
+ "Unexpected sort dimension id: " + id);
}
final SortDimension dimension = getDimensionById(id);
diff --git a/src/com/android/documentsui/sorting/SortingCursorWrapper.java b/src/com/android/documentsui/sorting/SortingCursorWrapper.java
index d8c686c..1e359a3 100644
--- a/src/com/android/documentsui/sorting/SortingCursorWrapper.java
+++ b/src/com/android/documentsui/sorting/SortingCursorWrapper.java
@@ -27,7 +27,6 @@
import com.android.documentsui.base.Lookup;
import com.android.documentsui.base.Shared;
-import com.android.documentsui.sorting.SortModel.SortDimensionId;
/**
* Cursor wrapper that presents a sorted view of the underlying cursor. Handles
@@ -49,16 +48,13 @@
long[] longValues = null;
String[] ids = new String[count];
- final @SortDimensionId int id = dimension.getId();
- switch (id) {
- case SortModel.SORT_DIMENSION_ID_TITLE:
- case SortModel.SORT_DIMENSION_ID_FILE_TYPE:
- stringValues = new String[count];
- break;
- case SortModel.SORT_DIMENSION_ID_DATE:
- case SortModel.SORT_DIMENSION_ID_SIZE:
- longValues = new long[count];
- break;
+ final int id = dimension.getId();
+ if (id == SortModel.SORT_DIMENSION_ID_TITLE
+ || id == SortModel.SORT_DIMENSION_ID_FILE_TYPE) {
+ stringValues = new String[count];
+ } else if (id == SortModel.SORT_DIMENSION_ID_DATE
+ || id == SortModel.SORT_DIMENSION_ID_SIZE) {
+ longValues = new long[count];
}
cursor.moveToPosition(-1);
@@ -70,34 +66,26 @@
isDirs[i] = Document.MIME_TYPE_DIR.equals(mimeType);
ids[i] = getCursorString(mCursor, Document.COLUMN_DOCUMENT_ID);
- switch(id) {
- case SortModel.SORT_DIMENSION_ID_TITLE:
- final String displayName = getCursorString(
- mCursor, Document.COLUMN_DISPLAY_NAME);
- stringValues[i] = displayName;
- break;
- case SortModel.SORT_DIMENSION_ID_FILE_TYPE:
- stringValues[i] = fileTypeLookup.lookup(mimeType);
- break;
- case SortModel.SORT_DIMENSION_ID_DATE:
- longValues[i] = getLastModified(mCursor);
- break;
- case SortModel.SORT_DIMENSION_ID_SIZE:
- longValues[i] = getCursorLong(mCursor, Document.COLUMN_SIZE);
- break;
+ if (id == SortModel.SORT_DIMENSION_ID_TITLE) {
+ final String displayName = getCursorString(
+ mCursor, Document.COLUMN_DISPLAY_NAME);
+ stringValues[i] = displayName;
+ } else if (id == SortModel.SORT_DIMENSION_ID_FILE_TYPE) {
+ stringValues[i] = fileTypeLookup.lookup(mimeType);
+ } else if (id == SortModel.SORT_DIMENSION_ID_DATE) {
+ longValues[i] = getLastModified(mCursor);
+ } else if (id == SortModel.SORT_DIMENSION_ID_SIZE) {
+ longValues[i] = getCursorLong(mCursor, Document.COLUMN_SIZE);
}
}
- switch (id) {
- case SortModel.SORT_DIMENSION_ID_TITLE:
- case SortModel.SORT_DIMENSION_ID_FILE_TYPE:
- binarySort(stringValues, isDirs, mPosition, ids, dimension.getSortDirection());
- break;
- case SortModel.SORT_DIMENSION_ID_DATE:
- case SortModel.SORT_DIMENSION_ID_SIZE:
- binarySort(longValues, isDirs, mPosition, ids, dimension.getSortDirection());
- break;
+ if (id == SortModel.SORT_DIMENSION_ID_TITLE
+ || id == SortModel.SORT_DIMENSION_ID_FILE_TYPE) {
+ binarySort(stringValues, isDirs, mPosition, ids, dimension.getSortDirection());
+ } else if (id == SortModel.SORT_DIMENSION_ID_DATE
+ || id == SortModel.SORT_DIMENSION_ID_SIZE) {
+ binarySort(longValues, isDirs, mPosition, ids, dimension.getSortDirection());
}
}
diff --git a/src/com/android/documentsui/sorting/TableHeaderController.java b/src/com/android/documentsui/sorting/TableHeaderController.java
index f3853c0..549478c 100644
--- a/src/com/android/documentsui/sorting/TableHeaderController.java
+++ b/src/com/android/documentsui/sorting/TableHeaderController.java
@@ -19,7 +19,6 @@
import android.view.View;
import com.android.documentsui.R;
-import com.android.documentsui.sorting.SortModel.SortDimensionId;
import javax.annotation.Nullable;
@@ -78,7 +77,7 @@
mModel.removeListener(mModelListener);
}
- private void bindCell(HeaderCell cell, @SortDimensionId int id) {
+ private void bindCell(HeaderCell cell, int id) {
assert(cell != null);
SortDimension dimension = mModel.getDimensionById(id);
diff --git a/tests/Android.bp b/tests/Android.bp
index 65a4bbd..334901d 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -16,35 +16,79 @@
default_applicable_licenses: ["Android-Apache-2.0"],
}
-filegroup {
- name: "DocumentsUIPerfTests-files",
+java_defaults {
+ name: "DocumentsUITests-defaults",
+ libs: [
+ "android.test.base",
+ "android.test.mock",
+ "android.test.runner",
+ ],
+
+ static_libs: [
+ "DocumentsUI-lib",
+ "androidx.test.rules",
+ "androidx.test.espresso.core",
+ "androidx.test.ext.truth",
+ "guava",
+ "mockito-target",
+ "androidx.test.uiautomator_uiautomator",
+ ],
+}
+
+android_library {
+ name: "DocumentsUIPerfTests-lib",
srcs: [
"common/com/android/documentsui/**/*.java",
"functional/com/android/documentsui/ActivityTest.java",
],
+ resource_dirs: [],
+ libs: [
+ "android.test.base",
+ "android.test.mock",
+ "android.test.runner",
+ "DocumentsUI-lib",
+ ],
+
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "androidx.test.rules",
+ "androidx.test.espresso.core",
+ "mockito-target",
+ "ub-janktesthelper",
+ "androidx.test.uiautomator_uiautomator",
+ ],
}
-filegroup {
- name: "DocumentsUITests-srcs",
+android_library {
+ name: "DocumentsUIUnitTests-lib",
+ defaults: ["DocumentsUITests-defaults"],
+
+ manifest: "AndroidManifestUnitTests.xml",
+
+ srcs: [
+ "common/**/*.java",
+ "unit/**/*.java",
+ ],
+
+ resource_dirs: [
+ "res",
+ ],
+
+ min_sdk_version: "29",
+ target_sdk_version: "29",
+}
+
+android_library {
+ name: "DocumentsUITests-lib",
+ defaults: ["DocumentsUITests-defaults"],
+
+ manifest: "AndroidManifest.xml",
+
srcs: [
"common/**/*.java",
"functional/**/*.java",
"unit/**/*.java",
],
-}
-
-filegroup {
- name: "DocumentsUIUnitTests-srcs",
- srcs: [
- "common/**/*.java",
- "unit/**/*.java",
- ],
-}
-
-android_library {
- name: "DocumentsUITests-res-lib",
-
- manifest: "AndroidManifest.xml",
asset_dirs: [
"assets",
@@ -57,45 +101,25 @@
aaptflags: [
// pack some raw file locate in assets folder
"-0 .zip",
- "--auto-add-overlay",
],
- min_sdk_version : "29",
- target_sdk_version : "29",
+ min_sdk_version: "29",
+ target_sdk_version: "29",
+ lint: {
+ baseline_filename: "lint-baseline.xml",
+ },
}
android_test {
name: "DocumentsUITests",
+ defaults: ["DocumentsUITests-defaults"],
manifest: "AndroidManifest.xml",
- srcs: [
- "common/**/*.java",
- "functional/**/*.java",
- "unit/**/*.java",
- ],
-
- resource_dirs: [
- "res",
- ],
-
- aaptflags: [
- "-0 .zip",
- ],
-
- libs: [
- "android.test.base",
- "android.test.mock",
- "android.test.runner",
- ],
+ resource_dirs: [],
static_libs: [
- "androidx.test.rules",
- "androidx.test.espresso.core",
- "androidx.test.ext.truth",
- "guava",
- "mockito-target",
- "androidx.test.uiautomator_uiautomator",
+ "DocumentsUITests-lib",
],
jarjar_rules: "jarjar-rules.txt",
@@ -110,6 +134,6 @@
certificate: "platform",
instrumentation_for: "DocumentsUI",
- min_sdk_version : "29",
- target_sdk_version : "29",
+ min_sdk_version: "29",
+ target_sdk_version: "29",
}
diff --git a/tests/AndroidManifestUnitTests.xml b/tests/AndroidManifestUnitTests.xml
new file mode 100644
index 0000000..13d7a08
--- /dev/null
+++ b/tests/AndroidManifestUnitTests.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.documentsui.tests">
+
+</manifest>
diff --git a/tests/common/com/android/documentsui/bots/SearchBot.java b/tests/common/com/android/documentsui/bots/SearchBot.java
index 51f9394..bde74ca 100644
--- a/tests/common/com/android/documentsui/bots/SearchBot.java
+++ b/tests/common/com/android/documentsui/bots/SearchBot.java
@@ -33,12 +33,13 @@
import android.content.Context;
import android.view.View;
-import androidx.recyclerview.R;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject;
import androidx.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.UiSelector;
+import com.android.documentsui.R;
+
import org.hamcrest.Matcher;
/**
@@ -60,7 +61,7 @@
// require this input be not clickable.
@SuppressWarnings("unchecked")
private static final Matcher<View> SEARCH_INPUT = allOf(
- withId(R.id.search_src_text),
+ withId(androidx.appcompat.R.id.search_src_text),
isDisplayed());
public SearchBot(UiDevice device, Context context, int timeout) {
diff --git a/tests/common/com/android/documentsui/bots/SortBot.java b/tests/common/com/android/documentsui/bots/SortBot.java
index 74493ca..0a77de4 100644
--- a/tests/common/com/android/documentsui/bots/SortBot.java
+++ b/tests/common/com/android/documentsui/bots/SortBot.java
@@ -45,7 +45,6 @@
import com.android.documentsui.sorting.SortDimension.SortDirection;
import com.android.documentsui.sorting.SortListFragment;
import com.android.documentsui.sorting.SortModel;
-import com.android.documentsui.sorting.SortModel.SortDimensionId;
import org.hamcrest.Matcher;
@@ -67,7 +66,7 @@
mUiBot = uiBot;
}
- public void sortBy(@SortDimensionId int id, @SortDirection int direction) {
+ public void sortBy(int id, @SortDirection int direction) {
assert(direction != SortDimension.SORT_DIRECTION_NONE);
final @StringRes int labelId = mSortModel.getDimensionById(id).getLabelId();
@@ -102,7 +101,7 @@
assertTrue(Matchers.present(mColumnBot.MATCHER));
}
- private boolean sortByMenu(@SortDimensionId int id, @SortDirection int direction) {
+ private boolean sortByMenu(int id, @SortDirection int direction) {
assert(direction != SortDimension.SORT_DIRECTION_NONE);
clickMenuSort();
diff --git a/tests/functional/com/android/documentsui/FilesActivityDefaultsUiTest.java b/tests/functional/com/android/documentsui/FilesActivityDefaultsUiTest.java
index b8ef8d6..a33cca3 100644
--- a/tests/functional/com/android/documentsui/FilesActivityDefaultsUiTest.java
+++ b/tests/functional/com/android/documentsui/FilesActivityDefaultsUiTest.java
@@ -21,7 +21,6 @@
import android.os.RemoteException;
-import androidx.recyclerview.R;
import androidx.test.filters.LargeTest;
import com.android.documentsui.base.RootInfo;
diff --git a/tests/functional/com/android/documentsui/SearchViewUiTest.java b/tests/functional/com/android/documentsui/SearchViewUiTest.java
index 04ea87a..78ce44a 100644
--- a/tests/functional/com/android/documentsui/SearchViewUiTest.java
+++ b/tests/functional/com/android/documentsui/SearchViewUiTest.java
@@ -19,7 +19,6 @@
import static com.android.documentsui.StubProvider.ROOT_0_ID;
import static com.android.documentsui.StubProvider.ROOT_1_ID;
-import androidx.recyclerview.R;
import androidx.test.filters.LargeTest;
import androidx.test.filters.Suppress;
diff --git a/tests/functional/com/android/documentsui/archives/WriteableArchiveTest.java b/tests/functional/com/android/documentsui/archives/WriteableArchiveTest.java
index 7092d12..da470da 100644
--- a/tests/functional/com/android/documentsui/archives/WriteableArchiveTest.java
+++ b/tests/functional/com/android/documentsui/archives/WriteableArchiveTest.java
@@ -21,9 +21,9 @@
import android.os.ParcelFileDescriptor;
import android.provider.DocumentsContract.Document;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
import java.io.File;
import java.io.IOException;
diff --git a/tests/functional/com/android/documentsui/inspector/DocumentLoaderTest.java b/tests/functional/com/android/documentsui/inspector/DocumentLoaderTest.java
index 8a2b21f..ac417c9 100644
--- a/tests/functional/com/android/documentsui/inspector/DocumentLoaderTest.java
+++ b/tests/functional/com/android/documentsui/inspector/DocumentLoaderTest.java
@@ -25,8 +25,8 @@
import android.os.Bundle;
import android.os.Looper;
import android.provider.DocumentsContract;
-import android.test.suitebuilder.annotation.MediumTest;
+import androidx.test.filters.MediumTest;
import androidx.test.rule.provider.ProviderTestRule;
import com.android.documentsui.InspectorProvider;
diff --git a/tests/functional/com/android/documentsui/services/AbstractCopyJobTest.java b/tests/functional/com/android/documentsui/services/AbstractCopyJobTest.java
index 7b2cb82..525397b 100644
--- a/tests/functional/com/android/documentsui/services/AbstractCopyJobTest.java
+++ b/tests/functional/com/android/documentsui/services/AbstractCopyJobTest.java
@@ -23,9 +23,10 @@
import android.app.Notification;
import android.net.Uri;
import android.provider.DocumentsContract;
-import android.test.suitebuilder.annotation.MediumTest;
import android.text.format.DateUtils;
+import androidx.test.filters.MediumTest;
+
import com.android.documentsui.R;
import com.android.documentsui.base.DocumentInfo;
import com.android.documentsui.services.FileOperationService.OpType;
diff --git a/tests/lint-baseline.xml b/tests/lint-baseline.xml
new file mode 100644
index 0000000..ed87eb9
--- /dev/null
+++ b/tests/lint-baseline.xml
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<issues format="6" by="lint 8.4.0-alpha01" type="baseline" client="" dependencies="true" name="" variant="all" version="8.4.0-alpha01">
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayManager#getOverlayInfosForTarget`"
+ errorLine1=" when(mOverlayManager.getOverlayInfosForTarget(getEnabledTargetPackageId(),"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="85"
+ column="30"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayManager#getOverlayInfosForTarget`"
+ errorLine1=" when(mOverlayManager.getOverlayInfosForTarget(getDisabledTargetPackageId(),"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="89"
+ column="30"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayManager#setEnabled`"
+ errorLine1=" verify(mOverlayManager, times(1)).setEnabled(getOverlayPackageId(), enabled,"
+ errorLine2=" ~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="104"
+ column="43"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayManager#getOverlayInfosForTarget`"
+ errorLine1=" verify(mOverlayManager, times(1)).getOverlayInfosForTarget(getEnabledTargetPackageId(),"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="116"
+ column="43"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayManager#setEnabled`"
+ errorLine1=" verify(mOverlayManager, never()).setEnabled(getOverlayPackageId(), enabled,"
+ errorLine2=" ~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="129"
+ column="42"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayManager#getOverlayInfosForTarget`"
+ errorLine1=" assertThat(mOverlayManager.getOverlayInfosForTarget(getDisabledTargetPackageId(),"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="137"
+ column="36"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayInfo#isEnabled`"
+ errorLine1=" mUserHandle).get(0).isEnabled()).isEqualTo(!enabled);"
+ errorLine2=" ~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="138"
+ column="37"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayManager#setEnabled`"
+ errorLine1=" verify(mOverlayManager, times(1)).setEnabled(getOverlayPackageId(), enabled,"
+ errorLine2=" ~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="146"
+ column="43"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayManager#getOverlayInfosForTarget`"
+ errorLine1=" assertThat(mOverlayManager.getOverlayInfosForTarget(getEnabledTargetPackageId(),"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="154"
+ column="36"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayInfo#isEnabled`"
+ errorLine1=" mUserHandle).get(0).isEnabled()).isEqualTo(!enabled);"
+ errorLine2=" ~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="155"
+ column="37"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayManager#setEnabled`"
+ errorLine1=" verify(mOverlayManager, times(1)).setEnabled(getOverlayPackageId(), enabled,"
+ errorLine2=" ~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="163"
+ column="43"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `android.content.om.OverlayManager#getOverlayInfosForTarget`"
+ errorLine1=" mOverlayManager.getOverlayInfosForTarget(getEnabledTargetPackageId(),"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="192"
+ column="33"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 34 (current min is 29): `new android.content.om.OverlayInfo`"
+ errorLine1=' return new OverlayInfo(packageName, targetPackageName, null, null, "",'
+ errorLine2=" ~~~~~~~~~~~~~~~">
+ <location
+ file="packages/apps/DocumentsUI/tests/functional/com/android/documentsui/ThemeOverlayManagerTest.java"
+ line="211"
+ column="16"/>
+ </issue>
+
+</issues>
\ No newline at end of file
diff --git a/tests/unit/com/android/documentsui/FocusManagerTest.java b/tests/unit/com/android/documentsui/FocusManagerTest.java
index 67e7000..36637f3 100644
--- a/tests/unit/com/android/documentsui/FocusManagerTest.java
+++ b/tests/unit/com/android/documentsui/FocusManagerTest.java
@@ -17,10 +17,10 @@
package com.android.documentsui;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
import androidx.recyclerview.selection.SelectionTracker;
import androidx.recyclerview.widget.RecyclerView;
+import androidx.test.filters.SmallTest;
import com.android.documentsui.base.UserId;
import com.android.documentsui.dirlist.TestData;
diff --git a/tests/unit/com/android/documentsui/base/DocumentInfoTest.java b/tests/unit/com/android/documentsui/base/DocumentInfoTest.java
index eba30d2..4e73333 100644
--- a/tests/unit/com/android/documentsui/base/DocumentInfoTest.java
+++ b/tests/unit/com/android/documentsui/base/DocumentInfoTest.java
@@ -28,8 +28,8 @@
import android.net.Uri;
import android.provider.DocumentsContract;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import androidx.test.filters.SmallTest;
import androidx.test.rule.provider.ProviderTestRule;
import com.android.documentsui.InspectorProvider;
diff --git a/tests/unit/com/android/documentsui/dirlist/AccessibilityTest.java b/tests/unit/com/android/documentsui/dirlist/AccessibilityTest.java
index 4334608..09b1933 100644
--- a/tests/unit/com/android/documentsui/dirlist/AccessibilityTest.java
+++ b/tests/unit/com/android/documentsui/dirlist/AccessibilityTest.java
@@ -18,12 +18,12 @@
import android.database.Cursor;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
import android.view.View;
import android.widget.Space;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.recyclerview.widget.RecyclerView;
+import androidx.test.filters.SmallTest;
import com.android.documentsui.TestConfigStore;
import com.android.documentsui.testing.TestRecyclerView;
diff --git a/tests/unit/com/android/documentsui/inspector/GpsCoordinatesTextClassifierTest.java b/tests/unit/com/android/documentsui/inspector/GpsCoordinatesTextClassifierTest.java
index e25d227..f4e0422 100644
--- a/tests/unit/com/android/documentsui/inspector/GpsCoordinatesTextClassifierTest.java
+++ b/tests/unit/com/android/documentsui/inspector/GpsCoordinatesTextClassifierTest.java
@@ -20,12 +20,12 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.LocaleList;
-import android.test.suitebuilder.annotation.SmallTest;
import android.view.textclassifier.TextClassification;
import android.view.textclassifier.TextClassificationManager;
import android.view.textclassifier.TextClassifier;
import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import com.android.documentsui.testing.TestPackageManager;
diff --git a/tests/unit/com/android/documentsui/inspector/HeaderTextSelectorTest.java b/tests/unit/com/android/documentsui/inspector/HeaderTextSelectorTest.java
index 30178ce..28bc667 100644
--- a/tests/unit/com/android/documentsui/inspector/HeaderTextSelectorTest.java
+++ b/tests/unit/com/android/documentsui/inspector/HeaderTextSelectorTest.java
@@ -19,12 +19,12 @@
import static junit.framework.Assert.assertTrue;
import android.content.Context;
-import android.test.suitebuilder.annotation.SmallTest;
import android.text.Spannable;
import android.text.SpannableString;
import android.widget.TextView;
import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import com.android.documentsui.inspector.HeaderTextSelector.Selector;
diff --git a/tests/unit/com/android/documentsui/inspector/InspectorControllerTest.java b/tests/unit/com/android/documentsui/inspector/InspectorControllerTest.java
index 9a7bad5..f3d5b59 100644
--- a/tests/unit/com/android/documentsui/inspector/InspectorControllerTest.java
+++ b/tests/unit/com/android/documentsui/inspector/InspectorControllerTest.java
@@ -29,10 +29,10 @@
import android.os.UserHandle;
import android.provider.DocumentsContract;
import android.provider.DocumentsContract.Document;
-import android.test.suitebuilder.annotation.SmallTest;
import android.view.View.OnClickListener;
import androidx.annotation.Nullable;
+import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import com.android.documentsui.InspectorProvider;
diff --git a/tests/unit/com/android/documentsui/inspector/MediaViewTest.java b/tests/unit/com/android/documentsui/inspector/MediaViewTest.java
index 80c3c47..db87e42 100644
--- a/tests/unit/com/android/documentsui/inspector/MediaViewTest.java
+++ b/tests/unit/com/android/documentsui/inspector/MediaViewTest.java
@@ -19,8 +19,8 @@
import android.media.MediaMetadata;
import android.os.Bundle;
import android.provider.DocumentsContract;
-import android.test.suitebuilder.annotation.SmallTest;
+import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import com.android.documentsui.R;
diff --git a/tests/unit/com/android/documentsui/roots/ProvidersAccessTest.java b/tests/unit/com/android/documentsui/roots/ProvidersAccessTest.java
index cab6641..255c1cb 100644
--- a/tests/unit/com/android/documentsui/roots/ProvidersAccessTest.java
+++ b/tests/unit/com/android/documentsui/roots/ProvidersAccessTest.java
@@ -21,9 +21,9 @@
import android.provider.DocumentsContract;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
import androidx.annotation.Nullable;
+import androidx.test.filters.SmallTest;
import com.android.documentsui.base.Providers;
import com.android.documentsui.base.RootInfo;
diff --git a/tests/unit/com/android/documentsui/sorting/SortingCursorWrapperTest.java b/tests/unit/com/android/documentsui/sorting/SortingCursorWrapperTest.java
index e323dc8..72ad1b7 100644
--- a/tests/unit/com/android/documentsui/sorting/SortingCursorWrapperTest.java
+++ b/tests/unit/com/android/documentsui/sorting/SortingCursorWrapperTest.java
@@ -34,7 +34,6 @@
import com.android.documentsui.base.DocumentInfo;
import com.android.documentsui.base.Shared;
import com.android.documentsui.roots.RootCursorWrapper;
-import com.android.documentsui.sorting.SortModel.SortDimensionId;
import com.android.documentsui.testing.SortModels;
import com.android.documentsui.testing.TestFileTypeLookup;
@@ -497,7 +496,7 @@
}
private Cursor createSortingCursorWrapper(Cursor c) {
- final @SortDimensionId int id = sortModel.getSortedDimensionId();
+ final int id = sortModel.getSortedDimensionId();
return new SortingCursorWrapper(c, sortModel.getDimensionById(id), fileTypeLookup);
}
}
diff --git a/trace.sh b/trace.sh
new file mode 100755
index 0000000..573d923
--- /dev/null
+++ b/trace.sh
@@ -0,0 +1,3 @@
+$ANDROID_BUILD_TOP/external/perfetto/tools/record_android_trace \
+ -c $ANDROID_BUILD_TOP/packages/apps/DocumentsUI/perfetto_config.pbtx \
+ -o /tmp/perfetto-traces/docsui-$(date +"%d-%m-%Y_%H-%M-%S").perfetto-trace