Remove support for custom edit activities
Test:
Tested the following editor scenarios:
1) new contact
2) edit other contact
3) edit writable raw contact
4) edit read-only raw contact (joins a new writable raw contact to it)
5) edit aggregate w/ 1 writable and 1 read-only raw contact
6) edit aggregate w/ 2 writable raw contacts
7) edit local me raw contact
8) edit local me raw contact joined with a read-only raw contact
Bug:31682268
Bug:31088704
Change-Id: I4000b4cef0d3c7beaa05cdef51ebdf978288c80f
diff --git a/src/com/android/contacts/activities/CompactContactEditorActivity.java b/src/com/android/contacts/activities/CompactContactEditorActivity.java
index 7de2e27..1d1ac84 100644
--- a/src/com/android/contacts/activities/CompactContactEditorActivity.java
+++ b/src/com/android/contacts/activities/CompactContactEditorActivity.java
@@ -23,9 +23,7 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
-import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.QuickContact;
-import android.provider.ContactsContract.RawContacts;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
@@ -34,10 +32,7 @@
import com.android.contacts.ContactsActivity;
import com.android.contacts.R;
import com.android.contacts.common.activity.RequestPermissionsActivity;
-import com.android.contacts.common.model.AccountTypeManager;
import com.android.contacts.common.model.RawContactDeltaList;
-import com.android.contacts.common.model.account.AccountType;
-import com.android.contacts.common.model.account.AccountWithDataSet;
import com.android.contacts.common.util.ImplicitIntentsUtil;
import com.android.contacts.detail.PhotoSelectionHandler;
import com.android.contacts.editor.CompactContactEditorFragment;
@@ -319,58 +314,6 @@
CompactContactEditorActivity.this, intent);
finish();
}
-
- @Override
- public void onCustomCreateContactActivityRequested(AccountWithDataSet account,
- Bundle intentExtras) {
- final AccountTypeManager accountTypes =
- AccountTypeManager.getInstance(CompactContactEditorActivity.this);
- final AccountType accountType = accountTypes.getAccountType(
- account.type, account.dataSet);
-
- Intent intent = new Intent();
- intent.setClassName(accountType.syncAdapterPackageName,
- accountType.getCreateContactActivityClassName());
- intent.setAction(Intent.ACTION_INSERT);
- intent.setType(Contacts.CONTENT_ITEM_TYPE);
- if (intentExtras != null) {
- intent.putExtras(intentExtras);
- }
- intent.putExtra(RawContacts.ACCOUNT_NAME, account.name);
- intent.putExtra(RawContacts.ACCOUNT_TYPE, account.type);
- intent.putExtra(RawContacts.DATA_SET, account.dataSet);
- intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
- | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
- startActivity(intent);
- finish();
- }
-
- @Override
- public void onCustomEditContactActivityRequested(AccountWithDataSet account,
- Uri rawContactUri, Bundle intentExtras, boolean redirect) {
- final AccountTypeManager accountTypes =
- AccountTypeManager.getInstance(CompactContactEditorActivity.this);
- final AccountType accountType = accountTypes.getAccountType(
- account.type, account.dataSet);
-
- Intent intent = new Intent();
- intent.setClassName(accountType.syncAdapterPackageName,
- accountType.getEditContactActivityClassName());
- intent.setAction(Intent.ACTION_EDIT);
- intent.setData(rawContactUri);
- if (intentExtras != null) {
- intent.putExtras(intentExtras);
- }
-
- if (redirect) {
- intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
- | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
- startActivity(intent);
- finish();
- } else {
- startActivity(intent);
- }
- }
};
@Override
diff --git a/src/com/android/contacts/common/model/account/AccountType.java b/src/com/android/contacts/common/model/account/AccountType.java
index 0943953..80fb4aa 100644
--- a/src/com/android/contacts/common/model/account/AccountType.java
+++ b/src/com/android/contacts/common/model/account/AccountType.java
@@ -139,28 +139,6 @@
public abstract boolean areContactsWritable();
/**
- * Returns an optional custom edit activity.
- *
- * Only makes sense for non-embedded account types.
- * The activity class should reside in the sync adapter package as determined by
- * {@link #syncAdapterPackageName}.
- */
- public String getEditContactActivityClassName() {
- return null;
- }
-
- /**
- * Returns an optional custom new contact activity.
- *
- * Only makes sense for non-embedded account types.
- * The activity class should reside in the sync adapter package as determined by
- * {@link #syncAdapterPackageName}.
- */
- public String getCreateContactActivityClassName() {
- return null;
- }
-
- /**
* Returns an optional custom invite contact activity.
*
* Only makes sense for non-embedded account types.
diff --git a/src/com/android/contacts/common/model/account/ExternalAccountType.java b/src/com/android/contacts/common/model/account/ExternalAccountType.java
index fc45e0b..1d7fc3e 100644
--- a/src/com/android/contacts/common/model/account/ExternalAccountType.java
+++ b/src/com/android/contacts/common/model/account/ExternalAccountType.java
@@ -70,8 +70,6 @@
private static final String TAG_CONTACTS_DATA_KIND = "ContactsDataKind";
private static final String TAG_EDIT_SCHEMA = "EditSchema";
- private static final String ATTR_EDIT_CONTACT_ACTIVITY = "editContactActivity";
- private static final String ATTR_CREATE_CONTACT_ACTIVITY = "createContactActivity";
private static final String ATTR_INVITE_CONTACT_ACTIVITY = "inviteContactActivity";
private static final String ATTR_INVITE_CONTACT_ACTION_LABEL = "inviteContactActionLabel";
private static final String ATTR_VIEW_CONTACT_NOTIFY_SERVICE = "viewContactNotifyService";
@@ -88,8 +86,6 @@
private final boolean mIsExtension;
- private String mEditContactActivityClassName;
- private String mCreateContactActivityClassName;
private String mInviteContactActivity;
private String mInviteActionLabelAttribute;
private int mInviteActionLabelResId;
@@ -259,16 +255,6 @@
}
@Override
- public String getEditContactActivityClassName() {
- return mEditContactActivityClassName;
- }
-
- @Override
- public String getCreateContactActivityClassName() {
- return mCreateContactActivityClassName;
- }
-
- @Override
public String getInviteContactActivityClassName() {
return mInviteContactActivity;
}
@@ -337,11 +323,7 @@
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, attr + "=" + value);
}
- if (ATTR_EDIT_CONTACT_ACTIVITY.equals(attr)) {
- mEditContactActivityClassName = value;
- } else if (ATTR_CREATE_CONTACT_ACTIVITY.equals(attr)) {
- mCreateContactActivityClassName = value;
- } else if (ATTR_INVITE_CONTACT_ACTIVITY.equals(attr)) {
+ if (ATTR_INVITE_CONTACT_ACTIVITY.equals(attr)) {
mInviteContactActivity = value;
} else if (ATTR_INVITE_CONTACT_ACTION_LABEL.equals(attr)) {
mInviteActionLabelAttribute = value;
diff --git a/src/com/android/contacts/editor/CompactContactEditorFragment.java b/src/com/android/contacts/editor/CompactContactEditorFragment.java
index 4e7c3c5..b10c992 100644
--- a/src/com/android/contacts/editor/CompactContactEditorFragment.java
+++ b/src/com/android/contacts/editor/CompactContactEditorFragment.java
@@ -263,23 +263,6 @@
ArrayList<ContentValues> contentValues);
/**
- * Contact is being created for an external account that provides its own
- * new contact activity.
- */
- void onCustomCreateContactActivityRequested(AccountWithDataSet account,
- Bundle intentExtras);
-
- /**
- * The edited raw contact belongs to an external account that provides
- * its own edit activity.
- *
- * @param redirect indicates that the current editor should be closed
- * before the custom editor is shown.
- */
- void onCustomEditContactActivityRequested(AccountWithDataSet account, Uri rawContactUri,
- Bundle intentExtras, boolean redirect);
-
- /**
* User has requested that contact be deleted.
*/
void onDeleteRequested(Uri contactUri);
@@ -1145,13 +1128,7 @@
final AccountTypeManager accountTypes = AccountTypeManager.getInstance(mContext);
final AccountType accountType = accountTypes.getAccountTypeForAccount(account);
- if (accountType.getCreateContactActivityClassName() != null) {
- if (mListener != null) {
- mListener.onCustomCreateContactActivityRequested(account, mIntentExtras);
- }
- } else {
- setStateForNewContact(account, accountType, isEditingUserProfile());
- }
+ setStateForNewContact(account, accountType, isEditingUserProfile());
}
//
@@ -1167,26 +1144,6 @@
mRawContacts = contact.getRawContacts();
- // See if this edit operation needs to be redirected to a custom editor
- if (mRawContacts.size() == 1) {
- RawContact rawContact = mRawContacts.get(0);
- String type = rawContact.getAccountTypeString();
- String dataSet = rawContact.getDataSet();
- AccountType accountType = rawContact.getAccountType(mContext);
- if (accountType.getEditContactActivityClassName() != null &&
- !accountType.areContactsWritable()) {
- if (mListener != null) {
- String name = rawContact.getAccountName();
- long rawContactId = rawContact.getId();
- mListener.onCustomEditContactActivityRequested(
- new AccountWithDataSet(name, type, dataSet),
- ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId),
- mIntentExtras, true);
- }
- return;
- }
- }
-
String readOnlyDisplayName = null;
// Check for writable raw contacts. If there are none, then we need to create one so user
// can edit. For the user profile case, there is already an editable contact.
@@ -1439,21 +1396,14 @@
AccountType oldAccountType = accountTypes.getAccountTypeForAccount(oldAccount);
AccountType newAccountType = accountTypes.getAccountTypeForAccount(newAccount);
- if (newAccountType.getCreateContactActivityClassName() != null) {
- Log.w(TAG, "external activity called in rebind situation");
- if (mListener != null) {
- mListener.onCustomCreateContactActivityRequested(newAccount, mIntentExtras);
- }
- } else {
- mExistingContactDataReady = false;
- mNewContactDataReady = false;
- mState = new RawContactDeltaList();
- setStateForNewContact(newAccount, newAccountType, oldState, oldAccountType,
- isEditingUserProfile());
- if (mIsEdit) {
- setStateForExistingContact(mReadOnlyDisplayName, isEditingUserProfile(),
- mRawContacts);
- }
+ mExistingContactDataReady = false;
+ mNewContactDataReady = false;
+ mState = new RawContactDeltaList();
+ setStateForNewContact(newAccount, newAccountType, oldState, oldAccountType,
+ isEditingUserProfile());
+ if (mIsEdit) {
+ setStateForExistingContact(mReadOnlyDisplayName, isEditingUserProfile(),
+ mRawContacts);
}
}