diff options
author | Brian Attwell <brianattwell@google.com> | 2015-01-09 01:12:20 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-01-09 01:12:22 +0000 |
commit | 3a9e3b15ba184232412b2df6456589a42cab9745 (patch) | |
tree | e7942d4a361d4557c5018805163e496d9f69d2d4 | |
parent | 81a37f2f755eeee825b2dad930219d81750f5f13 (diff) | |
parent | c3d202ccbaf93ddd8291672027e59f549c32eee3 (diff) | |
download | android_packages_apps_Contacts-3a9e3b15ba184232412b2df6456589a42cab9745.tar.gz android_packages_apps_Contacts-3a9e3b15ba184232412b2df6456589a42cab9745.tar.bz2 android_packages_apps_Contacts-3a9e3b15ba184232412b2df6456589a42cab9745.zip |
Merge "Unbundle from contacts contract part 3/3"
14 files changed, 153 insertions, 202 deletions
diff --git a/res/layout/contacts_unavailable_fragment_content.xml b/res/layout/contacts_unavailable_fragment_content.xml index c36d03880..4f5480103 100644 --- a/res/layout/contacts_unavailable_fragment_content.xml +++ b/res/layout/contacts_unavailable_fragment_content.xml @@ -66,20 +66,6 @@ android:layout_marginBottom="15dip" android:text="@string/contacts_unavailable_import_contacts" /> - <Button - android:id="@+id/import_failure_uninstall_button" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="15dip" - android:text="@string/upgrade_out_of_memory_uninstall" /> - - <Button - android:id="@+id/import_failure_retry_button" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="15dip" - android:text="@string/upgrade_out_of_memory_retry" /> - <ProgressBar android:id="@+id/progress" android:layout_width="wrap_content" diff --git a/res/values/strings.xml b/res/values/strings.xml index e11a51961..ab28c0f3d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -397,17 +397,6 @@ <!-- Text shown in the contacts app while the background process updates contacts after a system upgrade [CHAR LIMIT=300] --> <string name="upgrade_in_progress">Contact list is being updated.</string> - <!-- Text shown in the contacts app if the background process updating contacts fails because of memory shortage [CHAR LIMIT=300] --> - <string name="upgrade_out_of_memory">Contacts are in the process of being upgraded. - \n\nThe upgrade process requires approximately <xliff:g id="size_in_megabytes">%s</xliff:g> - MB of internal storage.\n\nChoose one of the following options:</string> - - <!-- Button shown in the contacts app if the background process updating contacts fails because of memory shortage [CHAR LIMIT=50] --> - <string name="upgrade_out_of_memory_uninstall">Uninstall some applications</string> - - <!-- Button shown in the contacts app if the background process updating contacts fails because of memory shortage [CHAR LIMIT=50] --> - <string name="upgrade_out_of_memory_retry">Retry upgrade</string> - <!-- Title shown in the search result activity of contacts app while searching. [CHAR LIMIT=20] --> <string name="search_results_searching">Searching\u2026</string> diff --git a/src/com/android/contacts/ContactsSearchManager.java b/src/com/android/contacts/ContactsSearchManager.java index 20d7c5cd0..cadd2ce81 100644 --- a/src/com/android/contacts/ContactsSearchManager.java +++ b/src/com/android/contacts/ContactsSearchManager.java @@ -20,9 +20,9 @@ import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.provider.ContactsContract; -import android.provider.ContactsContract.Intents.UI; import com.android.contacts.list.ContactsRequest; +import com.android.contacts.list.UiIntentActions; /** * A convenience class that helps launch contact search from within the app. @@ -57,14 +57,14 @@ public class ContactsSearchManager { Activity context, String initialQuery, ContactsRequest originalRequest) { Intent intent = new Intent(); intent.setData(ContactsContract.Contacts.CONTENT_URI); - intent.setAction(UI.FILTER_CONTACTS_ACTION); + intent.setAction(UiIntentActions.FILTER_CONTACTS_ACTION); Intent originalIntent = context.getIntent(); Bundle originalExtras = originalIntent.getExtras(); if (originalExtras != null) { intent.putExtras(originalExtras); } - intent.putExtra(UI.FILTER_TEXT_EXTRA_KEY, initialQuery); + intent.putExtra(UiIntentActions.FILTER_TEXT_EXTRA_KEY, initialQuery); if (originalRequest != null) { intent.putExtra(ORIGINAL_REQUEST_KEY, originalRequest); } diff --git a/src/com/android/contacts/activities/ContactSelectionActivity.java b/src/com/android/contacts/activities/ContactSelectionActivity.java index 53f685c71..8477a95ec 100644 --- a/src/com/android/contacts/activities/ContactSelectionActivity.java +++ b/src/com/android/contacts/activities/ContactSelectionActivity.java @@ -27,7 +27,6 @@ import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents.Insert; -import android.provider.ContactsContract.Intents.UI; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; @@ -55,6 +54,7 @@ import com.android.contacts.list.JoinContactListFragment; import com.android.contacts.list.LegacyPhoneNumberPickerFragment; import com.android.contacts.list.OnContactPickerActionListener; import com.android.contacts.list.OnEmailAddressPickerActionListener; +import com.android.contacts.list.UiIntentActions; import com.android.contacts.common.list.OnPhoneNumberPickerActionListener; import com.android.contacts.list.OnPostalAddressPickerActionListener; import com.android.contacts.common.list.PhoneNumberPickerFragment; @@ -616,10 +616,11 @@ public class ContactSelectionActivity extends ContactsActivity private long getTargetContactId() { Intent intent = getIntent(); - final long targetContactId = intent.getLongExtra(UI.TARGET_CONTACT_ID_EXTRA_KEY, -1); + final long targetContactId = intent.getLongExtra( + UiIntentActions.TARGET_CONTACT_ID_EXTRA_KEY, -1); if (targetContactId == -1) { Log.e(TAG, "Intent " + intent.getAction() + " is missing required extra: " - + UI.TARGET_CONTACT_ID_EXTRA_KEY); + + UiIntentActions.TARGET_CONTACT_ID_EXTRA_KEY); setResult(RESULT_CANCELED); finish(); return -1; diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java index df9d176fc..d73802378 100644 --- a/src/com/android/contacts/activities/PeopleActivity.java +++ b/src/com/android/contacts/activities/PeopleActivity.java @@ -117,7 +117,7 @@ public class PeopleActivity extends ContactsActivity implements private ContactsUnavailableFragment mContactsUnavailableFragment; private ProviderStatusWatcher mProviderStatusWatcher; - private ProviderStatusWatcher.Status mProviderStatus; + private Integer mProviderStatus; private boolean mOptionsMenuContactsAvailable; @@ -173,7 +173,7 @@ public class PeopleActivity extends ContactsActivity implements public boolean areContactsAvailable() { return (mProviderStatus != null) - && mProviderStatus.status == ProviderStatus.STATUS_NORMAL; + && mProviderStatus.equals(ProviderStatus.STATUS_NORMAL); } private boolean areContactWritableAccountsAvailable() { @@ -822,14 +822,14 @@ public class PeopleActivity extends ContactsActivity implements } private void updateViewConfiguration(boolean forceUpdate) { - ProviderStatusWatcher.Status providerStatus = mProviderStatusWatcher.getProviderStatus(); + int providerStatus = mProviderStatusWatcher.getProviderStatus(); if (!forceUpdate && (mProviderStatus != null) - && (providerStatus.status == mProviderStatus.status)) return; + && (mProviderStatus.equals(providerStatus))) return; mProviderStatus = providerStatus; View contactsUnavailableView = findViewById(R.id.contacts_unavailable_view); - if (mProviderStatus.status == ProviderStatus.STATUS_NORMAL) { + if (mProviderStatus.equals(ProviderStatus.STATUS_NORMAL)) { // Ensure that the mTabPager is visible; we may have made it invisible below. contactsUnavailableView.setVisibility(View.GONE); if (mTabPager != null) { @@ -950,11 +950,6 @@ public class PeopleActivity extends ContactsActivity implements ImportExportDialogFragment.show(getFragmentManager(), areContactsAvailable(), PeopleActivity.class); } - - @Override - public void onFreeInternalStorageAction() { - startActivity(new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS)); - } } private final class StrequentContactListFragmentListener diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java index be02952da..664b8c715 100644 --- a/src/com/android/contacts/editor/ContactEditorFragment.java +++ b/src/com/android/contacts/editor/ContactEditorFragment.java @@ -48,7 +48,6 @@ import android.provider.ContactsContract.CommonDataKinds.StructuredPostal; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Groups; import android.provider.ContactsContract.Intents; -import android.provider.ContactsContract.Intents.UI; import android.provider.ContactsContract.QuickContact; import android.provider.ContactsContract.RawContacts; import android.text.TextUtils; @@ -87,6 +86,7 @@ import com.android.contacts.common.model.RawContact; import com.android.contacts.common.model.RawContactDelta; import com.android.contacts.common.model.RawContactDeltaList; import com.android.contacts.common.model.RawContactModifier; +import com.android.contacts.list.UiIntentActions; import com.android.contacts.quickcontact.QuickContactActivity; import com.android.contacts.util.ContactPhotoUtils; import com.android.contacts.util.HelpUtils; @@ -1441,8 +1441,8 @@ public class ContactEditorFragment extends Fragment implements mContactIdForJoin = ContentUris.parseId(contactLookupUri); mContactWritableForJoin = isContactWritable(); - final Intent intent = new Intent(UI.PICK_JOIN_CONTACT_ACTION); - intent.putExtra(UI.TARGET_CONTACT_ID_EXTRA_KEY, mContactIdForJoin); + final Intent intent = new Intent(UiIntentActions.PICK_JOIN_CONTACT_ACTION); + intent.putExtra(UiIntentActions.TARGET_CONTACT_ID_EXTRA_KEY, mContactIdForJoin); startActivityForResult(intent, REQUEST_CODE_JOIN); } diff --git a/src/com/android/contacts/list/ContactsIntentResolver.java b/src/com/android/contacts/list/ContactsIntentResolver.java index b4416beda..b6bcb319d 100644 --- a/src/com/android/contacts/list/ContactsIntentResolver.java +++ b/src/com/android/contacts/list/ContactsIntentResolver.java @@ -33,7 +33,6 @@ import android.provider.ContactsContract.CommonDataKinds.StructuredPostal; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents; import android.provider.ContactsContract.Intents.Insert; -import android.provider.ContactsContract.Intents.UI; import android.text.TextUtils; import android.util.Log; @@ -59,21 +58,21 @@ public class ContactsIntentResolver { Log.i(TAG, "Called with action: " + action); - if (UI.LIST_DEFAULT.equals(action) ) { + if (UiIntentActions.LIST_DEFAULT.equals(action) ) { request.setActionCode(ContactsRequest.ACTION_DEFAULT); - } else if (UI.LIST_ALL_CONTACTS_ACTION.equals(action)) { + } else if (UiIntentActions.LIST_ALL_CONTACTS_ACTION.equals(action)) { request.setActionCode(ContactsRequest.ACTION_ALL_CONTACTS); - } else if (UI.LIST_CONTACTS_WITH_PHONES_ACTION.equals(action)) { + } else if (UiIntentActions.LIST_CONTACTS_WITH_PHONES_ACTION.equals(action)) { request.setActionCode(ContactsRequest.ACTION_CONTACTS_WITH_PHONES); - } else if (UI.LIST_STARRED_ACTION.equals(action)) { + } else if (UiIntentActions.LIST_STARRED_ACTION.equals(action)) { request.setActionCode(ContactsRequest.ACTION_STARRED); - } else if (UI.LIST_FREQUENT_ACTION.equals(action)) { + } else if (UiIntentActions.LIST_FREQUENT_ACTION.equals(action)) { request.setActionCode(ContactsRequest.ACTION_FREQUENT); - } else if (UI.LIST_STREQUENT_ACTION.equals(action)) { + } else if (UiIntentActions.LIST_STREQUENT_ACTION.equals(action)) { request.setActionCode(ContactsRequest.ACTION_STREQUENT); - } else if (UI.LIST_GROUP_ACTION.equals(action)) { + } else if (UiIntentActions.LIST_GROUP_ACTION.equals(action)) { request.setActionCode(ContactsRequest.ACTION_GROUP); - // We no longer support UI.GROUP_NAME_EXTRA_KEY + // We no longer support UiIntentActions.GROUP_NAME_EXTRA_KEY } else if (Intent.ACTION_PICK.equals(action)) { final String resolvedType = intent.resolveType(mContext); if (Contacts.CONTENT_TYPE.equals(resolvedType)) { @@ -146,14 +145,14 @@ public class ContactsIntentResolver { intent.setAction(Intent.ACTION_DEFAULT); intent.setData(null); } - } else if (UI.FILTER_CONTACTS_ACTION.equals(action)) { + } else if (UiIntentActions.FILTER_CONTACTS_ACTION.equals(action)) { // When we get a FILTER_CONTACTS_ACTION, it represents search in the context // of some other action. Let's retrieve the original action to provide proper // context for the search queries. request.setActionCode(ContactsRequest.ACTION_DEFAULT); Bundle extras = intent.getExtras(); if (extras != null) { - request.setQueryString(extras.getString(UI.FILTER_TEXT_EXTRA_KEY)); + request.setQueryString(extras.getString(UiIntentActions.FILTER_TEXT_EXTRA_KEY)); ContactsRequest originalRequest = (ContactsRequest)extras.get(ContactsSearchManager.ORIGINAL_REQUEST_KEY); @@ -173,11 +172,11 @@ public class ContactsIntentResolver { request.setContactUri(data); intent.setAction(Intent.ACTION_DEFAULT); intent.setData(null); - } else if (UI.PICK_JOIN_CONTACT_ACTION.equals(action)) { + } else if (UiIntentActions.PICK_JOIN_CONTACT_ACTION.equals(action)) { request.setActionCode(ContactsRequest.ACTION_PICK_JOIN); } // Allow the title to be set to a custom String using an extra on the intent - String title = intent.getStringExtra(UI.TITLE_EXTRA_KEY); + String title = intent.getStringExtra(UiIntentActions.TITLE_EXTRA_KEY); if (title != null) { request.setActivityTitle(title); } diff --git a/src/com/android/contacts/list/ContactsUnavailableFragment.java b/src/com/android/contacts/list/ContactsUnavailableFragment.java index 70d224a5e..48c4e9efd 100644 --- a/src/com/android/contacts/list/ContactsUnavailableFragment.java +++ b/src/com/android/contacts/list/ContactsUnavailableFragment.java @@ -42,15 +42,13 @@ public class ContactsUnavailableFragment extends Fragment implements OnClickList private Button mCreateContactButton; private Button mAddAccountButton; private Button mImportContactsButton; - private Button mUninstallAppsButton; - private Button mRetryUpgradeButton; private ProgressBar mProgress; private int mNoContactsMsgResId = -1; private int mNSecNoContactsMsgResId = -1; private OnContactsUnavailableActionListener mListener; - private ProviderStatusWatcher.Status mProviderStatus; + private Integer mProviderStatus; @Override public void onCreate(Bundle savedInstanceState) { @@ -69,10 +67,6 @@ public class ContactsUnavailableFragment extends Fragment implements OnClickList mAddAccountButton.setOnClickListener(this); mImportContactsButton = (Button) mView.findViewById(R.id.import_contacts_button); mImportContactsButton.setOnClickListener(this); - mUninstallAppsButton = (Button) mView.findViewById(R.id.import_failure_uninstall_button); - mUninstallAppsButton.setOnClickListener(this); - mRetryUpgradeButton = (Button) mView.findViewById(R.id.import_failure_retry_button); - mRetryUpgradeButton.setOnClickListener(this); mProgress = (ProgressBar) mView.findViewById(R.id.progress); if (mProviderStatus != null) { @@ -87,20 +81,18 @@ public class ContactsUnavailableFragment extends Fragment implements OnClickList mListener = listener; } - public void updateStatus(ProviderStatusWatcher.Status providerStatus) { + public void updateStatus(int providerStatus) { mProviderStatus = providerStatus; if (mView == null) { // The view hasn't been inflated yet. return; } - switch (providerStatus.status) { + switch (providerStatus) { case ProviderStatus.STATUS_NO_ACCOUNTS_NO_CONTACTS: setMessageText(mNoContactsMsgResId, mNSecNoContactsMsgResId); mCreateContactButton.setVisibility(View.VISIBLE); mAddAccountButton.setVisibility(View.VISIBLE); mImportContactsButton.setVisibility(View.VISIBLE); - mUninstallAppsButton.setVisibility(View.GONE); - mRetryUpgradeButton.setVisibility(View.GONE); mProgress.setVisibility(View.GONE); break; @@ -111,8 +103,6 @@ public class ContactsUnavailableFragment extends Fragment implements OnClickList mCreateContactButton.setVisibility(View.GONE); mAddAccountButton.setVisibility(View.GONE); mImportContactsButton.setVisibility(View.GONE); - mUninstallAppsButton.setVisibility(View.GONE); - mRetryUpgradeButton.setVisibility(View.GONE); mProgress.setVisibility(View.VISIBLE); break; @@ -123,24 +113,8 @@ public class ContactsUnavailableFragment extends Fragment implements OnClickList mCreateContactButton.setVisibility(View.GONE); mAddAccountButton.setVisibility(View.GONE); mImportContactsButton.setVisibility(View.GONE); - mUninstallAppsButton.setVisibility(View.GONE); - mRetryUpgradeButton.setVisibility(View.GONE); mProgress.setVisibility(View.VISIBLE); break; - - case ProviderStatus.STATUS_UPGRADE_OUT_OF_MEMORY: - String message = getResources().getString(R.string.upgrade_out_of_memory, - new Object[] { providerStatus.data}); - mMessageView.setText(message); - mMessageView.setGravity(Gravity.START); - mMessageView.setVisibility(View.VISIBLE); - mCreateContactButton.setVisibility(View.GONE); - mAddAccountButton.setVisibility(View.GONE); - mImportContactsButton.setVisibility(View.GONE); - mUninstallAppsButton.setVisibility(View.VISIBLE); - mRetryUpgradeButton.setVisibility(View.VISIBLE); - mProgress.setVisibility(View.GONE); - break; } } @@ -159,15 +133,6 @@ public class ContactsUnavailableFragment extends Fragment implements OnClickList case R.id.import_contacts_button: mListener.onImportContactsFromFileAction(); break; - case R.id.import_failure_uninstall_button: - mListener.onFreeInternalStorageAction(); - break; - case R.id.import_failure_retry_button: - final Context context = getActivity(); - if (context != null) { // Just in case. - ProviderStatusWatcher.retryUpgrade(context); - } - break; } } /** @@ -179,7 +144,7 @@ public class ContactsUnavailableFragment extends Fragment implements OnClickList mNoContactsMsgResId = resId; mNSecNoContactsMsgResId = secResId; if ((mMessageView != null) && (mProviderStatus != null) && - (mProviderStatus.status == ProviderStatus.STATUS_NO_ACCOUNTS_NO_CONTACTS)) { + (mProviderStatus.equals(ProviderStatus.STATUS_NO_ACCOUNTS_NO_CONTACTS))) { if (resId != -1) { mMessageView.setText(mNoContactsMsgResId); mMessageView.setGravity(Gravity.CENTER_HORIZONTAL); diff --git a/src/com/android/contacts/list/OnContactsUnavailableActionListener.java b/src/com/android/contacts/list/OnContactsUnavailableActionListener.java index e8edea84c..cc381e470 100644 --- a/src/com/android/contacts/list/OnContactsUnavailableActionListener.java +++ b/src/com/android/contacts/list/OnContactsUnavailableActionListener.java @@ -34,10 +34,4 @@ public interface OnContactsUnavailableActionListener { * Initiates contact import from a file. */ void onImportContactsFromFileAction(); - - /** - * Initiates an interaction that frees up some internal storage for the purposes - * of a database upgrade. - */ - void onFreeInternalStorageAction(); } diff --git a/src/com/android/contacts/list/ProviderStatusWatcher.java b/src/com/android/contacts/list/ProviderStatusWatcher.java index 3e8d3f54a..23ae4d5b4 100644 --- a/src/com/android/contacts/list/ProviderStatusWatcher.java +++ b/src/com/android/contacts/list/ProviderStatusWatcher.java @@ -47,22 +47,8 @@ public class ProviderStatusWatcher extends ContentObserver { public void onProviderStatusChange(); } - public static class Status { - /** See {@link ProviderStatus#STATUS} */ - public final int status; - - /** See {@link ProviderStatus#DATA1} */ - public final String data; - - public Status(int status, String data) { - this.status = status; - this.data = data; - } - } - private static final String[] PROJECTION = new String[] { - ProviderStatus.STATUS, - ProviderStatus.DATA1 + ProviderStatus.STATUS }; /** @@ -81,8 +67,9 @@ public class ProviderStatusWatcher extends ContentObserver { private LoaderTask mLoaderTask; - /** Last known provider status. This can be changed on a worker thread. */ - private Status mProviderStatus; + /** Last known provider status. This can be changed on a worker thread. + * See {@link ProviderStatus#STATUS} */ + private Integer mProviderStatus; private final ArrayList<ProviderStatusListener> mListeners = Lists.newArrayList(); @@ -185,11 +172,11 @@ public class ProviderStatusWatcher extends ContentObserver { * (If {@link ProviderStatus#STATUS_UPGRADING} is returned, the app (should) shows an according * message, like "contacts are being updated".) */ - public Status getProviderStatus() { + public int getProviderStatus() { waitForLoaded(); if (mProviderStatus == null) { - return new Status(ProviderStatus.STATUS_UPGRADING, null); + return ProviderStatus.STATUS_UPGRADING; } return mProviderStatus; @@ -234,8 +221,7 @@ public class ProviderStatusWatcher extends ContentObserver { if (cursor.moveToFirst()) { // Note here we can't just say "Status", as AsyncTask has the "Status" // enum too. - mProviderStatus = new ProviderStatusWatcher.Status( - cursor.getInt(0), cursor.getString(1)); + mProviderStatus = cursor.getInt(0); return true; } } finally { @@ -283,22 +269,4 @@ public class ProviderStatusWatcher extends ContentObserver { mHandler.removeCallbacks(mStartLoadingRunnable); // Remove one in the queue, if any. mHandler.post(mStartLoadingRunnable); } - - /** - * Sends a provider status update, which will trigger a retry of database upgrade - */ - public static void retryUpgrade(final Context context) { - Log.i(TAG, "retryUpgrade"); - final AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() { - @Override - protected Void doInBackground(Void... params) { - ContentValues values = new ContentValues(); - values.put(ProviderStatus.STATUS, ProviderStatus.STATUS_UPGRADING); - context.getContentResolver().update(ProviderStatus.CONTENT_URI, values, - null, null); - return null; - } - }; - task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } } diff --git a/src/com/android/contacts/list/UiIntentActions.java b/src/com/android/contacts/list/UiIntentActions.java new file mode 100644 index 000000000..c8928956f --- /dev/null +++ b/src/com/android/contacts/list/UiIntentActions.java @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.contacts.list; + +/** + * Intent actions related to the Contacts app UI. In the past we decided to store these in a single + * location in order to easily expose them via ContactsContract. We eventually decided + * this wasn't useful. + */ +public class UiIntentActions { + /** + * The action for the default contacts list tab. + */ + public static final String LIST_DEFAULT = + "com.android.contacts.action.LIST_DEFAULT"; + + /** + * The action for the contacts list tab. + */ + public static final String LIST_GROUP_ACTION = + "com.android.contacts.action.LIST_GROUP"; + + /** + * When in LIST_GROUP_ACTION mode, this is the group to display. + */ + public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP"; + + /** + * The action for the all contacts list tab. + */ + public static final String LIST_ALL_CONTACTS_ACTION = + "com.android.contacts.action.LIST_ALL_CONTACTS"; + + /** + * The action for the contacts with phone numbers list tab. + */ + public static final String LIST_CONTACTS_WITH_PHONES_ACTION = + "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES"; + + /** + * The action for the starred contacts list tab. + */ + public static final String LIST_STARRED_ACTION = + "com.android.contacts.action.LIST_STARRED"; + + /** + * The action for the frequent contacts list tab. + */ + public static final String LIST_FREQUENT_ACTION = + "com.android.contacts.action.LIST_FREQUENT"; + + /** + * The action for the "Join Contact" picker. + */ + public static final String PICK_JOIN_CONTACT_ACTION = + "com.android.contacts.action.JOIN_CONTACT"; + + /** + * The action for the "strequent" contacts list tab. It first lists the starred + * contacts in alphabetical order and then the frequent contacts in descending + * order of the number of times they have been contacted. + */ + public static final String LIST_STREQUENT_ACTION = + "com.android.contacts.action.LIST_STREQUENT"; + + /** + * A key for to be used as an intent extra to set the activity + * title to a custom String value. + */ + public static final String TITLE_EXTRA_KEY = + "com.android.contacts.extra.TITLE_EXTRA"; + + /** + * Activity Action: Display a filtered list of contacts + * <p> + * Input: Extra field {@link #FILTER_TEXT_EXTRA_KEY} is the text to use for + * filtering + * <p> + * Output: Nothing. + */ + public static final String FILTER_CONTACTS_ACTION = + "com.android.contacts.action.FILTER_CONTACTS"; + + /** + * Used as an int extra field in {@link #FILTER_CONTACTS_ACTION} + * intents to supply the text on which to filter. + */ + public static final String FILTER_TEXT_EXTRA_KEY = + "com.android.contacts.extra.FILTER_TEXT"; + + /** + * Used with JOIN_CONTACT action to set the target for aggregation. This action type + * uses contact ids instead of contact uris for the sake of backwards compatibility. + * <p> + * Type: LONG + */ + public static final String TARGET_CONTACT_ID_EXTRA_KEY + = "com.android.contacts.action.CONTACT_ID"; +}
\ No newline at end of file diff --git a/tests/res/values/donottranslate_strings.xml b/tests/res/values/donottranslate_strings.xml index 52ccc9247..c1d462648 100644 --- a/tests/res/values/donottranslate_strings.xml +++ b/tests/res/values/donottranslate_strings.xml @@ -20,13 +20,6 @@ <string-array name="allIntents"> <!-- List modes --> - <item>LIST_DEFAULT</item> - <item>LIST_ALL_CONTACTS_ACTION</item> - <item>LIST_CONTACTS_WITH_PHONES_ACTION (deprecated)</item> - <item>LIST_STARRED_ACTION</item> - <item>LIST_FREQUENT_ACTION</item> - <item>LIST_STREQUENT_ACTION</item> - <item>LIST_GROUP_ACTION</item> <item>VIEW (content uri without any id)</item> <item>ACTION_PICK: contact</item> <item>ACTION_PICK: contact (legacy)</item> diff --git a/tests/src/com/android/contacts/activities/PeopleActivityTest.java b/tests/src/com/android/contacts/activities/PeopleActivityTest.java index 0fbd312f7..0bcc2057a 100644 --- a/tests/src/com/android/contacts/activities/PeopleActivityTest.java +++ b/tests/src/com/android/contacts/activities/PeopleActivityTest.java @@ -117,8 +117,8 @@ public class PeopleActivityTest private void expectProviderStatusQueryAndReturnNormal() { mContactsProvider .expectQuery(ProviderStatus.CONTENT_URI) - .withProjection(ProviderStatus.STATUS, ProviderStatus.DATA1) - .returnRow(ProviderStatus.STATUS_NORMAL, null) + .withProjection(ProviderStatus.STATUS) + .returnRow(ProviderStatus.STATUS_NORMAL) .anyNumberOfTimes(); } diff --git a/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java b/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java index 910fb5c96..59afa6071 100644 --- a/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java +++ b/tests/src/com/android/contacts/tests/allintents/AllIntentsActivity.java @@ -39,7 +39,6 @@ import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.Intents; import android.provider.ContactsContract.Intents.Insert; -import android.provider.ContactsContract.Intents.UI; import android.provider.ContactsContract.RawContacts; import android.view.View; import android.widget.ArrayAdapter; @@ -67,13 +66,6 @@ public class AllIntentsActivity extends ListActivity "com.android.contacts.activities.PeopleActivity"; public enum ContactsIntent { - LIST_DEFAULT, - LIST_ALL_CONTACTS_ACTION, - LIST_CONTACTS_WITH_PHONES_ACTION, - LIST_STARRED_ACTION, - LIST_FREQUENT_ACTION, - LIST_STREQUENT_ACTION, - LIST_GROUP_ACTION, VIEW_CONTACT_WITHOUT_ID, ACTION_PICK_CONTACT, ACTION_PICK_CONTACT_LEGACY, @@ -149,41 +141,6 @@ public class AllIntentsActivity extends ListActivity super.onListItemClick(l, v, position, id); switch (ContactsIntent.get(position)) { - case LIST_DEFAULT: { - startContactListActivity( - new Intent(UI.LIST_DEFAULT, Contacts.CONTENT_URI)); - break; - } - case LIST_ALL_CONTACTS_ACTION: { - startContactListActivity( - new Intent(UI.LIST_ALL_CONTACTS_ACTION, Contacts.CONTENT_URI)); - break; - } - case LIST_CONTACTS_WITH_PHONES_ACTION: { - startContactListActivity( - new Intent(UI.LIST_CONTACTS_WITH_PHONES_ACTION, Contacts.CONTENT_URI)); - break; - } - case LIST_STARRED_ACTION: { - startContactListActivity( - new Intent(UI.LIST_STARRED_ACTION, Contacts.CONTENT_URI)); - break; - } - case LIST_FREQUENT_ACTION: { - startContactListActivity( - new Intent(UI.LIST_FREQUENT_ACTION, Contacts.CONTENT_URI)); - break; - } - case LIST_STREQUENT_ACTION: { - startContactListActivity( - new Intent(UI.LIST_STREQUENT_ACTION, Contacts.CONTENT_URI)); - break; - } - case LIST_GROUP_ACTION: { - startContactListActivity( - new Intent(UI.LIST_GROUP_ACTION, Contacts.CONTENT_URI)); - break; - } case ACTION_PICK_CONTACT: { startContactSelectionActivityForResult( new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI)); @@ -566,15 +523,6 @@ public class AllIntentsActivity extends ListActivity return intent; } - private Intent buildFilterIntent(int actionCode, boolean legacy) { - Intent intent = new Intent(UI.FILTER_CONTACTS_ACTION); - intent.putExtra(UI.FILTER_TEXT_EXTRA_KEY, "A"); -// ContactsRequest request = new ContactsRequest(); -// request.setActionCode(actionCode); -// intent.putExtra("originalRequest", request); - return intent; - } - private void startContactListActivity(Intent intent) { bindIntentToClass(intent, CONTACT_LIST_ACTIVITY_CLASS_NAME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |