Remove code to mark contacts as read and WRITE_CONTACTS permission

See https://source.android.com/devices/tech/config/contacts-affinities
This commit is contained in:
cketti 2020-03-19 17:31:14 +01:00
parent 06ea59d816
commit defb055472
4 changed files with 2 additions and 29 deletions

View file

@ -200,24 +200,10 @@ public class Contacts {
/**
* Mark contacts with the provided email addresses as contacted.
*
* @param addresses Array of {@link Address} objects describing the
* contacts to be marked as contacted.
*/
public void markAsContacted(final Address[] addresses) {
//TODO: Optimize! Potentially a lot of database queries
for (final Address address : addresses) {
final Cursor c = getContactByAddress(address.getAddress());
if (c != null) {
if (c.getCount() > 0) {
c.moveToFirst();
final long personId = c.getLong(CONTACT_ID_INDEX);
ContactsContract.Contacts.markAsContacted(mContentResolver, personId);
}
c.close();
}
}
//TODO: Keep track of this information in a local database. Then use this information when sorting contacts for
// auto-completion.
}
/**

View file

@ -18,9 +18,6 @@
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<!-- Needed to mark a contact as contacted -->
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>

View file

@ -18,9 +18,6 @@
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<!-- Needed to mark a contact as contacted -->
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>

View file

@ -20,7 +20,6 @@ import timber.log.Timber;
public abstract class K9Activity extends AppCompatActivity {
public static final int PERMISSIONS_REQUEST_READ_CONTACTS = 1;
public static final int PERMISSIONS_REQUEST_WRITE_CONTACTS = 2;
private static final String FRAGMENT_TAG_RATIONALE = "rationale";
@ -87,12 +86,6 @@ public abstract class K9Activity extends AppCompatActivity {
PERMISSIONS_REQUEST_READ_CONTACTS,
R.string.permission_contacts_rationale_title,
R.string.permission_contacts_rationale_message
),
WRITE_CONTACTS(
Manifest.permission.WRITE_CONTACTS,
PERMISSIONS_REQUEST_WRITE_CONTACTS,
R.string.permission_contacts_rationale_title,
R.string.permission_contacts_rationale_message
);