am 8668f83e: Merge "Match contact list items to redlines for Dialer." into lmp-preview-dev
* commit '8668f83e7c37027870ffe2ea5c72d9977f9fc0e1':
Match contact list items to redlines for Dialer.
diff --git a/src/com/android/contacts/common/ContactPhotoManager.java b/src/com/android/contacts/common/ContactPhotoManager.java
index b3dbd31..213a7a2 100644
--- a/src/com/android/contacts/common/ContactPhotoManager.java
+++ b/src/com/android/contacts/common/ContactPhotoManager.java
@@ -1514,7 +1514,7 @@
Log.v(TAG, "Cannot load photo " + uri);
cacheBitmap(originalUri, null, false, uriRequest.getRequestedExtent());
}
- } catch (Exception ex) {
+ } catch (final Exception | OutOfMemoryError ex) {
Log.v(TAG, "Cannot load photo " + uri, ex);
cacheBitmap(originalUri, null, false, uriRequest.getRequestedExtent());
}
diff --git a/src/com/android/contacts/common/ContactsUtils.java b/src/com/android/contacts/common/ContactsUtils.java
index 038ec26..b30bbd6 100644
--- a/src/com/android/contacts/common/ContactsUtils.java
+++ b/src/com/android/contacts/common/ContactsUtils.java
@@ -25,7 +25,7 @@
import android.text.TextUtils;
import com.android.contacts.common.model.account.AccountWithDataSet;
-import com.android.contacts.common.test.NeededForTesting;
+import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.model.AccountTypeManager;
import java.util.List;
diff --git a/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java b/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java
index 232fcad..bcd00df 100644
--- a/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java
+++ b/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java
@@ -97,7 +97,10 @@
}
};
- if (TelephonyManager.getDefault().hasIccCard()
+ final TelephonyManager manager =
+ (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
+
+ if (manager != null && manager.hasIccCard()
&& res.getBoolean(R.bool.config_allow_sim_import)) {
adapter.add(R.string.import_from_sim);
}
diff --git a/src/com/android/contacts/common/list/ContactListItemView.java b/src/com/android/contacts/common/list/ContactListItemView.java
index da452cf..04acfb5 100644
--- a/src/com/android/contacts/common/list/ContactListItemView.java
+++ b/src/com/android/contacts/common/list/ContactListItemView.java
@@ -335,7 +335,7 @@
// Also calculate their heights to get the total height for this entire view.
if (isVisible(mNameTextView)) {
- // Claculate width for name text - this parallels similar measurement in onLayout.
+ // Calculate width for name text - this parallels similar measurement in onLayout.
int nameTextWidth = effectiveWidth;
if (mPhotoPosition != PhotoPosition.LEFT) {
nameTextWidth -= mTextIndent;
diff --git a/src/com/android/contacts/common/model/AccountTypeManager.java b/src/com/android/contacts/common/model/AccountTypeManager.java
index 45af346..7287880 100644
--- a/src/com/android/contacts/common/model/AccountTypeManager.java
+++ b/src/com/android/contacts/common/model/AccountTypeManager.java
@@ -52,7 +52,7 @@
import com.android.contacts.common.model.account.FallbackAccountType;
import com.android.contacts.common.model.account.GoogleAccountType;
import com.android.contacts.common.model.dataitem.DataKind;
-import com.android.contacts.common.test.NeededForTesting;
+import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.util.Constants;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
diff --git a/src/com/android/contacts/common/model/RawContactDelta.java b/src/com/android/contacts/common/model/RawContactDelta.java
index 7a20041..7304f02 100644
--- a/src/com/android/contacts/common/model/RawContactDelta.java
+++ b/src/com/android/contacts/common/model/RawContactDelta.java
@@ -32,7 +32,7 @@
import com.android.contacts.common.model.AccountTypeManager;
import com.android.contacts.common.model.ValuesDelta;
import com.android.contacts.common.model.account.AccountType;
-import com.android.contacts.common.test.NeededForTesting;
+import com.android.contacts.common.testing.NeededForTesting;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
diff --git a/src/com/android/contacts/common/model/ValuesDelta.java b/src/com/android/contacts/common/model/ValuesDelta.java
index 84e41a6..e30cdd6 100644
--- a/src/com/android/contacts/common/model/ValuesDelta.java
+++ b/src/com/android/contacts/common/model/ValuesDelta.java
@@ -24,7 +24,7 @@
import android.provider.BaseColumns;
import android.provider.ContactsContract;
-import com.android.contacts.common.test.NeededForTesting;
+import com.android.contacts.common.testing.NeededForTesting;
import com.google.common.collect.Sets;
import java.util.HashSet;
diff --git a/src/com/android/contacts/common/model/account/BaseAccountType.java b/src/com/android/contacts/common/model/account/BaseAccountType.java
index 7a4339a..2969618 100644
--- a/src/com/android/contacts/common/model/account/BaseAccountType.java
+++ b/src/com/android/contacts/common/model/account/BaseAccountType.java
@@ -40,7 +40,7 @@
import com.android.contacts.common.R;
import com.android.contacts.common.model.dataitem.DataKind;
-import com.android.contacts.common.test.NeededForTesting;
+import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.util.CommonDateUtils;
import com.android.contacts.common.util.ContactDisplayUtils;
import com.google.common.collect.Lists;
diff --git a/src/com/android/contacts/common/model/account/FallbackAccountType.java b/src/com/android/contacts/common/model/account/FallbackAccountType.java
index 71c23c2..be3709e 100644
--- a/src/com/android/contacts/common/model/account/FallbackAccountType.java
+++ b/src/com/android/contacts/common/model/account/FallbackAccountType.java
@@ -21,7 +21,7 @@
import com.android.contacts.common.R;
import com.android.contacts.common.model.dataitem.DataKind;
-import com.android.contacts.common.test.NeededForTesting;
+import com.android.contacts.common.testing.NeededForTesting;
public class FallbackAccountType extends BaseAccountType {
private static final String TAG = "FallbackAccountType";
diff --git a/src/com/android/contacts/common/test/InjectedServices.java b/src/com/android/contacts/common/testing/InjectedServices.java
similarity index 93%
rename from src/com/android/contacts/common/test/InjectedServices.java
rename to src/com/android/contacts/common/testing/InjectedServices.java
index 75ad938..e89cec7 100644
--- a/src/com/android/contacts/common/test/InjectedServices.java
+++ b/src/com/android/contacts/common/testing/InjectedServices.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.contacts.common.test;
+package com.android.contacts.common.testing;
import android.content.ContentResolver;
import android.content.SharedPreferences;
@@ -29,13 +29,14 @@
* while running tests. Activities, Services and the Application should check
* with this class to see if a particular service has been overridden.
*/
+@NeededForTesting
public class InjectedServices {
private ContentResolver mContentResolver;
private SharedPreferences mSharedPreferences;
private HashMap<String, Object> mSystemServices;
- @VisibleForTesting
+ @NeededForTesting
public void setContentResolver(ContentResolver contentResolver) {
this.mContentResolver = contentResolver;
}
@@ -44,7 +45,7 @@
return mContentResolver;
}
- @VisibleForTesting
+ @NeededForTesting
public void setSharedPreferences(SharedPreferences sharedPreferences) {
this.mSharedPreferences = sharedPreferences;
}
@@ -53,7 +54,7 @@
return mSharedPreferences;
}
- @VisibleForTesting
+ @NeededForTesting
public void setSystemService(String name, Object service) {
if (mSystemServices == null) {
mSystemServices = Maps.newHashMap();
diff --git a/src/com/android/contacts/common/test/NeededForTesting.java b/src/com/android/contacts/common/testing/NeededForTesting.java
similarity index 95%
rename from src/com/android/contacts/common/test/NeededForTesting.java
rename to src/com/android/contacts/common/testing/NeededForTesting.java
index f82756a..f841d55 100644
--- a/src/com/android/contacts/common/test/NeededForTesting.java
+++ b/src/com/android/contacts/common/testing/NeededForTesting.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.contacts.common.test;
+package com.android.contacts.common.testing;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/tests/src/com/android/contacts/common/model/ContactLoaderTest.java b/tests/src/com/android/contacts/common/model/ContactLoaderTest.java
index 2f1318a..4cecdf8 100644
--- a/tests/src/com/android/contacts/common/model/ContactLoaderTest.java
+++ b/tests/src/com/android/contacts/common/model/ContactLoaderTest.java
@@ -34,7 +34,7 @@
import com.android.contacts.common.model.account.AccountType;
import com.android.contacts.common.model.account.AccountWithDataSet;
import com.android.contacts.common.model.account.BaseAccountType;
-import com.android.contacts.common.test.InjectedServices;
+import com.android.contacts.common.testing.InjectedServices;
import com.android.contacts.common.test.mocks.MockAccountTypeManager;
/**
@@ -338,7 +338,7 @@
contactId,
rawContactId,
- "mockAccountName", "mockAccountType", null, "mockAccountType",
+ "mockAccountName", "mockAccountType", null,
0, 1, 0,
"sync1", "sync2", "sync3", "sync4",
0, 0,
@@ -351,7 +351,7 @@
"syn1", "syn2", "syn3", "syn4",
0, 0,
- 0, StructuredName.CONTENT_ITEM_TYPE, "mockPkg2",
+ 0, StructuredName.CONTENT_ITEM_TYPE,
"groupId",