mirror of
https://github.com/etesync/android
synced 2025-01-11 08:10:58 +00:00
Rename account: don't crash when content providers are not accessible
This commit is contained in:
parent
d34efb103d
commit
d2df3c9027
@ -17,7 +17,7 @@ android {
|
|||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 24
|
targetSdkVersion 24
|
||||||
|
|
||||||
versionCode 128
|
versionCode 129
|
||||||
|
|
||||||
buildConfigField "long", "buildTime", System.currentTimeMillis() + "L"
|
buildConfigField "long", "buildTime", System.currentTimeMillis() + "L"
|
||||||
buildConfigField "boolean", "customCerts", "true"
|
buildConfigField "boolean", "customCerts", "true"
|
||||||
|
@ -233,9 +233,11 @@ public class LocalAddressBook extends AndroidAddressBook implements LocalCollect
|
|||||||
|
|
||||||
public static void onRenameAccount(@NonNull ContentResolver resolver, @NonNull String oldName, @NonNull String newName) throws RemoteException {
|
public static void onRenameAccount(@NonNull ContentResolver resolver, @NonNull String oldName, @NonNull String newName) throws RemoteException {
|
||||||
@Cleanup("release") ContentProviderClient client = resolver.acquireContentProviderClient(ContactsContract.AUTHORITY);
|
@Cleanup("release") ContentProviderClient client = resolver.acquireContentProviderClient(ContactsContract.AUTHORITY);
|
||||||
ContentValues values = new ContentValues(1);
|
if (client != null) {
|
||||||
values.put(RawContacts.ACCOUNT_NAME, newName);
|
ContentValues values = new ContentValues(1);
|
||||||
client.update(RawContacts.CONTENT_URI, values, RawContacts.ACCOUNT_NAME + "=?", new String[] { oldName });
|
values.put(RawContacts.ACCOUNT_NAME, newName);
|
||||||
|
client.update(RawContacts.CONTENT_URI, values, RawContacts.ACCOUNT_NAME + "=?", new String[]{oldName});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -172,9 +172,11 @@ public class LocalTaskList extends AndroidTaskList implements LocalCollection {
|
|||||||
|
|
||||||
public static void onRenameAccount(@NonNull ContentResolver resolver, @NonNull String oldName, @NonNull String newName) throws RemoteException {
|
public static void onRenameAccount(@NonNull ContentResolver resolver, @NonNull String oldName, @NonNull String newName) throws RemoteException {
|
||||||
@Cleanup("release") ContentProviderClient client = resolver.acquireContentProviderClient(TaskProvider.ProviderName.OpenTasks.authority);
|
@Cleanup("release") ContentProviderClient client = resolver.acquireContentProviderClient(TaskProvider.ProviderName.OpenTasks.authority);
|
||||||
ContentValues values = new ContentValues(1);
|
if (client != null) {
|
||||||
values.put(Tasks.ACCOUNT_NAME, newName);
|
ContentValues values = new ContentValues(1);
|
||||||
client.update(Tasks.getContentUri(TaskProvider.ProviderName.OpenTasks.authority), values, Tasks.ACCOUNT_NAME + "=?", new String[] { oldName });
|
values.put(Tasks.ACCOUNT_NAME, newName);
|
||||||
|
client.update(Tasks.getContentUri(TaskProvider.ProviderName.OpenTasks.authority), values, Tasks.ACCOUNT_NAME + "=?", new String[]{oldName});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user