Эх сурвалжийг харах

Some work on a new job for AU

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 8 жил өмнө
parent
commit
6496d7267a

+ 1 - 0
build.gradle

@@ -193,6 +193,7 @@ dependencies {
     annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
     compile 'org.greenrobot:eventbus:3.0.0'
     compile 'com.googlecode.ez-vcard:ez-vcard:0.10.2'
+    compile 'org.lukhnos:nnio:0.2'
 
     // uncomment for gplay, modified
     // compile "com.google.firebase:firebase-messaging:${googleLibraryVersion}"

+ 1 - 1
src/main/java/com/owncloud/android/MainApp.java

@@ -42,7 +42,7 @@ import com.owncloud.android.db.PreferenceManager;
 import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
 import com.owncloud.android.lib.common.OwnCloudClientManagerFactory.Policy;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.services.NCJobCreator;
+import com.owncloud.android.jobs.NCJobCreator;
 import com.owncloud.android.services.observer.SyncedFolderObserverService;
 import com.owncloud.android.ui.activity.Preferences;
 import com.owncloud.android.ui.activity.WhatsNewActivity;

+ 9 - 9
src/main/java/com/owncloud/android/datamodel/ArbitraryDataProvider.java

@@ -59,24 +59,24 @@ public class ArbitraryDataProvider {
     }
 
 
-    public void storeOrUpdateKeyValue(Account account, String key, String newValue) {
-        ArbitraryDataSet data = getArbitraryDataSet(account, key);
+    public void storeOrUpdateKeyValue(String accountName, String key, String newValue) {
+        ArbitraryDataSet data = getArbitraryDataSet(accountName, key);
         if (data == null) {
-            Log_OC.v(TAG, "Adding arbitrary data with cloud id: " + account.name + " key: " + key
+            Log_OC.v(TAG, "Adding arbitrary data with cloud id: " + accountName + " key: " + key
                     + " value: " + newValue);
             ContentValues cv = new ContentValues();
-            cv.put(ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID, account.name);
+            cv.put(ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID, accountName);
             cv.put(ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY, key);
             cv.put(ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_VALUE, newValue);
 
             Uri result = contentResolver.insert(ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA, cv);
 
             if (result == null) {
-                Log_OC.v(TAG, "Failed to store arbitrary data with cloud id: " + account.name + " key: " + key
+                Log_OC.v(TAG, "Failed to store arbitrary data with cloud id: " + accountName + " key: " + key
                         + " value: " + newValue);
             }
         } else {
-            Log_OC.v(TAG, "Updating arbitrary data with cloud id: " + account.name + " key: " + key
+            Log_OC.v(TAG, "Updating arbitrary data with cloud id: " + accountName + " key: " + key
                     + " value: " + newValue);
             ContentValues cv = new ContentValues();
             cv.put(ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID, data.getCloudId());
@@ -91,7 +91,7 @@ public class ArbitraryDataProvider {
             );
 
             if (result == 0) {
-                Log_OC.v(TAG, "Failed to update arbitrary data with cloud id: " + account.name + " key: " + key
+                Log_OC.v(TAG, "Failed to update arbitrary data with cloud id: " + accountName + " key: " + key
                         + " value: " + newValue);
             }
         }
@@ -215,13 +215,13 @@ public class ArbitraryDataProvider {
         return "";
     }
 
-    private ArbitraryDataSet getArbitraryDataSet(Account account, String key) {
+    private ArbitraryDataSet getArbitraryDataSet(String accountName, String key) {
         Cursor cursor = contentResolver.query(
                 ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
                 null,
                 ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " = ? and " +
                         ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY + " = ?",
-                new String[]{account.name, key},
+                new String[]{accountName, key},
                 null
         );
 

+ 93 - 0
src/main/java/com/owncloud/android/datamodel/FileSystemDataSet.java

@@ -0,0 +1,93 @@
+/**
+ * Nextcloud Android client application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017 Mario Danic
+ * Copyright (C) 2017 Nextcloud
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.datamodel;
+
+
+public class FileSystemDataSet {
+
+    private int id;
+    private String localPath;
+    private long modifiedAt;
+    private boolean isFolder;
+    private boolean isSentForUpload;
+    private long foundAt;
+
+    public FileSystemDataSet() {
+    }
+
+    public FileSystemDataSet(int id, String localPath, long modifiedAt, boolean isFolder, boolean isSentForUpload, long foundAt) {
+        this.id = id;
+        this.localPath = localPath;
+        this.modifiedAt = modifiedAt;
+        this.isFolder = isFolder;
+        this.isSentForUpload = isSentForUpload;
+        this.foundAt = foundAt;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getLocalPath() {
+        return localPath;
+    }
+
+    public void setLocalPath(String localPath) {
+        this.localPath = localPath;
+    }
+
+    public long getModifiedAt() {
+        return modifiedAt;
+    }
+
+    public void setModifiedAt(long modifiedAt) {
+        this.modifiedAt = modifiedAt;
+    }
+
+    public boolean isFolder() {
+        return isFolder;
+    }
+
+    public void setFolder(boolean folder) {
+        isFolder = folder;
+    }
+
+    public long getFoundAt() {
+        return foundAt;
+    }
+
+    public void setFoundAt(long foundAt) {
+        this.foundAt = foundAt;
+    }
+
+    public boolean isSentForUpload() {
+        return isSentForUpload;
+    }
+
+    public void setSentForUpload(boolean sentForUpload) {
+        isSentForUpload = sentForUpload;
+    }
+
+}

+ 129 - 0
src/main/java/com/owncloud/android/datamodel/FilesystemDataProvider.java

@@ -0,0 +1,129 @@
+/**
+ * Nextcloud Android client application
+ *
+ * Copyright (C) 2017 Mario Danic
+ * Copyright (C) 2017 Nextcloud.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.datamodel;
+
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.database.Cursor;
+import android.net.Uri;
+
+import com.owncloud.android.db.ProviderMeta;
+import com.owncloud.android.lib.common.utils.Log_OC;
+
+public class FilesystemDataProvider {
+
+    static private final String TAG = FilesystemDataProvider.class.getSimpleName();
+
+    private ContentResolver contentResolver;
+
+    public FilesystemDataProvider(ContentResolver contentResolver) {
+        if (contentResolver == null) {
+            throw new IllegalArgumentException("Cannot create an instance with a NULL contentResolver");
+        }
+        this.contentResolver = contentResolver;
+    }
+
+    public void storeOrUpdateFileValue(String localPath, long modifiedAt, boolean isFolder, boolean sentForUpload) {
+        FileSystemDataSet data = getFilesystemDataSet(localPath);
+
+        int isFolderValue = 0;
+        if (isFolder) {
+            isFolderValue = 1;
+        }
+
+        int isSentForUpload = 0;
+        if (sentForUpload) {
+            isSentForUpload = 1;
+        }
+
+        ContentValues cv = new ContentValues();
+        cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_LOCAL_PATH, localPath);
+        cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_MODIFIED, modifiedAt);
+        cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_IS_FOLDER, isFolderValue);
+        cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_FOUND_RECENTLY, System.currentTimeMillis());
+        cv.put(ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_SENT_FOR_UPLOAD, isSentForUpload);
+
+        if (data == null) {
+
+            Uri result = contentResolver.insert(ProviderMeta.ProviderTableMeta.CONTENT_URI_FILESYSTEM, cv);
+
+            if (result == null) {
+                Log_OC.v(TAG, "Failed to insert filesystem data with local path: " + localPath);
+            }
+        } else {
+
+            int result = contentResolver.update(
+                    ProviderMeta.ProviderTableMeta.CONTENT_URI_FILESYSTEM,
+                    cv,
+                    ProviderMeta.ProviderTableMeta._ID + "=?",
+                    new String[]{String.valueOf(data.getId())}
+            );
+
+            if (result == 0) {
+                Log_OC.v(TAG, "Failed to update filesystem data with local path: " + localPath);
+            }
+        }
+    }
+
+    private FileSystemDataSet getFilesystemDataSet(String localPathParam) {
+        Cursor cursor = contentResolver.query(
+                ProviderMeta.ProviderTableMeta.CONTENT_URI_FILESYSTEM,
+                null,
+                ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_LOCAL_PATH + " = ?",
+                new String[]{localPathParam},
+                null
+        );
+
+        FileSystemDataSet dataSet = null;
+        if (cursor != null) {
+            if (cursor.moveToFirst()) {
+                int id = cursor.getInt(cursor.getColumnIndex(ProviderMeta.ProviderTableMeta._ID));
+                String localPath = cursor.getString(cursor.getColumnIndex(
+                        ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_LOCAL_PATH));
+                long modifiedAt = cursor.getLong(cursor.getColumnIndex(
+                        ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_MODIFIED));
+                boolean isFolder = false;
+                if (cursor.getInt(cursor.getColumnIndex(
+                        ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_MODIFIED)) != 0) {
+                    isFolder = true;
+                }
+                long foundAt = cursor.getLong(cursor.getColumnIndex(ProviderMeta.
+                        ProviderTableMeta.FILESYSTEM_FILE_FOUND_RECENTLY));
+
+                boolean isSentForUpload = false;
+                if (cursor.getInt(cursor.getColumnIndex(
+                        ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_SENT_FOR_UPLOAD)) != 0) {
+                    isSentForUpload = true;
+                }
+
+                if (id == -1) {
+                    Log_OC.e(TAG, "Arbitrary value could not be created from cursor");
+                } else {
+                    dataSet = new FileSystemDataSet(id, localPath, modifiedAt, isFolder, isSentForUpload, foundAt);
+                }
+            }
+            cursor.close();
+        } else {
+            Log_OC.e(TAG, "DB error restoring arbitrary values.");
+        }
+
+        return dataSet;
+    }
+}

+ 1 - 1
src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java

@@ -37,7 +37,7 @@ import com.owncloud.android.files.services.FileUploader;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.operations.UploadFileOperation;
-import com.owncloud.android.services.AutoUploadJob;
+import com.owncloud.android.jobs.AutoUploadJob;
 
 import java.util.ArrayList;
 import java.util.Calendar;

+ 12 - 0
src/main/java/com/owncloud/android/db/ProviderMeta.java

@@ -46,6 +46,7 @@ public class ProviderMeta {
         public static final String EXTERNAL_LINKS_TABLE_NAME = "external_links";
         public static final String ARBITRARY_DATA_TABLE_NAME = "arbitrary_data";
         public static final String VIRTUAL_TABLE_NAME = "virtual";
+        public static final String FILESYSTEM_TABLE_NAME = "filesystem";
 
         private static final String CONTENT_PREFIX = "content://";
 
@@ -68,6 +69,9 @@ public class ProviderMeta {
         public static final Uri CONTENT_URI_ARBITRARY_DATA = Uri.parse(CONTENT_PREFIX
                 + MainApp.getAuthority() + "/arbitrary_data");
         public static final Uri CONTENT_URI_VIRTUAL = Uri.parse(CONTENT_PREFIX + MainApp.getAuthority() + "/virtual");
+        public static final Uri CONTENT_URI_FILESYSTEM = Uri.parse(CONTENT_PREFIX
+                + MainApp.getAuthority() + "/filesystem");
+
 
         public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.owncloud.file";
         public static final String CONTENT_TYPE_ITEM = "vnd.android.cursor.item/vnd.owncloud.file";
@@ -193,8 +197,16 @@ public class ProviderMeta {
         public static final String ARBITRARY_DATA_KEY = "key";
         public static final String ARBITRARY_DATA_VALUE = "value";
 
+
         // Columns of virtual
         public static final String VIRTUAL_TYPE = "type";
         public static final String VIRTUAL_OCFILE_ID = "ocfile_id";
+
+        // Columns of filesystem data table
+        public static final String FILESYSTEM_FILE_LOCAL_PATH = "local_path";
+        public static final String FILESYSTEM_FILE_MODIFIED = "modified_at";
+        public static final String FILESYSTEM_FILE_IS_FOLDER = "is_folder";
+        public static final String FILESYSTEM_FILE_FOUND_RECENTLY = "found_at";
+        public static final String FILESYSTEM_FILE_SENT_FOR_UPLOAD = "upload_triggered";
     }
 }

+ 1 - 1
src/main/java/com/owncloud/android/services/AutoUploadJob.java → src/main/java/com/owncloud/android/jobs/AutoUploadJob.java

@@ -20,7 +20,7 @@
  * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-package com.owncloud.android.services;
+package com.owncloud.android.jobs;
 
 import android.accounts.Account;
 import android.content.Context;

+ 3 - 2
src/main/java/com/owncloud/android/services/ContactsBackupJob.java → src/main/java/com/owncloud/android/jobs/ContactsBackupJob.java

@@ -19,7 +19,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-package com.owncloud.android.services;
+package com.owncloud.android.jobs;
 
 import android.accounts.Account;
 import android.content.ComponentName;
@@ -44,6 +44,7 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.services.FileUploader;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.operations.UploadFileOperation;
+import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.ui.activity.ContactsPreferenceActivity;
 
 import java.io.File;
@@ -97,7 +98,7 @@ public class ContactsBackupJob extends Job {
                     OperationsService.BIND_AUTO_CREATE);
 
             // store execution date
-            arbitraryDataProvider.storeOrUpdateKeyValue(account,
+            arbitraryDataProvider.storeOrUpdateKeyValue(account.name,
                     ContactsPreferenceActivity.PREFERENCE_CONTACTS_LAST_BACKUP,
                     String.valueOf(Calendar.getInstance().getTimeInMillis()));
         } else {

+ 1 - 1
src/main/java/com/owncloud/android/services/ContactsImportJob.java → src/main/java/com/owncloud/android/jobs/ContactsImportJob.java

@@ -19,7 +19,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-package com.owncloud.android.services;
+package com.owncloud.android.jobs;
 
 import android.database.Cursor;
 import android.net.Uri;

+ 3 - 1
src/main/java/com/owncloud/android/services/NCJobCreator.java → src/main/java/com/owncloud/android/jobs/NCJobCreator.java

@@ -18,7 +18,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package com.owncloud.android.services;
+package com.owncloud.android.jobs;
 
 import com.evernote.android.job.Job;
 import com.evernote.android.job.JobCreator;
@@ -39,6 +39,8 @@ public class NCJobCreator implements JobCreator {
                 return new ContactsImportJob();
             case AccountRemovalJob.TAG:
                 return new AccountRemovalJob();
+            case NewAutoUploadJob.TAG:
+                return new NewAutoUploadJob();
             default:
                 return null;
         }

+ 112 - 0
src/main/java/com/owncloud/android/jobs/NewAutoUploadJob.java

@@ -0,0 +1,112 @@
+/**
+ * Nextcloud Android client application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017 Mario Danic
+ * Copyright (C) 2017 Nextcloud
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.owncloud.android.jobs;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.util.Log;
+
+import com.evernote.android.job.Job;
+import com.owncloud.android.MainApp;
+import com.owncloud.android.datamodel.ArbitraryDataProvider;
+import com.owncloud.android.datamodel.FilesystemDataProvider;
+import com.owncloud.android.datamodel.SyncedFolder;
+import com.owncloud.android.datamodel.SyncedFolderProvider;
+
+import org.lukhnos.nnio.file.FileVisitResult;
+import org.lukhnos.nnio.file.Files;
+import org.lukhnos.nnio.file.Path;
+import org.lukhnos.nnio.file.Paths;
+import org.lukhnos.nnio.file.SimpleFileVisitor;
+import org.lukhnos.nnio.file.attribute.BasicFileAttributes;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class NewAutoUploadJob extends Job {
+    public static final String TAG = "NewAutoUploadJob";
+
+    private static final String GLOBAL = "global";
+    private static final String LAST_AUTOUPLOAD_JOB_RUN = "last_autoupload_job_run";
+
+
+    @NonNull
+    @Override
+    protected Result onRunJob(Params params) {
+        final Context context = MainApp.getAppContext();
+        final ContentResolver contentResolver = context.getContentResolver();
+
+        // Create all the providers we'll need
+        ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(contentResolver);
+        final FilesystemDataProvider filesystemDataProvider = new FilesystemDataProvider(contentResolver);
+        SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver);
+
+        // Store when we started doing this
+        arbitraryDataProvider.storeOrUpdateKeyValue(GLOBAL, LAST_AUTOUPLOAD_JOB_RUN,
+                Long.toString(System.currentTimeMillis()));
+
+        List<SyncedFolder> syncedFolders = syncedFolderProvider.getSyncedFolders();
+        List<SyncedFolder> syncedFoldersToDelete = new ArrayList<>();
+
+        for (SyncedFolder syncedFolder : syncedFolders) {
+            for (SyncedFolder secondarySyncedFolder : syncedFolders) {
+                if (syncedFolder != secondarySyncedFolder) {
+                    if (secondarySyncedFolder.getLocalPath().startsWith(syncedFolder.getLocalPath()) &&
+                            !syncedFoldersToDelete.contains(secondarySyncedFolder)) {
+                        syncedFoldersToDelete.add(secondarySyncedFolder);
+                    }
+                }
+            }
+        }
+
+        // delete all the folders from the list that we won't traverse
+        syncedFolders.removeAll(syncedFoldersToDelete);
+
+        for (int i = 0; i < syncedFolders.size(); i++) {
+            Path path = Paths.get(syncedFolders.get(i).getLocalPath());
+
+            try {
+                Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
+                    @Override
+                    public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException {
+
+                        filesystemDataProvider.storeOrUpdateFileValue(path.toAbsolutePath().toString(),
+                                attrs.lastModifiedTime().toMillis(), path.toFile().isDirectory(), false);
+
+                        return FileVisitResult.CONTINUE;
+                    }
+
+                    @Override
+                    public FileVisitResult visitFileFailed(Path file, IOException exc) {
+                        return FileVisitResult.CONTINUE;
+                    }
+
+                });
+            } catch (IOException e) {
+                Log.d(TAG, "Something went wrong while indexing files for auto upload");
+            }
+        }
+        return Result.SUCCESS;
+    }
+}

+ 20 - 0
src/main/java/com/owncloud/android/providers/FileContentProvider.java

@@ -668,6 +668,9 @@ public class FileContentProvider extends ContentProvider {
 
             // Create virtual table
             createVirtualTable(db);
+
+            // Create filesystem table
+            createFileSystemTable(db);
         }
 
         @Override
@@ -1010,6 +1013,11 @@ public class FileContentProvider extends ContentProvider {
                             ADD_COLUMN + ProviderTableMeta.SYNCED_FOLDER_TYPE +
                             " INTEGER " + " DEFAULT 0");
 
+
+                    // create Filesystem table
+                    Log_OC.i(SQL, "Create filesystem table");
+                    createFileSystemTable(db);
+
                     // magic to split out existing synced folders in two when needed
                     // otherwise, we migrate them to their proper type (image or video)
                     Log_OC.i(SQL, "Migrate synced_folders records for image/video split");
@@ -1277,6 +1285,18 @@ public class FileContentProvider extends ContentProvider {
         );
     }
 
+    private void createFileSystemTable(SQLiteDatabase db) {
+        db.execSQL("CREATE TABLE " + ProviderTableMeta.FILESYSTEM_TABLE_NAME + "("
+                + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, "      // id
+                + ProviderTableMeta.FILESYSTEM_FILE_LOCAL_PATH + " TEXT, "
+                + ProviderTableMeta.FILESYSTEM_FILE_IS_FOLDER + " INTEGER, "
+                + ProviderTableMeta.FILESYSTEM_FILE_FOUND_RECENTLY + " LONG, "
+                + ProviderTableMeta.FILESYSTEM_FILE_SENT_FOR_UPLOAD + " INTEGER, "
+                + ProviderTableMeta.FILESYSTEM_FILE_MODIFIED + " LONG );"
+        );
+    }
+
+
     /**
      * Version 10 of database does not modify its scheme. It coincides with the upgrade of the ownCloud account names
      * structure to include in it the path to the server instance. Updating the account names and path to local files

+ 1 - 0
src/main/java/com/owncloud/android/services/AdvancedFileAlterationListener.java

@@ -32,6 +32,7 @@ import com.owncloud.android.R;
 import com.owncloud.android.datamodel.ArbitraryDataProvider;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.datamodel.SyncedFolder;
+import com.owncloud.android.jobs.AutoUploadJob;
 import com.owncloud.android.files.services.FileUploader;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.activity.Preferences;

+ 1 - 1
src/main/java/com/owncloud/android/ui/activity/ContactsPreferenceActivity.java

@@ -37,7 +37,7 @@ import com.evernote.android.job.util.support.PersistableBundleCompat;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.services.ContactsBackupJob;
+import com.owncloud.android.jobs.ContactsBackupJob;
 import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.ui.fragment.contactsbackup.ContactListFragment;
 import com.owncloud.android.ui.fragment.contactsbackup.ContactsBackupFragment;

+ 2 - 2
src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java

@@ -419,7 +419,7 @@ public class UserInfoActivity extends FileActivity {
                                     ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(
                                             contentResolver);
 
-                                    arbitraryDataProvider.storeOrUpdateKeyValue(account,
+                                    arbitraryDataProvider.storeOrUpdateKeyValue(account.name,
                                             ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP,
                                             "false");
 
@@ -433,7 +433,7 @@ public class UserInfoActivity extends FileActivity {
                                         PushConfigurationState pushArbitraryData = gson.fromJson(arbitraryDataPushString,
                                                 PushConfigurationState.class);
                                         pushArbitraryData.setShouldBeDeleted(true);
-                                        arbitraryDataProvider.storeOrUpdateKeyValue(account, PushUtils.KEY_PUSH,
+                                        arbitraryDataProvider.storeOrUpdateKeyValue(account.name, PushUtils.KEY_PUSH,
                                                 gson.toJson(pushArbitraryData));
                                         EventBus.getDefault().post(new TokenPushEvent());
                                     }

+ 1 - 1
src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactListFragment.java

@@ -67,7 +67,7 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.services.FileDownloader;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.services.ContactsImportJob;
+import com.owncloud.android.jobs.ContactsImportJob;
 import com.owncloud.android.ui.TextDrawable;
 import com.owncloud.android.ui.activity.ContactsPreferenceActivity;
 import com.owncloud.android.ui.events.VCardToggleEvent;

+ 1 - 1
src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java

@@ -338,7 +338,7 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
                     contactsPreferenceActivity.getAccount());
         }
 
-        arbitraryDataProvider.storeOrUpdateKeyValue(account, PREFERENCE_CONTACTS_AUTOMATIC_BACKUP,
+        arbitraryDataProvider.storeOrUpdateKeyValue(account.name, PREFERENCE_CONTACTS_AUTOMATIC_BACKUP,
                 String.valueOf(bool));
     }