Merge "Prefer upsizing a down-sampled picture if size is close enough" into jb-mr1-dev
diff --git a/res/layout/call_log_fragment.xml b/res/layout/call_log_fragment.xml
index 34b4b7f..3646edc 100644
--- a/res/layout/call_log_fragment.xml
+++ b/res/layout/call_log_fragment.xml
@@ -35,10 +35,10 @@
<FrameLayout>
<TextView
android:id="@+id/filter_status"
+ style="@style/ContactListSeparatorTextViewStyle"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingLeft="@dimen/call_log_outer_margin"
- android:paddingRight="@dimen/call_log_outer_margin"
+ android:layout_marginLeft="@dimen/call_log_outer_margin"
+ android:layout_marginRight="@dimen/call_log_outer_margin"
android:paddingTop="@dimen/call_log_inner_margin"
android:paddingBottom="@dimen/call_log_inner_margin"
android:layout_alignParentLeft="true"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8b843b4..d90d0ef 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1610,16 +1610,16 @@
<string name="call_log_old_header">Older</string>
<!-- The header to show that call log is only showing voicemail calls. [CHAR LIMIT=40] -->
- <string name="call_log_voicemail_header">Calls with voicemail</string>
+ <string name="call_log_voicemail_header">Calls with voicemail only</string>
<!-- The header to show that call log is only showing incoming calls. [CHAR LIMIT=40] -->
- <string name="call_log_incoming_header">Incoming calls</string>
+ <string name="call_log_incoming_header">Incoming calls only</string>
<!-- The header to show that call log is only showing outgoing calls. [CHAR LIMIT=40] -->
- <string name="call_log_outgoing_header">Outgoing calls</string>
+ <string name="call_log_outgoing_header">Outgoing calls only</string>
<!-- The header to show that call log is only showing missed calls. [CHAR LIMIT=40] -->
- <string name="call_log_missed_header">Missed calls</string>
+ <string name="call_log_missed_header">Missed calls only</string>
<!-- Voicemail status message shown at the top of call log to notify the user that no new
voicemails are currently available. This can happen when both notification as well as data
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index 15b33ab..05eb4f6 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -228,9 +228,6 @@
* numbers.
*/
public static Uri getCallUri(String number) {
- if (PhoneNumberUtils.isVoiceMailNumber(number)) {
- return Uri.parse("voicemail:");
- }
if (PhoneNumberUtils.isUriNumber(number)) {
return Uri.fromParts(Constants.SCHEME_SIP, number, null);
}
diff --git a/src/com/android/contacts/calllog/CallLogFragment.java b/src/com/android/contacts/calllog/CallLogFragment.java
index f9d21c0..3a1a152 100644
--- a/src/com/android/contacts/calllog/CallLogFragment.java
+++ b/src/com/android/contacts/calllog/CallLogFragment.java
@@ -21,7 +21,6 @@
import android.app.ListFragment;
import android.content.Context;
import android.content.Intent;
-import android.content.SharedPreferences;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
@@ -29,7 +28,6 @@
import android.os.Handler;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.preference.PreferenceManager;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract;
@@ -71,8 +69,6 @@
*/
private static final int EMPTY_LOADER_ID = 0;
- private static final String PREF_CALL_LOG_FILTER_LAST_CALL_TYPE = "CallLogFragment_last_filter";
-
private CallLogAdapter mAdapter;
private CallLogQueryHandler mCallLogQueryHandler;
private boolean mScrollToTop;
@@ -128,11 +124,6 @@
getActivity().getContentResolver().registerContentObserver(
ContactsContract.Contacts.CONTENT_URI, true, mContactsObserver);
setHasOptionsMenu(true);
-
- // Load the last filter used.
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
- mCallTypeFilter = prefs.getInt(PREF_CALL_LOG_FILTER_LAST_CALL_TYPE,
- CallLogQueryHandler.CALL_TYPE_ALL);
}
/** Called by the CallLogQueryHandler when the list of calls has been fetched or updated. */
@@ -297,11 +288,6 @@
super.onPause();
// Kill the requests thread
mAdapter.stopRequestProcessing();
-
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
- prefs.edit()
- .putInt(PREF_CALL_LOG_FILTER_LAST_CALL_TYPE, mCallTypeFilter)
- .apply();
}
@Override
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 1f4cb45..66c1686 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -1395,7 +1395,9 @@
@Override
public void onAggregationSuggestionChange() {
- if (!isAdded() || mState == null || mStatus != Status.EDITING) {
+ Activity activity = getActivity();
+ if ((activity != null && activity.isFinishing())
+ || !isVisible() || mState == null || mStatus != Status.EDITING) {
return;
}
diff --git a/src/com/android/contacts/model/AccountTypeManager.java b/src/com/android/contacts/model/AccountTypeManager.java
index 64f3a91..b4a3e2b 100644
--- a/src/com/android/contacts/model/AccountTypeManager.java
+++ b/src/com/android/contacts/model/AccountTypeManager.java
@@ -410,8 +410,8 @@
AccountType accountType;
if (GoogleAccountType.ACCOUNT_TYPE.equals(type)) {
accountType = new GoogleAccountType(mContext, auth.packageName);
- } else if (ExchangeAccountType.ACCOUNT_TYPE.equals(type)) {
- accountType = new ExchangeAccountType(mContext, auth.packageName);
+ } else if (ExchangeAccountType.isExchangeType(type)) {
+ accountType = new ExchangeAccountType(mContext, auth.packageName, type);
} else {
// TODO: use syncadapter package instead, since it provides resources
Log.d(TAG, "Registering external account type=" + type
diff --git a/src/com/android/contacts/model/account/ExchangeAccountType.java b/src/com/android/contacts/model/account/ExchangeAccountType.java
index 5ca3308..28b1f5c 100644
--- a/src/com/android/contacts/model/account/ExchangeAccountType.java
+++ b/src/com/android/contacts/model/account/ExchangeAccountType.java
@@ -41,10 +41,11 @@
public class ExchangeAccountType extends BaseAccountType {
private static final String TAG = "ExchangeAccountType";
- public static final String ACCOUNT_TYPE = "com.android.exchange";
+ public static final String ACCOUNT_TYPE_AOSP = "com.android.exchange";
+ public static final String ACCOUNT_TYPE_GOOGLE = "com.google.android.exchange";
- public ExchangeAccountType(Context context, String authenticatorPackageName) {
- this.accountType = ACCOUNT_TYPE;
+ public ExchangeAccountType(Context context, String authenticatorPackageName, String type) {
+ this.accountType = type;
this.resourcePackageName = null;
this.syncAdapterPackageName = authenticatorPackageName;
@@ -70,6 +71,10 @@
}
}
+ public static boolean isExchangeType(String type) {
+ return ACCOUNT_TYPE_AOSP.equals(type) || ACCOUNT_TYPE_GOOGLE.equals(type);
+ }
+
@Override
protected DataKind addDataKindStructuredName(Context context) throws DefinitionException {
DataKind kind = addKind(new DataKind(StructuredName.CONTENT_ITEM_TYPE,
diff --git a/src/com/android/contacts/vcard/ImportVCardActivity.java b/src/com/android/contacts/vcard/ImportVCardActivity.java
index a9566ef..9af2d52 100644
--- a/src/com/android/contacts/vcard/ImportVCardActivity.java
+++ b/src/com/android/contacts/vcard/ImportVCardActivity.java
@@ -760,9 +760,11 @@
runOnUiThread(new Runnable() {
@Override
public void run() {
- mVCardCacheThread = new VCardCacheThread(uris);
- mListener = new NotificationImportExportListener(ImportVCardActivity.this);
- showDialog(R.id.dialog_cache_vcard);
+ if (!isFinishing()) {
+ mVCardCacheThread = new VCardCacheThread(uris);
+ mListener = new NotificationImportExportListener(ImportVCardActivity.this);
+ showDialog(R.id.dialog_cache_vcard);
+ }
}
});
}
diff --git a/tests/src/com/android/contacts/RawContactModifierTests.java b/tests/src/com/android/contacts/RawContactModifierTests.java
index 9254a7e..8046ed6 100644
--- a/tests/src/com/android/contacts/RawContactModifierTests.java
+++ b/tests/src/com/android/contacts/RawContactModifierTests.java
@@ -77,6 +77,8 @@
private static final String TEST_ACCOUNT_NAME = "unittest@example.com";
private static final String TEST_ACCOUNT_TYPE = "com.example.unittest";
+ private static final String EXCHANGE_ACCT_TYPE = "com.android.exchange";
+
@Override
public void setUp() {
mContext = getContext();
@@ -770,7 +772,7 @@
public void testMigrateWithDisplayNameFromGoogleToExchange1() {
AccountType oldAccountType = new GoogleAccountType(getContext(), "");
- AccountType newAccountType = new ExchangeAccountType(getContext(), "");
+ AccountType newAccountType = new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE);
DataKind kind = newAccountType.getKindForMimetype(StructuredName.CONTENT_ITEM_TYPE);
ContactsMockContext context = new ContactsMockContext(getContext());
@@ -806,7 +808,7 @@
public void testMigrateWithDisplayNameFromGoogleToExchange2() {
AccountType oldAccountType = new GoogleAccountType(getContext(), "");
- AccountType newAccountType = new ExchangeAccountType(getContext(), "");
+ AccountType newAccountType = new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE);
DataKind kind = newAccountType.getKindForMimetype(StructuredName.CONTENT_ITEM_TYPE);
ContactsMockContext context = new ContactsMockContext(getContext());
@@ -846,7 +848,7 @@
}
public void testMigrateWithStructuredNameFromExchangeToGoogle() {
- AccountType oldAccountType = new ExchangeAccountType(getContext(), "");
+ AccountType oldAccountType = new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE);
AccountType newAccountType = new GoogleAccountType(getContext(), "");
DataKind kind = newAccountType.getKindForMimetype(StructuredName.CONTENT_ITEM_TYPE);
@@ -891,7 +893,7 @@
public void testMigratePostalFromGoogleToExchange() {
AccountType oldAccountType = new GoogleAccountType(getContext(), "");
- AccountType newAccountType = new ExchangeAccountType(getContext(), "");
+ AccountType newAccountType = new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE);
DataKind kind = newAccountType.getKindForMimetype(StructuredPostal.CONTENT_ITEM_TYPE);
RawContactDelta oldState = new RawContactDelta();
@@ -913,7 +915,7 @@
}
public void testMigratePostalFromExchangeToGoogle() {
- AccountType oldAccountType = new ExchangeAccountType(getContext(), "");
+ AccountType oldAccountType = new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE);
AccountType newAccountType = new GoogleAccountType(getContext(), "");
DataKind kind = newAccountType.getKindForMimetype(StructuredPostal.CONTENT_ITEM_TYPE);
@@ -948,11 +950,11 @@
public void testMigrateEventFromGoogleToExchange1() {
testMigrateEventCommon(new GoogleAccountType(getContext(), ""),
- new ExchangeAccountType(getContext(), ""));
+ new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE));
}
public void testMigrateEventFromExchangeToGoogle() {
- testMigrateEventCommon(new ExchangeAccountType(getContext(), ""),
+ testMigrateEventCommon(new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE),
new GoogleAccountType(getContext(), ""));
}
@@ -980,7 +982,7 @@
public void testMigrateEventFromGoogleToExchange2() {
AccountType oldAccountType = new GoogleAccountType(getContext(), "");
- AccountType newAccountType = new ExchangeAccountType(getContext(), "");
+ AccountType newAccountType = new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE);
DataKind kind = newAccountType.getKindForMimetype(Event.CONTENT_ITEM_TYPE);
RawContactDelta oldState = new RawContactDelta();
@@ -1012,7 +1014,7 @@
public void testMigrateEmailFromGoogleToExchange() {
AccountType oldAccountType = new GoogleAccountType(getContext(), "");
- AccountType newAccountType = new ExchangeAccountType(getContext(), "");
+ AccountType newAccountType = new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE);
DataKind kind = newAccountType.getKindForMimetype(Email.CONTENT_ITEM_TYPE);
RawContactDelta oldState = new RawContactDelta();
@@ -1062,7 +1064,7 @@
public void testMigrateImFromGoogleToExchange() {
AccountType oldAccountType = new GoogleAccountType(getContext(), "");
- AccountType newAccountType = new ExchangeAccountType(getContext(), "");
+ AccountType newAccountType = new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE);
DataKind kind = newAccountType.getKindForMimetype(Im.CONTENT_ITEM_TYPE);
RawContactDelta oldState = new RawContactDelta();
@@ -1129,7 +1131,7 @@
public void testMigratePhoneFromGoogleToExchange() {
AccountType oldAccountType = new GoogleAccountType(getContext(), "");
- AccountType newAccountType = new ExchangeAccountType(getContext(), "");
+ AccountType newAccountType = new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE);
DataKind kind = newAccountType.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
// Create 5 numbers.
@@ -1207,7 +1209,7 @@
public void testMigrateOrganizationFromGoogleToExchange() {
AccountType oldAccountType = new GoogleAccountType(getContext(), "");
- AccountType newAccountType = new ExchangeAccountType(getContext(), "");
+ AccountType newAccountType = new ExchangeAccountType(getContext(), "", EXCHANGE_ACCT_TYPE);
DataKind kind = newAccountType.getKindForMimetype(Organization.CONTENT_ITEM_TYPE);
RawContactDelta oldState = new RawContactDelta();