Merge branch 'master' into crashDueToEmptyString

This commit is contained in:
Tobias Kaminsky 2017-05-15 12:44:22 +02:00 committed by GitHub
commit a2ff44a77e
7 changed files with 10 additions and 26 deletions

View file

@ -179,7 +179,7 @@ dependencies {
compile name: 'touch-image-view' compile name: 'touch-image-view'
compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:multidex:1.0.1'
compile 'com.github.nextcloud:android-library:1.0.17' compile 'com.github.nextcloud:android-library:logFolder-SNAPSHOT'
compile "com.android.support:support-v4:${supportLibraryVersion}" compile "com.android.support:support-v4:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}" compile "com.android.support:design:${supportLibraryVersion}"
compile 'com.jakewharton:disklrucache:2.0.2' compile 'com.jakewharton:disklrucache:2.0.2'

View file

@ -112,13 +112,8 @@ public class MainApp extends MultiDexApplication {
new ThumbnailsCacheManager.InitDiskCacheTask().execute(); new ThumbnailsCacheManager.InitDiskCacheTask().execute();
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
// use app writable dir, no permissions needed
String dataFolder = getDataFolder(); Log_OC.startLogging(getAppContext());
// Set folder for store logs
Log_OC.setLogDataFolder(dataFolder);
Log_OC.startLogging(MainApp.storagePath);
Log_OC.d("Debug", "start logging"); Log_OC.d("Debug", "start logging");
} }

View file

@ -40,7 +40,6 @@ import com.owncloud.android.R;
import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.LoadingDialog; import com.owncloud.android.ui.dialog.LoadingDialog;
import com.owncloud.android.utils.AnalyticsUtils; import com.owncloud.android.utils.AnalyticsUtils;
import com.owncloud.android.utils.FileStorageUtils;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
@ -64,7 +63,7 @@ public class LogHistoryActivity extends ToolbarActivity {
private static final String SCREEN_NAME = "Logs"; private static final String SCREEN_NAME = "Logs";
private String mLogPath = FileStorageUtils.getLogPath(); private String mLogPath = Log_OC.getLogPath();
private File logDIR = null; private File logDIR = null;
private String mLogText; private String mLogText;
@ -166,11 +165,7 @@ public class LogHistoryActivity extends ToolbarActivity {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
uris.add(Uri.fromFile(logFile)); uris.add(Uri.fromFile(logFile));
} else { } else {
uris.add(FileProvider.getUriForFile( uris.add(FileProvider.getUriForFile(this, getString(R.string.file_provider_authority), logFile));
this,
getString(R.string.file_provider_authority),
logFile
));
} }
} }
} }

View file

@ -296,7 +296,6 @@ public class StorageMigration {
protected Integer doInBackground(Void... voids) { protected Integer doInBackground(Void... voids) {
publishProgress(R.string.file_migration_preparing); publishProgress(R.string.file_migration_preparing);
Log_OC.stopLogging();
boolean[] syncStates = null; boolean[] syncStates = null;
try { try {
publishProgress(R.string.file_migration_saving_accounts_configuration); publishProgress(R.string.file_migration_saving_accounts_configuration);
@ -309,7 +308,6 @@ public class StorageMigration {
publishProgress(R.string.file_migration_restoring_accounts_configuration); publishProgress(R.string.file_migration_restoring_accounts_configuration);
restoreAccountsSyncStatus(syncStates); restoreAccountsSyncStatus(syncStates);
} }
Log_OC.startLogging(mStorageTarget);
return 0; return 0;
} }
@ -338,7 +336,6 @@ public class StorageMigration {
@Override @Override
protected Integer doInBackground(Void... args) { protected Integer doInBackground(Void... args) {
publishProgress(R.string.file_migration_preparing); publishProgress(R.string.file_migration_preparing);
Log_OC.stopLogging();
boolean[] syncState = null; boolean[] syncState = null;
@ -372,14 +369,12 @@ public class StorageMigration {
} catch (MigrationException e) { } catch (MigrationException e) {
rollback(); rollback();
Log_OC.startLogging(mStorageSource);
return e.getResId(); return e.getResId();
} finally { } finally {
publishProgress(R.string.file_migration_restoring_accounts_configuration); publishProgress(R.string.file_migration_restoring_accounts_configuration);
restoreAccountsSyncStatus(syncState); restoreAccountsSyncStatus(syncState);
} }
Log_OC.startLogging(mStorageTarget);
publishProgress(R.string.file_migration_ok_finished); publishProgress(R.string.file_migration_ok_finished);
return 0; return 0;

View file

@ -115,10 +115,6 @@ public class FileStorageUtils {
return savePath.getUsableSpace(); return savePath.getUsableSpace();
} }
public static String getLogPath() {
return MainApp.getStoragePath() + File.separator + MainApp.getDataFolder() + File.separator + "log";
}
/** /**
* Returns the a string like 2016/08/ for the passed date. If date is 0 an empty * Returns the a string like 2016/08/ for the passed date. If date is 0 an empty
* string is returned * string is returned

View file

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android"> <paths>
<files-path
path="log/"
name="log"/>
<external-path name="external_files" path="."/> <external-path name="external_files" path="."/>
<root-path name="external_files" path="/storage/" /> <root-path name="external_files" path="/storage/" />
<!-- yes, valid for ALL external storage and not only our app folder, since we can't use @string/data_folder <!-- yes, valid for ALL external storage and not only our app folder, since we can't use @string/data_folder