Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc726992 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6445537 from 8de16326 to rvc-release

Change-Id: I7ddc2d6121454476114959bcaaa6f729b55ddfe9
parents a1774f37 8de16326
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -76,6 +76,11 @@
           android:title="@string/menu_inspect"
           android:visible="false"
           app:showAsAction="never"/>
        <item
            android:id="@+id/option_menu_show_hidden_files"
            android:title="@string/menu_show_hidden_files"
            android:visible="false"
            app:showAsAction="never"/>
        <item
            android:id="@+id/option_menu_launcher"
            android:visible="false"
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@
    <!-- Indicates if showing as search bar design -->
    <bool name="show_search_bar">false</bool>

    <!-- Indicates if showing hidden files by default -->
    <bool name="show_hidden_files_by_default">false</bool>

    <string name="default_root_uri" translatable="false">content://com.android.providers.downloads.documents/root/downloads</string>
    <!-- The value is used in sorting process on Drawer menu. If the root's package name
     start with it, the item will have higher order than others.-->
+4 −0
Original line number Diff line number Diff line
@@ -75,6 +75,10 @@
    <string name="menu_rename">Rename</string>
    <!-- Menu item that displays properties about the selected document [CHAR LIMIT=28] -->
    <string name="menu_inspect">Get info</string>
    <!-- Menu item that shows hidden files [CHAR LIMIT=28] -->
    <string name="menu_show_hidden_files">Show hidden files</string>
    <!-- Menu item that hides hidden files [CHAR LIMIT=28] -->
    <string name="menu_hide_hidden_files">Don\u2019t show hidden files</string>
    <!-- Menu item that renames the selected document [CHAR LIMIT=28] -->
    <string name="menu_view_in_owner">View in <xliff:g id="source" example="Google Drive">%1$s</xliff:g></string>

+36 −18
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.documentsui.base.Shared.EXTRA_BENCHMARK;
import static com.android.documentsui.base.SharedMinimal.DEBUG;
import static com.android.documentsui.base.State.MODE_GRID;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -348,19 +349,6 @@ public abstract class BaseActivity
        mRootsMonitor.start();
    }

    @Override
    protected void onStart() {
        super.onStart();
        if (mState.stack.getTitle() == null) {
            // First launch.
            setTitle("");
            return;
        }

        // Append app name for TalkBack when app enters foreground.
        setTitle(String.format("%s. %s", getString(R.string.files_label), mState.stack.getTitle()));
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        boolean showMenu = super.onCreateOptionsMenu(menu);
@@ -416,6 +404,11 @@ public abstract class BaseActivity
        state.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false);
        state.excludedAuthorities = getExcludedAuthorities();
        state.restrictScopeStorage = Shared.shouldRestrictStorageAccessFramework(this);
        state.showHiddenFiles = LocalPreferences.getShowHiddenFiles(
                getApplicationContext(),
                getApplicationContext()
                        .getResources()
                        .getBoolean(R.bool.show_hidden_files_by_default));

        includeState(state);

@@ -537,6 +530,10 @@ public abstract class BaseActivity
                getInjector().actions.switchLauncherIcon();
                return true;

            case R.id.option_menu_show_hidden_files:
                onClickedShowHiddenFiles();
                return true;

            case R.id.sub_menu_grid:
                setViewMode(State.MODE_GRID);
                return true;
@@ -623,13 +620,17 @@ public abstract class BaseActivity
            roots.onCurrentRootChanged();
        }

        // Causes talkback to announce the activity's new title
        String appName = getString(R.string.files_label);
        if (getTitle() == null || getTitle().toString().isEmpty()) {
        String currentTitle = getTitle() != null ? getTitle().toString() : "";
        if (currentTitle.equals(appName)) {
            // First launch, TalkBack announces app name.
            setTitle(String.format("%s. %s", appName, mState.stack.getTitle()));
        } else if (mState.stack.getTitle() != null) {
            setTitle(mState.stack.getTitle());
            getWindow().getDecorView().announceForAccessibility(appName);
        }

        String newTitle = mState.stack.getTitle();
        if (newTitle != null) {
            // Causes talkback to announce the activity's new title
            setTitle(newTitle);
        }

        invalidateOptionsMenu();
@@ -664,6 +665,23 @@ public abstract class BaseActivity
        return mState;
    }

    /**
     * Updates hidden files visibility based on user action.
     */
    private void onClickedShowHiddenFiles() {
        boolean showHiddenFiles = !mState.showHiddenFiles;
        Context context = getApplicationContext();

        Metrics.logUserAction(showHiddenFiles
                ? MetricConsts.USER_ACTION_SHOW_HIDDEN_FILES
                : MetricConsts.USER_ACTION_HIDE_HIDDEN_FILES);
        LocalPreferences.setShowHiddenFiles(context, showHiddenFiles);
        mState.showHiddenFiles = showHiddenFiles;

        // Calls this to trigger either MultiRootDocumentsLoader or DirectoryLoader reloading.
        mInjector.actions.loadDocumentsForCurrentStack();
    }

    /**
     * Set mode based on explicit user action.
     */
+3 −0
Original line number Diff line number Diff line
@@ -178,6 +178,9 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> {
            }
            cursor.registerContentObserver(mObserver);

            // Filter hidden files.
            cursor = new FilteringCursorWrapper(cursor, mState.showHiddenFiles);

            if (mSearchMode && !mFeatures.isFoldersInSearchResultsEnabled()) {
                // There is no findDocumentPath API. Enable filtering on folders in search mode.
                cursor = new FilteringCursorWrapper(cursor, null, SEARCH_REJECT_MIMES);
Loading