diff options
author | Steve Kondik <steve@cyngn.com> | 2015-10-31 14:10:08 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-10-31 14:10:08 -0700 |
commit | 669378075a5d60deef97eb3418e168b70c71f402 (patch) | |
tree | 1d75d03ada3972c996ca67807eae653945ff1e9a /src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java | |
parent | 2fa3771a508f6a16e54d4276fa27273bb0b18367 (diff) | |
parent | 21a3e3da140c644d7f4ef7743749f23dc63bb217 (diff) | |
download | android_packages_apps_BluetoothExt-669378075a5d60deef97eb3418e168b70c71f402.tar.gz android_packages_apps_BluetoothExt-669378075a5d60deef97eb3418e168b70c71f402.tar.bz2 android_packages_apps_BluetoothExt-669378075a5d60deef97eb3418e168b70c71f402.zip |
Merge branch 'LA.BF.1.1.3_rb1.3' of git://codeaurora.org/platform/vendor/qcom-opensource/bluetooth into cm-13.0
Diffstat (limited to 'src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java')
-rw-r--r-- | src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java index b602eec..11935c6 100644 --- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java +++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java @@ -63,6 +63,8 @@ import javax.obex.Operation; import javax.obex.HeaderSet; import javax.obex.ObexHelper; import android.os.Environment; +import android.os.storage.StorageManager; +import android.os.storage.StorageVolume; public class BluetoothFtpObexServer extends ServerRequestHandler { @@ -109,6 +111,7 @@ public class BluetoothFtpObexServer extends ServerRequestHandler { public static final String ENV_SECONDARY_EXTERNAL_STORAGE = "SECONDARY_STORAGE"; private String rootPrimaryStoragePath = null; private String rootSecondaryStoragePath = null; + private StorageManager mStorageManager; public static final String PRIMARY_INTERNAL_FOLDERNAME = "PHONE_MEMORY"; public static final String SECONDARY_EXTERNAL_FOLDERNAME = "EXTERNAL_MEMORY"; private static final String FOLDER_NAME_DOT = "."; @@ -209,9 +212,22 @@ public class BluetoothFtpObexServer extends ServerRequestHandler { Message msg = Message.obtain(mCallback); msg.what = BluetoothFtpService.MSG_SESSION_ESTABLISHED; msg.sendToTarget(); - /*Initialize the internal, external storage root paths from Enivronment*/ - rootPrimaryStoragePath = Environment.getExternalStorageDirectory().getPath(); - rootSecondaryStoragePath = System.getenv(ENV_SECONDARY_EXTERNAL_STORAGE); + mStorageManager = StorageManager.from(mContext); + StorageVolume[] volumes = mStorageManager.getVolumeList(); + for (int i = 0; i < volumes.length; i++) { + String path = volumes[i].getPath(); + if(V) Log.v(TAG, "Fetch storageManager volumeList : " + path + " :: isRemovable= " + + volumes[i].isRemovable() + ", getDescription= " + volumes[i] + .getDescription(mContext.getApplicationContext()) + " , isEmulated= " + + volumes[i].isEmulated()+ ", isPrimary=" + volumes[i].isPrimary()); + /*Initialize the internal, external storage root paths from Enivronment*/ + if ( rootPrimaryStoragePath == null && volumes[i].isPrimary()) { + rootPrimaryStoragePath = path; + } else if (rootSecondaryStoragePath == null && volumes[i].isRemovable()) { + //TODO: Support only first external SDCARD in list , in case of multiple + rootSecondaryStoragePath = path; + } + } /*Initialize mCurrentPath to null to show Internal and External memory options*/ mCurrentPath = null; if(D) Log.d(TAG,"ENV: PRIMARY: "+ rootPrimaryStoragePath + |