mirror of
https://github.com/etesync/android
synced 2025-01-11 08:10:58 +00:00
Add account info when creating calendars
* add ACCOUNT_NAME and ACCOUNT_TYPE when creating calendars * close TaskProvider when checking for its presence * when TaskProvider is not available/accessible, explicitly disallow task sync at account creation to prevent further crashes * try to handle OutOfMemoryError * version 1.0_2
This commit is contained in:
parent
bb95a25b91
commit
a283cbbae5
@ -17,8 +17,8 @@ android {
|
|||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
|
|
||||||
versionCode 91
|
versionCode 92
|
||||||
versionName "1.0_1"
|
versionName "1.0.2"
|
||||||
|
|
||||||
buildConfigField "long", "buildTime", System.currentTimeMillis() + "L"
|
buildConfigField "long", "buildTime", System.currentTimeMillis() + "L"
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,12 @@ public class LocalCalendar extends AndroidCalendar implements LocalCollection {
|
|||||||
|
|
||||||
public static Uri create(@NonNull Account account, @NonNull ContentProviderClient provider, @NonNull CollectionInfo info) throws CalendarStorageException {
|
public static Uri create(@NonNull Account account, @NonNull ContentProviderClient provider, @NonNull CollectionInfo info) throws CalendarStorageException {
|
||||||
ContentValues values = valuesFromCollectionInfo(info);
|
ContentValues values = valuesFromCollectionInfo(info);
|
||||||
|
|
||||||
|
// ACCOUNT_NAME and ACCOUNT_TYPE are required (see docs)! If it's missing, other apps will crash.
|
||||||
|
values.put(Calendars.ACCOUNT_NAME, account.name);
|
||||||
|
values.put(Calendars.ACCOUNT_TYPE, account.type);
|
||||||
values.put(Calendars.OWNER_ACCOUNT, account.name);
|
values.put(Calendars.OWNER_ACCOUNT, account.name);
|
||||||
|
|
||||||
return create(account, provider, values);
|
return create(account, provider, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public class LocalTaskList extends AndroidTaskList implements LocalCollection {
|
|||||||
if (tasksProviderAvailable != null)
|
if (tasksProviderAvailable != null)
|
||||||
return tasksProviderAvailable;
|
return tasksProviderAvailable;
|
||||||
else {
|
else {
|
||||||
TaskProvider provider = TaskProvider.acquire(resolver, TaskProvider.ProviderName.OpenTasks);
|
@Cleanup TaskProvider provider = TaskProvider.acquire(resolver, TaskProvider.ProviderName.OpenTasks);
|
||||||
return tasksProviderAvailable = (provider != null);
|
return tasksProviderAvailable = (provider != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ abstract public class SyncManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(Exception e) {
|
} catch(Exception|OutOfMemoryError e) {
|
||||||
final int messageString;
|
final int messageString;
|
||||||
|
|
||||||
if (e instanceof UnauthorizedException) {
|
if (e instanceof UnauthorizedException) {
|
||||||
|
@ -38,6 +38,7 @@ import at.bitfire.davdroid.model.ServiceDB.Collections;
|
|||||||
import at.bitfire.davdroid.model.ServiceDB.HomeSets;
|
import at.bitfire.davdroid.model.ServiceDB.HomeSets;
|
||||||
import at.bitfire.davdroid.model.ServiceDB.OpenHelper;
|
import at.bitfire.davdroid.model.ServiceDB.OpenHelper;
|
||||||
import at.bitfire.davdroid.model.ServiceDB.Services;
|
import at.bitfire.davdroid.model.ServiceDB.Services;
|
||||||
|
import at.bitfire.davdroid.resource.LocalTaskList;
|
||||||
import at.bitfire.ical4android.TaskProvider;
|
import at.bitfire.ical4android.TaskProvider;
|
||||||
import lombok.Cleanup;
|
import lombok.Cleanup;
|
||||||
|
|
||||||
@ -127,9 +128,14 @@ public class AccountDetailsFragment extends Fragment {
|
|||||||
ContentResolver.setIsSyncable(account, CalendarContract.AUTHORITY, 1);
|
ContentResolver.setIsSyncable(account, CalendarContract.AUTHORITY, 1);
|
||||||
ContentResolver.setSyncAutomatically(account, CalendarContract.AUTHORITY, true);
|
ContentResolver.setSyncAutomatically(account, CalendarContract.AUTHORITY, true);
|
||||||
|
|
||||||
// will only do something if OpenTasks is installed
|
if (LocalTaskList.tasksProviderAvailable(getContext().getContentResolver())) {
|
||||||
|
// will only do something if OpenTasks is installed and accessible
|
||||||
ContentResolver.setIsSyncable(account, TaskProvider.ProviderName.OpenTasks.authority, 1);
|
ContentResolver.setIsSyncable(account, TaskProvider.ProviderName.OpenTasks.authority, 1);
|
||||||
ContentResolver.setSyncAutomatically(account, TaskProvider.ProviderName.OpenTasks.authority, true);
|
ContentResolver.setSyncAutomatically(account, TaskProvider.ProviderName.OpenTasks.authority, true);
|
||||||
|
} else
|
||||||
|
// If OpenTasks is installed after DAVdroid, DAVdroid won't get task permissions and crash at every task sync
|
||||||
|
// unless we disable task sync here (before OpenTasks is available).
|
||||||
|
ContentResolver.setIsSyncable(account, TaskProvider.ProviderName.OpenTasks.authority, 0);
|
||||||
} else {
|
} else {
|
||||||
ContentResolver.setIsSyncable(account, CalendarContract.AUTHORITY, 0);
|
ContentResolver.setIsSyncable(account, CalendarContract.AUTHORITY, 0);
|
||||||
ContentResolver.setIsSyncable(account, TaskProvider.ProviderName.OpenTasks.authority, 0);
|
ContentResolver.setIsSyncable(account, TaskProvider.ProviderName.OpenTasks.authority, 0);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<string name="startup_google_play_accounts_removed_message">Unter bestimmten Umständen verursacht die zwangsweise Play Store-Verschlüsselung, dass Accounts nach einem Neustart oder einem DAVdroid-Update verschwinden. Installieren Sie \"DAVdroid JB Workaround\", falls Sie von dem Problem betroffen sind.</string>
|
<string name="startup_google_play_accounts_removed_message">Unter bestimmten Umständen verursacht die zwangsweise Play Store-Verschlüsselung, dass Accounts nach einem Neustart oder einem DAVdroid-Update verschwinden. Installieren Sie \"DAVdroid JB Workaround\", falls Sie von dem Problem betroffen sind.</string>
|
||||||
<string name="startup_google_play_accounts_removed_more_info">Weitere Infos</string>
|
<string name="startup_google_play_accounts_removed_more_info">Weitere Infos</string>
|
||||||
<string name="startup_opentasks_not_installed">OpenTasks nicht installiert</string>
|
<string name="startup_opentasks_not_installed">OpenTasks nicht installiert</string>
|
||||||
<string name="startup_opentasks_not_installed_message">Die OpenTasks-App ist nicht installiert oder DAVdroid hat keine Rechte, um darauf zuzugreifen. Aufgabenlisten werden also nicht synchronisiert. Falls Sie OpenTasks installieren, müssen Sie DAVdroid danach deinstallieren und noch einmal installieren (Android-Bug).</string>
|
<string name="startup_opentasks_not_installed_message">Die OpenTasks-App ist nicht installiert oder DAVdroid hat keine Rechte, um darauf zuzugreifen. Aufgabenlisten werden also nicht synchronisiert. Falls Sie OpenTasks installieren, müssen Sie DAVdroid DANACH NEU INSTALLIEREN und Ihre Konten neu hinzufügen (Android-Bug).</string>
|
||||||
<string name="startup_opentasks_not_installed_install">OpenTasks installieren</string>
|
<string name="startup_opentasks_not_installed_install">OpenTasks installieren</string>
|
||||||
<!--AboutActivity-->
|
<!--AboutActivity-->
|
||||||
<string name="about_license_terms">Lizenzbedingungen</string>
|
<string name="about_license_terms">Lizenzbedingungen</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user