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

Commit 426518da authored by Youkichi Hosoi's avatar Youkichi Hosoi
Browse files

Rename StorageVolume.isStub as StorageVolume.isExternallyManaged

To make it more developer friendly.

Bug: 210622224
Test: m
Test: atest StorageManagerTest#testGetPrimaryVolume
Change-Id: I023d91b5940a8dabff15d53401529f1be43697f3
parent 0835d014
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -9507,7 +9507,7 @@ package android.os.storage {
  public final class StorageVolume implements android.os.Parcelable {
    method @NonNull public String getId();
    method public boolean isStub();
    method public boolean isExternallyManaged();
  }
}
+10 −10
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ public final class StorageVolume implements Parcelable {
    @UnsupportedAppUsage
    private final boolean mRemovable;
    private final boolean mEmulated;
    private final boolean mStub;
    private final boolean mExternallyManaged;
    private final boolean mAllowMassStorage;
    private final long mMaxFileSize;
    private final UserHandle mOwner;
@@ -138,7 +138,7 @@ public final class StorageVolume implements Parcelable {

    /** {@hide} */
    public StorageVolume(String id, File path, File internalPath, String description,
            boolean primary, boolean removable, boolean emulated, boolean stub,
            boolean primary, boolean removable, boolean emulated, boolean externallyManaged,
            boolean allowMassStorage, long maxFileSize, UserHandle owner, UUID uuid, String fsUuid,
            String state) {
        mId = Preconditions.checkNotNull(id);
@@ -148,7 +148,7 @@ public final class StorageVolume implements Parcelable {
        mPrimary = primary;
        mRemovable = removable;
        mEmulated = emulated;
        mStub = stub;
        mExternallyManaged = externallyManaged;
        mAllowMassStorage = allowMassStorage;
        mMaxFileSize = maxFileSize;
        mOwner = Preconditions.checkNotNull(owner);
@@ -165,7 +165,7 @@ public final class StorageVolume implements Parcelable {
        mPrimary = in.readInt() != 0;
        mRemovable = in.readInt() != 0;
        mEmulated = in.readInt() != 0;
        mStub = in.readInt() != 0;
        mExternallyManaged = in.readInt() != 0;
        mAllowMassStorage = in.readInt() != 0;
        mMaxFileSize = in.readLong();
        mOwner = in.readParcelable(null, android.os.UserHandle.class);
@@ -275,13 +275,13 @@ public final class StorageVolume implements Parcelable {
    }

    /**
     * Returns true if the volume is a stub volume (a volume managed from outside Android).
     * Returns true if the volume is managed from outside Android.
     *
     * @hide
     */
    @SystemApi
    public boolean isStub() {
        return mStub;
    public boolean isExternallyManaged() {
        return mExternallyManaged;
    }

    /**
@@ -520,7 +520,7 @@ public final class StorageVolume implements Parcelable {
        pw.printPair("mPrimary", mPrimary);
        pw.printPair("mRemovable", mRemovable);
        pw.printPair("mEmulated", mEmulated);
        pw.printPair("mStub", mStub);
        pw.printPair("mExternallyManaged", mExternallyManaged);
        pw.printPair("mAllowMassStorage", mAllowMassStorage);
        pw.printPair("mMaxFileSize", mMaxFileSize);
        pw.printPair("mOwner", mOwner);
@@ -555,7 +555,7 @@ public final class StorageVolume implements Parcelable {
        parcel.writeInt(mPrimary ? 1 : 0);
        parcel.writeInt(mRemovable ? 1 : 0);
        parcel.writeInt(mEmulated ? 1 : 0);
        parcel.writeInt(mStub ? 1 : 0);
        parcel.writeInt(mExternallyManaged ? 1 : 0);
        parcel.writeInt(mAllowMassStorage ? 1 : 0);
        parcel.writeLong(mMaxFileSize);
        parcel.writeParcelable(mOwner, flags);
@@ -637,7 +637,7 @@ public final class StorageVolume implements Parcelable {
                    mPrimary,
                    mRemovable,
                    mEmulated,
                    /* stub= */ false,
                    /* externallyManaged= */ false,
                    /* allowMassStorage= */ false,
                    /* maxFileSize= */ 0,
                    mOwner,
+3 −3
Original line number Diff line number Diff line
@@ -404,7 +404,7 @@ public class VolumeInfo implements Parcelable {

        final boolean removable;
        final boolean emulated;
        final boolean stub = type == TYPE_STUB;
        final boolean externallyManaged = type == TYPE_STUB;
        final boolean allowMassStorage = false;
        final String envState = reportUnmounted
                ? Environment.MEDIA_UNMOUNTED : getEnvironmentForState(state);
@@ -460,8 +460,8 @@ public class VolumeInfo implements Parcelable {
        }

        return new StorageVolume(id, userPath, internalPath, description, isPrimary(), removable,
                emulated, stub, allowMassStorage, maxFileSize, new UserHandle(userId), uuid,
                derivedFsUuid, envState);
                emulated, externallyManaged, allowMassStorage, maxFileSize, new UserHandle(userId),
                uuid, derivedFsUuid, envState);
    }

    @UnsupportedAppUsage
+3 −3
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ public class VolumeRecord implements Parcelable {
        final boolean primary = false;
        final boolean removable = true;
        final boolean emulated = false;
        final boolean stub = false;
        final boolean externallyManaged = false;
        final boolean allowMassStorage = false;
        final long maxFileSize = 0;
        final UserHandle user = new UserHandle(UserHandle.USER_NULL);
@@ -117,8 +117,8 @@ public class VolumeRecord implements Parcelable {
        }

        return new StorageVolume(id, userPath, internalPath, description, primary, removable,
                emulated, stub, allowMassStorage, maxFileSize, user, null /* uuid */, fsUuid,
                envState);
                emulated, externallyManaged, allowMassStorage, maxFileSize, user, null /* uuid */,
                fsUuid, envState);
    }

    public void dump(IndentingPrintWriter pw) {
+5 −4
Original line number Diff line number Diff line
@@ -3844,7 +3844,7 @@ class StorageManagerService extends IStorageManager.Stub
            final boolean primary = false;
            final boolean removable = false;
            final boolean emulated = true;
            final boolean stub = false;
            final boolean externallyManaged = false;
            final boolean allowMassStorage = false;
            final long maxFileSize = 0;
            final UserHandle user = new UserHandle(userId);
@@ -3852,7 +3852,8 @@ class StorageManagerService extends IStorageManager.Stub
            final String description = mContext.getString(android.R.string.unknownName);

            res.add(new StorageVolume(id, path, path, description, primary, removable, emulated,
                    stub, allowMassStorage, maxFileSize, user, null /*uuid */, id, envState));
                    externallyManaged, allowMassStorage, maxFileSize, user, null /*uuid */, id,
                    envState));
        }

        if (!foundPrimary) {
@@ -3867,7 +3868,7 @@ class StorageManagerService extends IStorageManager.Stub
            final boolean primary = true;
            final boolean removable = primaryPhysical;
            final boolean emulated = !primaryPhysical;
            final boolean stub = false;
            final boolean externallyManaged = false;
            final boolean allowMassStorage = false;
            final long maxFileSize = 0L;
            final UserHandle owner = new UserHandle(userId);
@@ -3876,7 +3877,7 @@ class StorageManagerService extends IStorageManager.Stub
            final String state = Environment.MEDIA_REMOVED;

            res.add(0, new StorageVolume(id, path, path,
                    description, primary, removable, emulated, stub,
                    description, primary, removable, emulated, externallyManaged,
                    allowMassStorage, maxFileSize, owner, uuid, fsUuid, state));
        }