浏览代码

More tries

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 年之前
父节点
当前提交
ec13dc8234

+ 2 - 11
src/main/java/com/owncloud/android/MainApp.java

@@ -52,8 +52,6 @@ import com.owncloud.android.datamodel.MediaProvider;
 import com.owncloud.android.datamodel.SyncedFolder;
 import com.owncloud.android.datamodel.SyncedFolderProvider;
 import com.owncloud.android.datamodel.ThumbnailsCacheManager;
-import com.owncloud.android.datastorage.DataStorageProvider;
-import com.owncloud.android.datastorage.StoragePoint;
 import com.owncloud.android.db.PreferenceManager;
 import com.owncloud.android.jobs.NCJobCreator;
 import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
@@ -220,15 +218,8 @@ public class MainApp extends MultiDexApplication {
                 appPrefs.getInt(WhatsNewActivity.KEY_LAST_SEEN_VERSION_CODE, 0) != 0) {
             String storagePath = appPrefs.getString(Preferences.PreferenceKeys.STORAGE_PATH, "");
             if (TextUtils.isEmpty(storagePath)) {
-                storagePath = Environment.getExternalStorageDirectory().getAbsolutePath();
-                StoragePoint[] storagePoints = DataStorageProvider.getInstance().getLegacyAvailableStoragePoints();
-                for(StoragePoint storagePoint : storagePoints) {
-                    if (storagePoint.getPath().startsWith(storagePath)) {
-                        storagePath = storagePoint.getPath();
-                        break;
-                    }
-                }
-                appPrefs.edit().putString(Preferences.PreferenceKeys.STORAGE_PATH, storagePath).commit();
+                appPrefs.edit().putString(Preferences.PreferenceKeys.STORAGE_PATH,
+                        Environment.getExternalStorageDirectory().getAbsolutePath()).commit();
                 appPrefs.edit().remove(PreferenceManager.PREF__KEYS_MIGRATION).commit();
             }
             PreferenceManager.setStoragePathFix(this, true);

+ 0 - 24
src/main/java/com/owncloud/android/datastorage/DataStorageProvider.java

@@ -21,7 +21,6 @@
 
 package com.owncloud.android.datastorage;
 
-import android.os.Build;
 import android.os.Environment;
 
 import com.owncloud.android.MainApp;
@@ -32,7 +31,6 @@ import com.owncloud.android.datastorage.providers.MountCommandStoragePointProvid
 import com.owncloud.android.datastorage.providers.SystemDefaultStoragePointProvider;
 import com.owncloud.android.datastorage.providers.VDCStoragePointProvider;
 
-import java.io.File;
 import java.util.Vector;
 
 /**
@@ -59,28 +57,6 @@ public class DataStorageProvider {
 
     private DataStorageProvider() {}
 
-    public StoragePoint[] getLegacyAvailableStoragePoints() {
-        if (mCachedStoragePoints.size() != 0) {
-            return mCachedStoragePoints.toArray(new StoragePoint[mCachedStoragePoints.size()]);
-        }
-
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-            for (File f : MainApp.getAppContext().getExternalMediaDirs()) {
-                if (f != null) {
-                    mCachedStoragePoints.add(new StoragePoint(f.getAbsolutePath(), f.getAbsolutePath()));
-                }
-            }
-        } else {
-            for (IStoragePointProvider p : mStorageProviders) {
-                if (p.canProvideStoragePoints()) {
-                    mCachedStoragePoints.addAll(p.getAvailableStoragePoint());
-                }
-            }
-        }
-
-        return mCachedStoragePoints.toArray(new StoragePoint[mCachedStoragePoints.size()]);
-    }
-
     public StoragePoint[] getAvailableStoragePoints() {
         if (mCachedStoragePoints.size() != 0) {
             return mCachedStoragePoints.toArray(new StoragePoint[mCachedStoragePoints.size()]);