[automerger skipped] Import translations. DO NOT MERGE am: 9df2f3459d -s ours
am skip reason: subject contains skip directive
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Contacts/+/12082186
Change-Id: Ic5867cbc90124ffccb99834704fc9ee0880b6665
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..1fd8e8b
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,37 @@
+android_app {
+ name: "Contacts",
+
+ srcs: [
+ "src/**/*.java",
+ "src-bind/**/*.java",
+ ],
+
+ static_libs: [
+ "com.android.phone.common-lib",
+
+ "com.google.android.material_material",
+ "androidx.transition_transition",
+ "androidx.legacy_legacy-support-v13",
+ "androidx.appcompat_appcompat",
+ "androidx.cardview_cardview",
+ "androidx.recyclerview_recyclerview",
+ "androidx.palette_palette",
+ "androidx.legacy_legacy-support-v4",
+ "android-common",
+ "com.android.vcard",
+ "guava",
+ "libphonenumber",
+ ],
+
+ certificate: "shared",
+ product_specific: true,
+ privileged: true,
+ required: ["privapp_whitelist_com.android.contacts"],
+
+ optimize: {
+ proguard_flags_files: ["proguard.flags"],
+ },
+
+ sdk_version: "current",
+ min_sdk_version: "21",
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 2a3a485..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,52 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-phone_common_dir := ../PhoneCommon
-
-src_dirs := src src-bind $(phone_common_dir)/src
-res_dirs := res $(phone_common_dir)/res
-asset_dirs := assets
-
-LOCAL_SRC_FILES := $(call all-java-files-under, $(src_dirs))
-LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
-LOCAL_ASSET_DIR := $(addprefix $(LOCAL_PATH)/, $(asset_dirs))
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
- com.google.android.material_material \
- androidx.transition_transition \
- androidx.legacy_legacy-support-v13 \
- androidx.appcompat_appcompat \
- androidx.cardview_cardview \
- androidx.recyclerview_recyclerview \
- androidx.palette_palette \
- androidx.legacy_legacy-support-v4
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- android-common \
- com.android.vcard \
- guava \
- libphonenumber
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_AAPT_FLAGS := \
- --auto-add-overlay \
- --extra-packages com.android.phone.common
-
-LOCAL_PACKAGE_NAME := Contacts
-LOCAL_CERTIFICATE := shared
-LOCAL_PRODUCT_MODULE := true
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.contacts
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 21
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b0783d4..e0814c1 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -21,7 +21,7 @@
<uses-sdk
android:minSdkVersion="21"
- android:targetSdkVersion="28"/>
+ android:targetSdkVersion="29"/>
<original-package android:name="com.android.contacts"/>
diff --git a/res/values-ja/donottranslate_config.xml b/res/values-ja/donottranslate_config.xml
index ff8a8eb..b357856 100644
--- a/res/values-ja/donottranslate_config.xml
+++ b/res/values-ja/donottranslate_config.xml
@@ -32,7 +32,4 @@
<!-- If true, the order of name fields in the editor is primary (i.e. given name first) -->
<bool name="config_editor_field_order_primary">false</bool>
-
- <!-- If true, phonetic name is included in the contact editor by default -->
- <bool name="config_editor_include_phonetic_name">true</bool>
</resources>
diff --git a/src/com/android/contacts/SimImportFragment.java b/src/com/android/contacts/SimImportFragment.java
index 6042939..cee1b1a 100644
--- a/src/com/android/contacts/SimImportFragment.java
+++ b/src/com/android/contacts/SimImportFragment.java
@@ -55,6 +55,7 @@
import com.google.common.base.Function;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
import java.util.ArrayList;
import java.util.Arrays;
@@ -477,7 +478,7 @@
simLoadResult.accounts = accounts;
return simLoadResult;
}
- });
+ }, MoreExecutors.directExecutor());
}
private LoaderResult loadFromSim() {
diff --git a/src/com/android/contacts/drawer/DrawerAdapter.java b/src/com/android/contacts/drawer/DrawerAdapter.java
index 0c8423a..b5a1ea7 100644
--- a/src/com/android/contacts/drawer/DrawerAdapter.java
+++ b/src/com/android/contacts/drawer/DrawerAdapter.java
@@ -271,16 +271,16 @@
result.setId(item.id);
}
final ContactListFilter account = item.account;
+ final AccountDisplayInfo displayableAccount =
+ mAccountDisplayFactory.getAccountDisplayInfoFor(item.account);
final TextView textView = ((TextView) result.findViewById(R.id.title));
- textView.setText(account.accountName);
+ textView.setText(displayableAccount.getNameLabel());
final boolean activated = account.equals(mSelectedAccount)
&& mSelectedView == ContactsView.ACCOUNT_VIEW;
textView.setTextAppearance(mActivity, activated
? TYPEFACE_STYLE_ACTIVATE : TYPEFACE_STYLE_INACTIVE);
final ImageView icon = (ImageView) result.findViewById(R.id.icon);
- final AccountDisplayInfo displayableAccount =
- mAccountDisplayFactory.getAccountDisplayInfoFor(item.account);
icon.setScaleType(ImageView.ScaleType.FIT_CENTER);
icon.setImageDrawable(displayableAccount.getIcon());
diff --git a/src/com/android/contacts/model/AccountTypeManager.java b/src/com/android/contacts/model/AccountTypeManager.java
index f67f074..196e67f 100644
--- a/src/com/android/contacts/model/AccountTypeManager.java
+++ b/src/com/android/contacts/model/AccountTypeManager.java
@@ -59,6 +59,7 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
import java.util.ArrayList;
import java.util.Collections;
@@ -404,28 +405,26 @@
ContentResolver.addStatusChangeListener(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS, this);
- if (Flags.getInstance().getBoolean(Experiments.CP2_DEVICE_ACCOUNT_DETECTION_ENABLED)) {
- // Observe changes to RAW_CONTACTS so that we will update the list of "Device" accounts
- // if a new device contact is added.
- mContext.getContentResolver().registerContentObserver(
- ContactsContract.RawContacts.CONTENT_URI, /* notifyDescendents */ true,
- new ContentObserver(mMainThreadHandler) {
- @Override
- public boolean deliverSelfNotifications() {
- return true;
- }
+ // Observe changes to RAW_CONTACTS so that we will update the list of "Device" accounts
+ // if a new device contact is added or removed.
+ mContext.getContentResolver().registerContentObserver(
+ ContactsContract.RawContacts.CONTENT_URI, /* notifyDescendents */ true,
+ new ContentObserver(mMainThreadHandler) {
+ @Override
+ public boolean deliverSelfNotifications() {
+ return true;
+ }
- @Override
- public void onChange(boolean selfChange) {
- reloadLocalAccounts();
- }
+ @Override
+ public void onChange(boolean selfChange) {
+ reloadLocalAccounts();
+ }
- @Override
- public void onChange(boolean selfChange, Uri uri) {
- reloadLocalAccounts();
- }
- });
- }
+ @Override
+ public void onChange(boolean selfChange, Uri uri) {
+ reloadLocalAccounts();
+ }
+ });
loadAccountTypes();
}
@@ -503,7 +502,8 @@
private synchronized void reloadAccountTypes() {
loadAccountTypes();
Futures.addCallback(
- Futures.transform(mAccountTypesFuture, mAccountsExtractor),
+ Futures.transform(mAccountTypesFuture, mAccountsExtractor,
+ MoreExecutors.directExecutor()),
newAccountsUpdatedCallback(mAccountManagerAccounts),
mMainThreadExecutor);
}
@@ -534,7 +534,8 @@
final ListenableFuture<List<List<AccountWithDataSet>>> all =
Futures.nonCancellationPropagating(
Futures.successfulAsList(
- Futures.transform(mAccountTypesFuture, mAccountsExtractor),
+ Futures.transform(mAccountTypesFuture, mAccountsExtractor,
+ MoreExecutors.directExecutor()),
mLocalAccountsFuture));
return Futures.transform(all, new Function<List<List<AccountWithDataSet>>,
@@ -560,7 +561,7 @@
AccountInfo.sortAccounts(null, result);
return result;
}
- });
+ }, MoreExecutors.directExecutor());
}
@Override
diff --git a/src/com/android/contacts/model/DeviceLocalAccountLocator.java b/src/com/android/contacts/model/DeviceLocalAccountLocator.java
index 4281de9..2b987d3 100644
--- a/src/com/android/contacts/model/DeviceLocalAccountLocator.java
+++ b/src/com/android/contacts/model/DeviceLocalAccountLocator.java
@@ -18,6 +18,8 @@
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
+import android.database.Cursor;
+import android.provider.ContactsContract;
import com.android.contacts.Experiments;
import com.android.contacts.model.account.AccountWithDataSet;
@@ -69,23 +71,25 @@
return new Cp2DeviceLocalAccountLocator(context.getContentResolver(),
ObjectFactory.getDeviceLocalAccountTypeFactory(context), knownTypes);
} else {
- return new NexusDeviceAccountLocator(accountManager);
+ return new NexusDeviceAccountLocator(context, accountManager);
}
}
/**
* On Nexus the "device" account uses "null" values for the account name and type columns
*
- * <p>However, the focus sync adapter automatically migrates contacts from this null
- * account to a Google account if one exists. Hence, the device account should be returned
- * only when there is no Google Account added
+ * <p>However, the focus sync adapter migrates contacts from this null account to a Google
+ * account if one exists. Hence, the device account should be returned only when there is no
+ * Google Account added or when there already exists contacts in the null account.
* </p>
*/
public static class NexusDeviceAccountLocator extends DeviceLocalAccountLocator {
-
+ private final Context mContext;
private final AccountManager mAccountManager;
- public NexusDeviceAccountLocator(AccountManager accountManager) {
+
+ public NexusDeviceAccountLocator(Context context, AccountManager accountManager) {
+ mContext = context;
mAccountManager = accountManager;
}
@@ -95,7 +99,7 @@
final Account[] accounts = mAccountManager
.getAccountsByType(GoogleAccountType.ACCOUNT_TYPE);
- if (accounts.length > 0) {
+ if (accounts.length > 0 && !AccountWithDataSet.getNullAccount().hasData(mContext)) {
return Collections.emptyList();
} else {
return Collections.singletonList(AccountWithDataSet.getNullAccount());
diff --git a/src/com/android/contacts/util/concurrent/FuturesUtil.java b/src/com/android/contacts/util/concurrent/FuturesUtil.java
index 113af93..ba72446 100644
--- a/src/com/android/contacts/util/concurrent/FuturesUtil.java
+++ b/src/com/android/contacts/util/concurrent/FuturesUtil.java
@@ -3,9 +3,10 @@
import android.os.Handler;
-import com.google.common.util.concurrent.FutureFallback;
+import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ScheduledExecutorService;
@@ -46,14 +47,14 @@
}
}, time, unit);
- return Futures.withFallback(future, new FutureFallback<V>() {
+ return Futures.catchingAsync(future, Throwable.class, new AsyncFunction<Throwable, V>() {
@Override
- public ListenableFuture<V> create(Throwable t) throws Exception {
+ public ListenableFuture<V> apply(Throwable t) throws Exception {
if ((t instanceof CancellationException) && didTimeout.get()) {
return Futures.immediateFailedFuture(new TimeoutException("Timeout expired"));
}
return Futures.immediateFailedFuture(t);
}
- });
+ }, MoreExecutors.directExecutor());
}
}
diff --git a/tests/Android.bp b/tests/Android.bp
new file mode 100644
index 0000000..2e1d47b
--- /dev/null
+++ b/tests/Android.bp
@@ -0,0 +1,27 @@
+android_test {
+ name: "ContactsTests",
+
+ certificate: "shared",
+
+ srcs: ["src/**/*.java"],
+
+ instrumentation_for: "Contacts",
+
+ sdk_version: "current",
+ min_sdk_version: "21",
+
+ static_libs: [
+ "androidx.test.rules",
+ "hamcrest-library",
+ "mockito-target-minus-junit4",
+ "ub-uiautomator",
+ ],
+
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ "android.test.mock.stubs",
+ ],
+
+ test_suites: ["general-tests"],
+}
diff --git a/tests/Android.mk b/tests/Android.mk
deleted file mode 100644
index ce4e6ad..0000000
--- a/tests/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-LOCAL_CERTIFICATE := shared
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-res_dirs := res
-LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs))
-
-LOCAL_PACKAGE_NAME := ContactsTests
-
-LOCAL_INSTRUMENTATION_FOR := Contacts
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 21
-
-LOCAL_STATIC_JAVA_LIBRARIES += \
- androidx.test.rules \
- hamcrest-library \
- mockito-target-minus-junit4 \
- ub-uiautomator
-
-LOCAL_JAVA_LIBRARIES := \
- android.test.runner.stubs \
- android.test.base.stubs \
- android.test.mock.stubs \
-
-
-LOCAL_AAPT_FLAGS := \
- --auto-add-overlay \
- --extra-packages com.android.contacts.common.tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index dfc40a9..f61efda 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -17,7 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.contacts.tests">
- <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
+ <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
diff --git a/tests/AndroidTest.xml b/tests/AndroidTest.xml
new file mode 100644
index 0000000..5665490
--- /dev/null
+++ b/tests/AndroidTest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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.
+-->
+<configuration description="Runs Tests for Contacts.">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="ContactsTests.apk" />
+ </target_preparer>
+
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-tag" value="ContactsTests" />
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="com.android.contacts.tests" />
+ <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
+ <option name="hidden-api-checks" value="false"/>
+ </test>
+</configuration>
diff --git a/tests/README b/tests/README
new file mode 100644
index 0000000..43d905c
--- /dev/null
+++ b/tests/README
@@ -0,0 +1,13 @@
+# Running tests
+
+Build and install Contacts.apk
+
+Grant Contacts permissions to Contacts.apk
+
+Run
+```shell
+$ atest ContactsTests
+```
+
+More information can be found at
+https://source.android.com/compatibility/tests/development/atest
diff --git a/tests/src/com/android/contacts/activities/SimImportActivityTest.java b/tests/src/com/android/contacts/activities/SimImportActivityTest.java
index 9c90426..7069ef1 100644
--- a/tests/src/com/android/contacts/activities/SimImportActivityTest.java
+++ b/tests/src/com/android/contacts/activities/SimImportActivityTest.java
@@ -327,9 +327,9 @@
mDevice.findObject(By.textContains(targetAccount.name)).click();
mDevice.waitForIdle();
- assertTrue(mDevice.wait(Until.hasObject(By.text("Import One").checked(false).enabled(false)), TIMEOUT));
- assertTrue(mDevice.hasObject(By.text("Import Three").checked(false).enabled(false)));
- assertTrue(mDevice.hasObject(By.text("Import Six").checked(false).enabled(false)));
+ assertTrue(mDevice.wait(Until.hasObject(By.text("Import One").checked(false)), TIMEOUT));
+ assertTrue(mDevice.hasObject(By.text("Import Three").checked(false)));
+ assertTrue(mDevice.hasObject(By.text("Import Six").checked(false)));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
contactsProviderClient.close();
diff --git a/tests/src/com/android/contacts/model/AccountTypeManagerTest.java b/tests/src/com/android/contacts/model/AccountTypeManagerTest.java
index 982517b..dfcb390 100644
--- a/tests/src/com/android/contacts/model/AccountTypeManagerTest.java
+++ b/tests/src/com/android/contacts/model/AccountTypeManagerTest.java
@@ -96,7 +96,7 @@
}
public void testGetDefaultAccount_NoAccounts_DefaultPreferenceSet() {
- when(mPrefs.getString(Mockito.anyString(), Mockito.anyString())).thenReturn(
+ when(mPrefs.getString(Mockito.anyString(), Mockito.any())).thenReturn(
getDefaultAccountPreference("name1", GoogleAccountType.ACCOUNT_TYPE));
assertNull(getDefaultGoogleAccountName());
}
@@ -108,21 +108,21 @@
public void testGetDefaultAccount_DefaultAccountPreferenceSet() {
when(mAccountManager.getAccountsByType(Mockito.anyString())).thenReturn(ACCOUNTS);
- when(mPrefs.getString(Mockito.anyString(), Mockito.anyString())).thenReturn(
+ when(mPrefs.getString(Mockito.anyString(), Mockito.any())).thenReturn(
getDefaultAccountPreference("name2", GoogleAccountType.ACCOUNT_TYPE));
assertEquals("name2", getDefaultGoogleAccountName());
}
public void testGetDefaultAccount_DefaultAccountPreferenceSet_NonGoogleAccountType() {
when(mAccountManager.getAccountsByType(Mockito.anyString())).thenReturn(ACCOUNTS);
- when(mPrefs.getString(Mockito.anyString(), Mockito.anyString())).thenReturn(
+ when(mPrefs.getString(Mockito.anyString(), Mockito.any())).thenReturn(
getDefaultAccountPreference("name3", "type3"));
assertEquals("name1", getDefaultGoogleAccountName());
}
public void testGetDefaultAccount_DefaultAccountPreferenceSet_UnknownName() {
when(mAccountManager.getAccountsByType(Mockito.anyString())).thenReturn(ACCOUNTS);
- when(mPrefs.getString(Mockito.anyString(), Mockito.anyString())).thenReturn(
+ when(mPrefs.getString(Mockito.anyString(), Mockito.any())).thenReturn(
getDefaultAccountPreference("name4",GoogleAccountType.ACCOUNT_TYPE));
assertEquals("name1", getDefaultGoogleAccountName());
}
diff --git a/tests/src/com/android/contacts/preference/ContactsPreferencesTest.java b/tests/src/com/android/contacts/preference/ContactsPreferencesTest.java
index 998f385..d7f34ee 100644
--- a/tests/src/com/android/contacts/preference/ContactsPreferencesTest.java
+++ b/tests/src/com/android/contacts/preference/ContactsPreferencesTest.java
@@ -56,7 +56,7 @@
Mockito.when(mResources.getString(Mockito.anyInt()))
.thenReturn(ACCOUNT_KEY); // contact_editor_default_account_key
- Mockito.when(mContext.getSharedPreferences(Mockito.anyString(), Mockito.anyInt()))
+ Mockito.when(mContext.getSharedPreferences(Mockito.any(), Mockito.anyInt()))
.thenReturn(mSharedPreferences);
Mockito.when(mSharedPreferences.contains(ContactsPreferences.SORT_ORDER_KEY))
.thenReturn(true);
@@ -184,7 +184,7 @@
mContactsPreferences = new ContactsPreferences(mContext,
/* isDefaultAccountUserChangeable */ true);
- Mockito.when(mSharedPreferences.getString(Mockito.eq(ACCOUNT_KEY), Mockito.anyString()))
+ Mockito.when(mSharedPreferences.getString(Mockito.eq(ACCOUNT_KEY), Mockito.any()))
.thenReturn(new AccountWithDataSet("name1", "type1", "dataset1").stringify(),
new AccountWithDataSet("name2", "type2", "dataset2").stringify());
@@ -199,7 +199,7 @@
public void testShouldShowAccountChangedNotificationIfAccountNotSaved() {
mContactsPreferences = new ContactsPreferences(mContext,
/* isDefaultAccountUserChangeable */ true);
- Mockito.when(mSharedPreferences.getString(Mockito.eq(ACCOUNT_KEY), Mockito.anyString()))
+ Mockito.when(mSharedPreferences.getString(Mockito.eq(ACCOUNT_KEY), Mockito.any()))
.thenReturn(null);
assertTrue("Should prompt to change default if no default is saved",
@@ -211,7 +211,7 @@
public void testShouldShowAccountChangedNotification() {
mContactsPreferences = new ContactsPreferences(mContext,
/* isDefaultAccountUserChangeable */ true);
- Mockito.when(mSharedPreferences.getString(Mockito.eq(ACCOUNT_KEY), Mockito.anyString()))
+ Mockito.when(mSharedPreferences.getString(Mockito.eq(ACCOUNT_KEY), Mockito.any()))
.thenReturn(new AccountWithDataSet("name", "type", "dataset").stringify());
assertFalse("Should not prompt to change default if current default exists",
@@ -228,7 +228,7 @@
public void testShouldShowAccountChangedNotificationWhenThereIsOneAccount() {
mContactsPreferences = new ContactsPreferences(mContext,
/* isDefaultAccountUserChangeable */ true);
- Mockito.when(mSharedPreferences.getString(Mockito.eq(ACCOUNT_KEY), Mockito.anyString()))
+ Mockito.when(mSharedPreferences.getString(Mockito.eq(ACCOUNT_KEY), Mockito.any()))
.thenReturn(null);
// Normally we would prompt because there is no default set but if there is just one
diff --git a/tests/src/com/android/contacts/test/mocks/ForwardingContentProvider.java b/tests/src/com/android/contacts/test/mocks/ForwardingContentProvider.java
index 993d0b7..a08bff9 100644
--- a/tests/src/com/android/contacts/test/mocks/ForwardingContentProvider.java
+++ b/tests/src/com/android/contacts/test/mocks/ForwardingContentProvider.java
@@ -23,8 +23,10 @@
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.net.Uri;
+import android.os.Binder;
import android.os.Bundle;
import android.os.CancellationSignal;
+import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import androidx.annotation.Nullable;
@@ -203,4 +205,8 @@
throw new RuntimeException(e);
}
}
+
+ public IBinder getIContentProviderBinder() {
+ return new Binder();
+ }
}