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

Commit 07f66bae authored by Jorge Ruesga's avatar Jorge Ruesga Committed by Gerrit Code Review
Browse files

environment: return external dir if secondary is not defined



If the device doesn't define a secondary storage, then return external storage
as secondary storage

Patchset 2: do not break the api

Change-Id: I9d94a01881f47977ef1a26c3648b3da1d8c63b57
Signed-off-by: default avatarJorge Ruesga <jorge@ruesga.com>
parent 6fb0e97c
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -177,7 +177,8 @@ public class Environment {

        /** {@hide} */
        public File getSecondaryStorageDirectory() {
            return mExternalDirsForApp[1];
            return (mExternalDirsForApp.length > 1)
                    ? mExternalDirsForApp[1] : mExternalDirsForApp[0];
        }

        @Deprecated
@@ -423,13 +424,13 @@ public class Environment {
     */
    public static File getExternalStorageDirectory() {
        throwIfUserRequired();
        return sCurrentUser.getExternalDirsForApp()[0];
        return sCurrentUser.getExternalStorageDirectory();
    }

    /** {@hide} */
    public static File getSecondaryStorageDirectory() {
        throwIfUserRequired();
        return sCurrentUser.getExternalDirsForApp()[1];
        return sCurrentUser.getSecondaryStorageDirectory();
    }

    /** {@hide} */