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

Commit d8242dc6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Only restrict scope storage if caller target sdk is above R" into rvc-dev

parents bad8a76a 5f863bee
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -364,6 +364,7 @@ public abstract class BaseActivity
        state.sortModel = SortModel.createModel();
        state.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false);
        state.excludedAuthorities = getExcludedAuthorities();
        state.restrictScopeStorage = Shared.shouldRestrictStorageAccessFramework(this);

        includeState(state);

+4 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ public class State implements android.os.Parcelable {
    public boolean localOnly;

    public boolean openableOnly;
    public boolean restrictScopeStorage;

    /**
     * Represents whether the intent is a cross-profile intent
@@ -171,6 +172,7 @@ public class State implements android.os.Parcelable {
        out.writeMap(dirConfigs);
        out.writeList(excludedAuthorities);
        out.writeInt(openableOnly ? 1 : 0);
        out.writeInt(restrictScopeStorage ? 1 : 0);
        out.writeParcelable(sortModel, 0);
    }

@@ -185,6 +187,7 @@ public class State implements android.os.Parcelable {
                + ", dirConfigs=" + dirConfigs
                + ", excludedAuthorities=" + excludedAuthorities
                + ", openableOnly=" + openableOnly
                + ", restrictScopeStorage=" + restrictScopeStorage
                + ", sortModel=" + sortModel
                + "}";
    }
@@ -206,6 +209,7 @@ public class State implements android.os.Parcelable {
            in.readMap(state.dirConfigs, loader);
            in.readList(state.excludedAuthorities, loader);
            state.openableOnly = in.readInt() != 0;
            state.restrictScopeStorage = in.readInt() != 0;
            state.sortModel = in.readParcelable(loader);
            return state;
        }
+2 −1
Original line number Diff line number Diff line
@@ -130,7 +130,8 @@ abstract class Message {
                update(null, mEnv.getModel().info, null,
                        mEnv.getContext().getDrawable(R.drawable.ic_dialog_info));
            } else if (mEnv.getDisplayState().action == State.ACTION_OPEN_TREE
                    && mEnv.getDisplayState().stack.peek().isBlockedFromTree()) {
                    && mEnv.getDisplayState().stack.peek().isBlockedFromTree()
                    && mEnv.getDisplayState().restrictScopeStorage) {
                updateBlockFromTreeMessage();
            }
        }
+2 −1
Original line number Diff line number Diff line
@@ -355,7 +355,8 @@ public class PickActivity extends BaseActivity implements ActionHandler.Addons {
            mState.action == ACTION_PICK_COPY_DESTINATION) {
            final PickFragment pick = PickFragment.get(fm);
            if (pick != null) {
                pick.setPickTarget(mState.action, mState.copyOperationSubType, cwd);
                pick.setPickTarget(mState.action,
                        mState.copyOperationSubType, mState.restrictScopeStorage, cwd);
            }
        }
    }
+5 −3
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public class PickFragment extends Fragment {

    private Injector<ActionHandler<PickActivity>> mInjector;
    private int mAction;
    private boolean mRestrictScopeStorage;
    // Only legal values are OPERATION_COPY, OPERATION_COMPRESS, OPERATION_EXTRACT,
    // OPERATION_MOVE, and unset (OPERATION_UNKNOWN).
    private @OpType int mCopyOperationSubType = OPERATION_UNKNOWN;
@@ -136,12 +137,13 @@ public class PickFragment extends Fragment {
    /**
     * @param action Which action defined in State is the picker shown for.
     */
    public void setPickTarget(
            int action, @OpType int copyOperationSubType, DocumentInfo pickTarget) {
    public void setPickTarget(int action, @OpType int copyOperationSubType,
            boolean restrictScopeStorage, DocumentInfo pickTarget) {
        assert(copyOperationSubType != OPERATION_DELETE);

        mAction = action;
        mCopyOperationSubType = copyOperationSubType;
        mRestrictScopeStorage = restrictScopeStorage;
        mPickTarget = pickTarget;
        if (mContainer != null) {
            updateView();
@@ -166,7 +168,7 @@ public class PickFragment extends Fragment {
                mPick.setText(getString(R.string.open_tree_button));
                mPick.setWidth(Integer.MAX_VALUE);
                mCancel.setVisibility(View.GONE);
                mPick.setEnabled(!mPickTarget.isBlockedFromTree());
                mPick.setEnabled(!(mPickTarget.isBlockedFromTree() && mRestrictScopeStorage));
                break;
            case State.ACTION_PICK_COPY_DESTINATION:
                int titleId;
Loading