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

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

Merge changes Iba4e52c2,I81160755 into pi-dev

* changes:
  Public volumes only browsable by mounting user.
  Public volumes are only visible to mounted user.
parents dea705ba 0000d8ae
Loading
Loading
Loading
Loading
+10 −17
Original line number Diff line number Diff line
@@ -269,14 +269,9 @@ public class VolumeInfo implements Parcelable {
        return (mountFlags & MOUNT_FLAG_VISIBLE) != 0;
    }

    public boolean isVisibleForRead(int userId) {
        if (type == TYPE_PUBLIC) {
            if (isPrimary() && mountUserId != userId) {
                // Primary physical is only visible to single user
                return false;
            } else {
    public boolean isVisibleForUser(int userId) {
        if (type == TYPE_PUBLIC && mountUserId == userId) {
            return isVisible();
            }
        } else if (type == TYPE_EMULATED) {
            return isVisible();
        } else {
@@ -284,14 +279,12 @@ public class VolumeInfo implements Parcelable {
        }
    }

    public boolean isVisibleForWrite(int userId) {
        if (type == TYPE_PUBLIC && mountUserId == userId) {
            return isVisible();
        } else if (type == TYPE_EMULATED) {
            return isVisible();
        } else {
            return false;
    public boolean isVisibleForRead(int userId) {
        return isVisibleForUser(userId);
    }

    public boolean isVisibleForWrite(int userId) {
        return isVisibleForUser(userId);
    }

    public File getPath() {
@@ -409,9 +402,9 @@ public class VolumeInfo implements Parcelable {
     * Build an intent to browse the contents of this volume. Only valid for
     * {@link #TYPE_EMULATED} or {@link #TYPE_PUBLIC}.
     */
    public Intent buildBrowseIntent() {
    public @Nullable Intent buildBrowseIntent() {
        final Uri uri;
        if (type == VolumeInfo.TYPE_PUBLIC) {
        if (type == VolumeInfo.TYPE_PUBLIC && mountUserId == UserHandle.myUserId()) {
            uri = DocumentsContract.buildRootUri(DOCUMENT_AUTHORITY, fsUuid);
        } else if (type == VolumeInfo.TYPE_EMULATED && isPrimary()) {
            uri = DocumentsContract.buildRootUri(DOCUMENT_AUTHORITY,