Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82a4f440 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Clarify AccountType.resPackageName/summaryResPackageName

Gave them clearer names and added javadoc.

And added a workaround for the fact that the view notification
service for the google account type is implemented in the sync
adapter, not in the authenticator.

This really needs further clean up.

Change-Id: I567656393fab30293c831fac802884dc84daf861
parent c0b1bf50
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1254,11 +1254,11 @@ public class ContactLoader extends AsyncTaskLoader<ContactLoader.Result> {
            final AccountType accountType = AccountTypeManager.getInstance(context).getAccountType(
                    type, dataSet);
            final String serviceName = accountType.getViewContactNotifyServiceClassName();
            final String resPackageName = accountType.resPackageName;
            if (!TextUtils.isEmpty(serviceName) && !TextUtils.isEmpty(resPackageName)) {
            final String servicePackageName = accountType.getViewContactNotifyServicePackageName();
            if (!TextUtils.isEmpty(serviceName) && !TextUtils.isEmpty(servicePackageName)) {
                final Uri uri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
                final Intent intent = new Intent();
                intent.setClassName(resPackageName, serviceName);
                intent.setClassName(servicePackageName, serviceName);
                intent.setAction(Intent.ACTION_VIEW);
                intent.setDataAndType(uri, RawContacts.CONTENT_ITEM_TYPE);
                try {
+4 −4
Original line number Diff line number Diff line
@@ -204,16 +204,16 @@ public class ContactsUtils {
     * Returns the intent to launch for the given invitable account type and contact lookup URI.
     * This will return null if the account type is not invitable (i.e. there is no
     * {@link AccountType#getInviteContactActivityClassName()} or
     * {@link AccountType#resPackageName}).
     * {@link AccountType#syncAdapterPackageName}).
     */
    public static Intent getInvitableIntent(AccountType accountType, Uri lookupUri) {
        String resPackageName = accountType.resPackageName;
        String syncAdapterPackageName = accountType.syncAdapterPackageName;
        String className = accountType.getInviteContactActivityClassName();
        if (TextUtils.isEmpty(resPackageName) || TextUtils.isEmpty(className)) {
        if (TextUtils.isEmpty(syncAdapterPackageName) || TextUtils.isEmpty(className)) {
            return null;
        }
        Intent intent = new Intent();
        intent.setClassName(resPackageName, className);
        intent.setClassName(syncAdapterPackageName, className);

        intent.setAction(ContactsContract.Intents.INVITE_CONTACT);

+2 −2
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ public class ContactEditorActivity extends ContactsActivity
                    account.type, account.dataSet);

            Intent intent = new Intent();
            intent.setClassName(accountType.resPackageName,
            intent.setClassName(accountType.syncAdapterPackageName,
                    accountType.getCreateContactActivityClassName());
            intent.setAction(Intent.ACTION_INSERT);
            intent.setType(Contacts.CONTENT_ITEM_TYPE);
@@ -232,7 +232,7 @@ public class ContactEditorActivity extends ContactsActivity
                    account.type, account.dataSet);

            Intent intent = new Intent();
            intent.setClassName(accountType.resPackageName,
            intent.setClassName(accountType.syncAdapterPackageName,
                    accountType.getEditContactActivityClassName());
            intent.setAction(Intent.ACTION_EDIT);
            intent.setData(rawContactUri);
+2 −1
Original line number Diff line number Diff line
@@ -147,7 +147,8 @@ public class GroupDetailActivity extends ContactsActivity {
                final Uri uri = ContentUris.withAppendedId(Groups.CONTENT_URI,
                        mFragment.getGroupId());
                final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                intent.setClassName(accountType.resPackageName, accountType.getViewGroupActivity());
                intent.setClassName(accountType.syncAdapterPackageName,
                        accountType.getViewGroupActivity());
                startActivity(intent);
            }
        });
+0 −2
Original line number Diff line number Diff line
@@ -1185,7 +1185,6 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen
        public String mimetype;

        public Context context = null;
        public String resPackageName = null;
        public boolean isPrimary = false;
        public int secondaryActionIcon = -1;
        public int secondaryActionDescription = -1;
@@ -1221,7 +1220,6 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen
            entry.kind = (kind.titleRes == -1 || kind.titleRes == 0) ? ""
                    : context.getString(kind.titleRes);
            entry.data = buildDataString(kind, values, context);
            entry.resPackageName = kind.resPackageName;

            if (kind.typeColumn != null && values.containsKey(kind.typeColumn)) {
                entry.type = values.getAsInteger(kind.typeColumn);
Loading