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

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

Snap for 6291259 from 83a271b7 to rvc-release

Change-Id: I7f4047fb803912af567bcc53c8e26bbb5f0c100b
parents 64c582b2 83a271b7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ public abstract class BaseActivity

    protected SearchViewManager mSearchManager;
    protected AppsRowManager mAppsRowManager;
    protected UserIdManager mUserIdManager;
    protected State mState;

    @Injected
@@ -199,6 +200,9 @@ public abstract class BaseActivity
            @Override
            public void onSearchViewChanged(boolean opened) {
                mNavigator.update();
                // We also need to update AppsRowManager because we may want to show/hide the
                // appsRow in cross-profile search according to the searching conditions.
                mAppsRowManager.updateView(BaseActivity.this);
            }

            @Override
@@ -248,6 +252,7 @@ public abstract class BaseActivity
                        cmdInterceptor);

        ViewGroup chipGroup = findViewById(R.id.search_chip_group);
        mUserIdManager = DocumentsApplication.getUserIdManager(this);
        mSearchManager = new SearchViewManager(searchListener, queryInterceptor,
                chipGroup, icicle);
        // initialize the chip sets by accept mime types
+10 −0
Original line number Diff line number Diff line
@@ -298,6 +298,16 @@ public class RootInfo implements Durable, Parcelable, Comparable<RootInfo> {
        return authority == null && rootId == null;
    }

    /**
     * Return true, if the root is from ExternalStorage and the id is home. Otherwise, return false.
     */
    public boolean isExternalStorageHome() {
        // Note that "home" is the expected root id for the auto-created
        // user home directory on external storage. The "home" value should
        // match ExternalStorageProvider.ROOT_ID_HOME.
        return isExternalStorage() && "home".equals(rootId);
    }

    public boolean isExternalStorage() {
        return Providers.AUTHORITY_STORAGE.equals(authority);
    }
+13 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.widget.TextView;
import com.android.documentsui.ActionHandler;
import com.android.documentsui.BaseActivity;
import com.android.documentsui.R;
import com.android.documentsui.UserIdManager;
import com.android.documentsui.base.State;
import com.android.documentsui.base.UserId;
import com.android.documentsui.dirlist.AppsRowItemData.AppData;
@@ -47,11 +48,14 @@ public class AppsRowManager {
    private final ActionHandler mActionHandler;
    private final List<AppsRowItemData> mDataList;
    private final boolean mMaybeShowBadge;
    private final UserIdManager mUserIdManager;

    public AppsRowManager(ActionHandler handler, boolean maybeShowBadge) {
    public AppsRowManager(ActionHandler handler, boolean maybeShowBadge,
            UserIdManager userIdManager) {
        mDataList = new ArrayList<>();
        mActionHandler = handler;
        mMaybeShowBadge = maybeShowBadge;
        mUserIdManager = userIdManager;
    }

    public List<AppsRowItemData> updateList(List<Item> itemList) {
@@ -80,17 +84,22 @@ public class AppsRowManager {
        return mDataList;
    }

    private boolean shouldShow(State state) {
    private boolean shouldShow(State state, boolean isTextSearching) {
        boolean isHiddenAction = state.action == State.ACTION_CREATE
                || state.action == State.ACTION_OPEN_TREE
                || state.action == State.ACTION_PICK_COPY_DESTINATION;
        return state.stack.isRecents() && !isHiddenAction && mDataList.size() > 0;
        boolean isTextSearchingAcrossProfile = mUserIdManager.getUserIds().size() > 1
                && state.supportsCrossProfile()
                && isTextSearching;

        return state.stack.isRecents() && !isHiddenAction && mDataList.size() > 0
                && !isTextSearchingAcrossProfile;
    }

    public void updateView(BaseActivity activity) {
        final View appsRowLayout = activity.findViewById(R.id.apps_row);

        if (!shouldShow(activity.getDisplayState())) {
        if (!shouldShow(activity.getDisplayState(), activity.isTextSearching())) {
            appsRowLayout.setVisibility(View.GONE);
            return;
        }
+2 −1
Original line number Diff line number Diff line
@@ -155,7 +155,8 @@ public class FilesActivity extends BaseActivity implements AbstractActionHandler
                mInjector.selectionMgr,
                mProfileTabsAddonsStub);

        mAppsRowManager = new AppsRowManager(mInjector.actions, mState.supportsCrossProfile());
        mAppsRowManager = new AppsRowManager(mInjector.actions, mState.supportsCrossProfile(),
                mUserIdManager);
        mInjector.appsRowManager = mAppsRowManager;

        mActivityInputHandler =
+3 −2
Original line number Diff line number Diff line
@@ -138,13 +138,14 @@ public class PickActivity extends BaseActivity implements ActionHandler.Addons {
                ProviderExecutor::forAuthority,
                mInjector,
                LastAccessedStorage.create(),
                DocumentsApplication.getUserIdManager(this));
                mUserIdManager);

        mInjector.searchManager = mSearchManager;

        Intent intent = getIntent();

        mAppsRowManager = new AppsRowManager(mInjector.actions, mState.supportsCrossProfile());
        mAppsRowManager = new AppsRowManager(mInjector.actions, mState.supportsCrossProfile(),
                mUserIdManager);
        mInjector.appsRowManager = mAppsRowManager;

        mSharedInputHandler =
Loading