Permissions: Fix Auth CTS tests to reflect changes.

Added a new CtsUnaffiliatedAccountAuthenticators support package signed
with different keys to allow us to test expected failures when trying to
use AccountManager methods that require signature matching.

Also replaced the permissions/src/.../AccountManagerTest with similar
tests in AccountManagerUnaffiliatedAuthenticatorTests that will do the
right thing.

There aren't any tests that check whether an unaffiliated client with
the GET_ACCOUNTS permission can get accounts. But that isn't a
regression.  accounts/src/.../AccountManagerTests tests that matching
signatures get the correct data. While the unaffiliated tests make sure
that those that don't have the relevant permissions don't get data.

Also added some infrastructure (TestAuthenticator implementation) for future use.

Bug: 22330923
Change-Id: Ide02af19c41191079138c22071e0055027498c7b
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 5042a74..4a5e86f 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -68,6 +68,9 @@
     CtsKeySetSigningAUpgradeEcA \
     CtsKeySetSigningEcAUpgradeA
 
+cts_account_support_packages := \
+    CtsUnaffiliatedAccountAuthenticators
+
 cts_support_packages := \
     CtsAccelerationTestStubs \
     CtsAlarmClockService \
@@ -104,6 +107,7 @@
     CtsVoiceInteractionService \
     CtsVoiceInteractionApp \
     CtsVoiceSettingsService \
+    $(cts_account_support_packages) \
     $(cts_security_apps_list) \
     $(cts_security_keysets_list)
 
diff --git a/tests/tests/accounts/Android.mk b/tests/tests/accounts/Android.mk
index 1579822..6ed35c6 100644
--- a/tests/tests/accounts/Android.mk
+++ b/tests/tests/accounts/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := CtsAccountTestsCommon ctstestrunner
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
@@ -30,3 +30,4 @@
 LOCAL_SDK_VERSION := current
 
 include $(BUILD_CTS_PACKAGE)
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/accounts/AndroidManifest.xml b/tests/tests/accounts/AndroidManifest.xml
index 93529d0..d882690 100644
--- a/tests/tests/accounts/AndroidManifest.xml
+++ b/tests/tests/accounts/AndroidManifest.xml
@@ -18,11 +18,9 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="android.accounts.cts">
 
-    <!-- Used for AccountManagerService test, don't delete this permission -->
-    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
-    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
-    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
-    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
+    <!-- Don't need GET_ACCOUNTS because share a Uid with the relevant
+         authenticators -->
+
     <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
 
     <application>
diff --git a/tests/tests/accounts/AndroidTest.xml b/tests/tests/accounts/AndroidTest.xml
new file mode 100644
index 0000000..3e29c9c
--- /dev/null
+++ b/tests/tests/accounts/AndroidTest.xml
@@ -0,0 +1,18 @@
+<!-- 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.
+-->
+<configuration description="Test module config for Account apis">
+    <include name="common-config" />
+    <option name="cts-apk-installer:test-file-name" value="CtsUnaffiliatedAccountAuthenticators.apk" />
+</configuration>
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
new file mode 100644
index 0000000..cb504da
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
@@ -0,0 +1,42 @@
+# 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# don't include this package in any target
+LOCAL_MODULE_TAGS := optional
+# LOCAL_MODULE_TAGS := tests
+
+# and when built explicitly put it in the data partition
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_SDK_VERSION := current
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+        ctstestrunner \
+	CtsAccountTestsCommon
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/res
+
+LOCAL_PACKAGE_NAME := CtsUnaffiliatedAccountAuthenticators
+
+LOCAL_SDK_VERSION := current
+
+LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
+
+include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/AndroidManifest.xml b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/AndroidManifest.xml
new file mode 100644
index 0000000..c32f89f
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/AndroidManifest.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2009 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="android.accounts.cts.unaffiliated">
+
+    <!-- Used for AccountManagerService test, don't delete this permission -->
+    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
+
+    <application>
+
+        <activity
+                android:name="android.accounts.cts.common.TestAuthenticatorActivity"
+                android:exported="true" />
+
+        <provider
+                android:name="android.accounts.cts.common.AuthenticatorContentProvider"
+                android:authorities="android.accounts.cts.unaffiliated.authenticators.provider"
+                android:exported="true" />
+
+        <service
+                android:name=".StdAccountAuthService"
+                android:exported="false">
+            <intent-filter>
+                <action android:name="android.accounts.AccountAuthenticator" />
+            </intent-filter>
+            <meta-data android:name="android.accounts.AccountAuthenticator"
+                       android:resource="@xml/standard_authenticator" />
+        </service>
+<!--
+        <service android:name=".CustomAccountAuthService" android:exported="false">
+            <intent-filter>
+                <action android:name="android.accounts.AccountAuthenticator" />
+            </intent-filter>
+            <meta-data android:name="android.accounts.AccountAuthenticator"
+                       android:resource="@xml/custom_authenticator" />
+        </service>
+        -->
+
+    </application>
+</manifest>
+
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_minitab_selected.png b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_minitab_selected.png
new file mode 100644
index 0000000..c730050
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_minitab_selected.png
Binary files differ
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_minitab_selected_custom_account.png b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_minitab_selected_custom_account.png
new file mode 100644
index 0000000..3fbbc94
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_minitab_selected_custom_account.png
Binary files differ
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_selected.png b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_selected.png
new file mode 100644
index 0000000..72a065c
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_selected.png
Binary files differ
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_selected_custom_account.png b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_selected_custom_account.png
new file mode 100644
index 0000000..70e35c0
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/drawable/ic_cts_selected_custom_account.png
Binary files differ
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/values/strings.xml b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/values/strings.xml
new file mode 100644
index 0000000..442669b
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2009 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.
+ */
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Label for this package -->
+    <string name="label">Android CTS - Account</string>
+</resources>
\ No newline at end of file
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/xml/custom_authenticator.xml b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/xml/custom_authenticator.xml
new file mode 100644
index 0000000..3485f76
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/xml/custom_authenticator.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2009, 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.
+ */
+-->
+
+<!-- The attributes in this XML file provide configuration information -->
+<!-- for the Account Manager. -->
+
+<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
+    android:accountType="android.accounts.test.custom"
+    android:icon="@drawable/ic_cts_selected_custom_account"
+    android:smallIcon="@drawable/ic_cts_minitab_selected_custom_account"
+    android:customTokens="true"
+    android:label="@string/label"
+/>
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/xml/standard_authenticator.xml b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/xml/standard_authenticator.xml
new file mode 100644
index 0000000..0c843b9
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/res/xml/standard_authenticator.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2009, 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.
+ */
+-->
+
+<!-- The attributes in this XML file provide configuration information -->
+<!-- for the Account Manager. -->
+
+<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
+    android:accountType="android.accounts.test.standard.unaffiliated"
+    android:icon="@drawable/ic_cts_selected"
+    android:smallIcon="@drawable/ic_cts_minitab_selected"
+    android:label="@string/label"
+/>
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/src/android/accounts/cts/unaffiliated/StdAccountAuthService.java b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/src/android/accounts/cts/unaffiliated/StdAccountAuthService.java
new file mode 100644
index 0000000..de87ac7
--- /dev/null
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/src/android/accounts/cts/unaffiliated/StdAccountAuthService.java
@@ -0,0 +1,36 @@
+/*
+ * 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 android.accounts.cts.unaffiliated;
+
+import android.accounts.cts.common.Fixtures;
+import android.accounts.cts.common.TestAccountAuthenticator;
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+
+/**
+ * a basic Mock Service for wrapping the MockAccountAuthenticator
+ */
+public class StdAccountAuthService extends Service {
+
+    @Override
+    public IBinder onBind(Intent intent) {
+        TestAccountAuthenticator auth =
+                new TestAccountAuthenticator(this, Fixtures.TYPE_STANDARD_UNAFFILIATED);
+        return auth.getIBinder();
+    }
+}
diff --git a/tests/tests/accounts/common/Android.mk b/tests/tests/accounts/common/Android.mk
new file mode 100644
index 0000000..cac9c5e
--- /dev/null
+++ b/tests/tests/accounts/common/Android.mk
@@ -0,0 +1,36 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# don't include this package in any target
+LOCAL_MODULE_TAGS := optional
+# and when built explicitly put it in the data partition
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+# Includes all the java files, and explicitly declares any aidl files
+LOCAL_SRC_FILES := \
+    $(call all-java-files-under, src) \
+    $(call all-Iaidl-files-under, src)
+
+LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/src
+
+LOCAL_MODULE:= CtsAccountTestsCommon
+
+LOCAL_SDK_VERSION := current
+
+# Build the actual static library
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tests/accounts/common/AndroidManifest.xml b/tests/tests/accounts/common/AndroidManifest.xml
new file mode 100644
index 0000000..6e6d107
--- /dev/null
+++ b/tests/tests/accounts/common/AndroidManifest.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="android.accounts.test.shared">
+    <uses-sdk
+        android:minSdkVersion="4" />
+    <application />
+</manifest>
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/AuthenticatorContentProvider.java b/tests/tests/accounts/common/src/android/accounts/cts/common/AuthenticatorContentProvider.java
new file mode 100644
index 0000000..b52dae3
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/AuthenticatorContentProvider.java
@@ -0,0 +1,150 @@
+/*
+ * 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 android.accounts.cts.common;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.AuthenticatorDescription;
+import android.content.ContentProvider;
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Parcelable;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+public class AuthenticatorContentProvider extends ContentProvider {
+
+    public static final String AUTHORITY =
+            "android.accounts.cts.unaffiliated.authenticators.provider";
+
+    public static final int RESULT_SUCCESS = 1;
+    public static final int RESULT_FAIL = 2;
+
+    public static final String METHOD_GET = "get";
+    public static final String METHOD_SETUP = "setup";
+    public static final String METHOD_TEARDOWN = "setup";
+
+    public static final int ACTION_GET = 1;
+    public static final int ACTION_SETUP = 2;
+    public static final int ACTION_TEARDOWN = 3;
+
+    public static final int ARG_UNAFFILIATED = 10;
+    public static final int ARG_AFFILIATED = 11;
+
+    public static final String KEY_CALLBACK = "callback";
+    public static final String KEY_TX = "tx";
+
+    public static final AtomicReference<Parcelable> sLastTx = new AtomicReference<>();
+
+    public static void setTx(Parcelable tx) {
+        sLastTx.set(tx);
+    }
+
+    @Override
+    // public void handleMessage(Message msg) {
+    public Bundle call(String method, String arg, Bundle extras) {
+        super.call(method, arg, extras);
+        Bundle result = new Bundle();
+        if (METHOD_GET.equals(method)) {
+            result.putParcelable(KEY_TX, sLastTx.get());
+            return result;
+        } else if (METHOD_SETUP.equals(method)) {
+            setup();
+            return result;
+        } else if (METHOD_TEARDOWN.equals(method)) {
+            teardown();
+            return result;
+        } else {
+            throw new IllegalArgumentException("Unrecognized method!");
+        }
+    }
+
+    public void setup() {
+        Context context = getContext();
+        AccountManager am = AccountManager.get(context);
+        AuthenticatorDescription[] authenticators = am.getAuthenticatorTypes();
+        for (AuthenticatorDescription a : authenticators) {
+            /*
+             * Populate relevant test information for authenticators in the
+             * same package as the TestAuthenticatorSupportHandler.
+             */
+            if (a.packageName.equals(context.getPackageName())) {
+                for (String name : Fixtures.getFixtureAccountNames()) {
+                    Account account = new Account(name, a.type);
+                    am.addAccountExplicitly(account, Fixtures.PREFIX_PASSWORD + name, null);
+                }
+            }
+        }
+    }
+
+    public void teardown() {
+        Context context = getContext();
+        AccountManager am = AccountManager.get(context);
+        AuthenticatorDescription[] authenticators = am.getAuthenticatorTypes();
+        for (AuthenticatorDescription a : authenticators) {
+            /*
+             * Populate relevant test information for authenticators in the
+             * same package as the TestAuthenticatorSupportHandler.
+             */
+            if (a.packageName.equals(context.getPackageName())) {
+                Account[] accountsToRemove = am.getAccountsByType(a.type);
+                for (Account account : accountsToRemove) {
+                    am.removeAccountExplicitly(account);
+                }
+            }
+        }
+    }
+
+    @Override
+    public boolean onCreate() {
+        return true;   
+    }
+
+    @Override
+    public Cursor query(
+            Uri uri, 
+            String[] projection,
+            String selection,
+            String[] selectionArgs,
+            String sortOrder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public String getType(Uri uri) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Uri insert(Uri uri, ContentValues values) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int delete(Uri uri, String selection, String[] selectionArgs) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+        throw new UnsupportedOperationException();
+    }
+}
+
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/Fixtures.java b/tests/tests/accounts/common/src/android/accounts/cts/common/Fixtures.java
new file mode 100644
index 0000000..f8636a0
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/Fixtures.java
@@ -0,0 +1,74 @@
+/*
+ * 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 android.accounts.cts.common;
+
+import android.accounts.Account;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Constants shared amongst account hostside tests.
+ */
+public final class Fixtures {
+
+    public static final String TYPE_CUSTOM = "android.accounts.test.custom";
+    public static final String TYPE_STANDARD = "android.accounts.test.standard";
+
+    public static final String TYPE_STANDARD_UNAFFILIATED =
+            "android.accounts.test.standard.unaffiliated";
+
+    public static final String PREFIX_TOKEN = "token:";
+    public static final String PREFIX_PASSWORD = "password:";
+
+    public static final String SUFFIX_NAME_FIXTURE = "fixture.com";
+    public static final String SUFFIX_NAME_TEST = "test.com";
+
+    public static final String PREFIX_NAME_SUCCESS = "success_on_return";
+    public static final String PREFIX_NAME_ERROR = "error";
+    public static final String PREFIX_NAME_INTERVENE = "intervene";
+
+    private static final String[] accountNamePrefixes = new String[] {
+            PREFIX_NAME_SUCCESS,
+            PREFIX_NAME_ERROR,
+            PREFIX_NAME_INTERVENE
+    };
+
+    public static final Account ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS = new Account(
+            PREFIX_NAME_SUCCESS + "@" + SUFFIX_NAME_FIXTURE,
+            TYPE_STANDARD_UNAFFILIATED);
+
+    public static List<String> getFixtureAccountNames() {
+        List<String> accountNames = new ArrayList<>(accountNamePrefixes.length);
+        for (String prefix : accountNamePrefixes) {
+            accountNames.add(prefix + "@" + SUFFIX_NAME_FIXTURE);
+        }
+        return accountNames;
+    }
+
+    public static final int TEST_SUPPORT_RESULT_SUCCESS = 1;
+    public static final int TEST_SUPPORT_RESULT_FAIL = 2;
+
+    public static final String KEY_ACCOUNT_NAME = "test:account_name";
+
+    public static final String KEY_CALLBACK = "test:callback";
+    public static final String KEY_CALLBACK_REQUIRED = "test:callback_required";
+    public static final String KEY_RESULT = "test:result";
+    public static final String KEY_TOKEN_EXPIRY = "test:token_duration";
+
+    private Fixtures() {}
+}
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/TestAccountAuthenticator.java b/tests/tests/accounts/common/src/android/accounts/cts/common/TestAccountAuthenticator.java
new file mode 100644
index 0000000..1fac1ea
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/TestAccountAuthenticator.java
@@ -0,0 +1,326 @@
+/*
+ * 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 android.accounts.cts.common;
+
+import android.accounts.AbstractAccountAuthenticator;
+import android.accounts.Account;
+import android.accounts.AccountAuthenticatorResponse;
+import android.accounts.AccountManager;
+import android.accounts.NetworkErrorException;
+import android.accounts.cts.common.tx.AddAccountTx;
+import android.accounts.cts.common.tx.ConfirmCredentialsTx;
+import android.accounts.cts.common.tx.GetAuthTokenLabelTx;
+import android.accounts.cts.common.tx.GetAuthTokenTx;
+import android.accounts.cts.common.tx.HasFeaturesTx;
+import android.accounts.cts.common.tx.UpdateCredentialsTx;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+
+import java.util.Arrays;
+
+public class TestAccountAuthenticator extends AbstractAccountAuthenticator {
+
+    private final String mAccountType;
+    private final Context mContext;
+    private volatile int mCounter = 0;
+
+    public TestAccountAuthenticator(Context context, String accountType) {
+        super(context);
+        mContext = context;
+        mAccountType = accountType;
+    }
+
+    @Override
+    public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
+        throw new UnsupportedOperationException(
+                "editProperties should be tested using the MockAuthenticator");
+    }
+
+    @Override
+    public Bundle addAccount(
+            AccountAuthenticatorResponse response,
+            String accountType,
+            String authTokenType,
+            String[] requiredFeatures,
+            Bundle options) throws NetworkErrorException {
+        if (!mAccountType.equals(accountType)) {
+            throw new IllegalArgumentException("Request to the wrong authenticator!");
+        }
+        String accountName = null;
+        boolean isCallbackRequired = false;
+        if (options != null) {
+            accountName = options.getString(Fixtures.KEY_ACCOUNT_NAME);
+            isCallbackRequired = options.getBoolean(Fixtures.KEY_CALLBACK_REQUIRED, false);
+        }
+        Bundle result = new Bundle();
+        AuthenticatorContentProvider.setTx(
+                new AddAccountTx(accountType, authTokenType, requiredFeatures, options, result));
+        if (accountName.startsWith(Fixtures.PREFIX_NAME_SUCCESS)) {
+            // fill bundle with a success result.
+            result.putString(AccountManager.KEY_ACCOUNT_NAME, accountName);
+            result.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccountType);
+        } else if (accountName.startsWith(Fixtures.PREFIX_NAME_INTERVENE)) {
+            // Specify data to be returned by the eventual activity.
+            Intent eventualActivityResultData = new Intent();
+            eventualActivityResultData.putExtra(AccountManager.KEY_ACCOUNT_NAME, accountName);
+            eventualActivityResultData.putExtra(AccountManager.KEY_ACCOUNT_TYPE, accountType);
+            // Fill result with Intent.
+            Intent intent = new Intent(mContext, TestAuthenticatorActivity.class);
+            intent.putExtra(Fixtures.KEY_RESULT, eventualActivityResultData);
+            intent.putExtra(Fixtures.KEY_CALLBACK, response);
+
+            result.putParcelable(AccountManager.KEY_INTENT, intent);
+        } else {
+            // fill with error
+            int errorCode = AccountManager.ERROR_CODE_INVALID_RESPONSE;
+            String errorMsg = "Default Error Message";
+            if (options != null) {
+                errorCode = options.getInt(AccountManager.KEY_ERROR_CODE);
+                errorMsg = options.getString(AccountManager.KEY_ERROR_MESSAGE);
+            }
+            result.putInt(AccountManager.KEY_ERROR_CODE, errorCode);
+            result.putString(AccountManager.KEY_ERROR_MESSAGE, errorMsg);
+        }
+
+        try {
+            return (isCallbackRequired) ? null : result;
+        } finally {
+            if (isCallbackRequired) {
+                response.onResult(result);
+            }
+        }
+    }
+
+    @Override
+    public Bundle confirmCredentials(
+            AccountAuthenticatorResponse response,
+            Account account,
+            Bundle options) throws NetworkErrorException {
+        if (!mAccountType.equals(account.type)) {
+            throw new IllegalArgumentException("Request to the wrong authenticator!");
+        }
+        Bundle result = new Bundle();
+        AuthenticatorContentProvider.setTx(
+                new ConfirmCredentialsTx(account, options, result));
+
+        boolean isCallbackRequired =
+                options != null && options.getBoolean(Fixtures.KEY_CALLBACK_REQUIRED);
+        if (account.name.startsWith(Fixtures.PREFIX_NAME_SUCCESS)) {
+            // fill bundle with a success result.
+            result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
+            result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
+            result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
+        } else if (account.name.startsWith(Fixtures.PREFIX_NAME_INTERVENE)) {
+            // Specify data to be returned by the eventual activity.
+            Intent eventualActivityResultData = new Intent();
+            eventualActivityResultData.putExtra(AccountManager.KEY_BOOLEAN_RESULT, true);
+            eventualActivityResultData.putExtra(AccountManager.KEY_ACCOUNT_NAME, account.name);
+            eventualActivityResultData.putExtra(AccountManager.KEY_ACCOUNT_TYPE, account.type);
+
+            // Fill result with Intent.
+            Intent intent = new Intent(mContext, TestAuthenticatorActivity.class);
+            intent.putExtra(Fixtures.KEY_RESULT, eventualActivityResultData);
+            intent.putExtra(Fixtures.KEY_CALLBACK, response);
+
+            result.putParcelable(AccountManager.KEY_INTENT, intent);
+        } else {
+            // fill with error
+            // fill with error
+            int errorCode = AccountManager.ERROR_CODE_INVALID_RESPONSE;
+            String errorMsg = "Default Error Message";
+            if (options != null) {
+                errorCode = options.getInt(AccountManager.KEY_ERROR_CODE);
+                errorMsg = options.getString(AccountManager.KEY_ERROR_MESSAGE);
+            }
+            result.putInt(AccountManager.KEY_ERROR_CODE, errorCode);
+            result.putString(AccountManager.KEY_ERROR_MESSAGE, errorMsg);
+        }
+
+        try {
+            return (isCallbackRequired) ? null : result;
+        } finally {
+            if (isCallbackRequired) {
+                response.onResult(result);
+            }
+        }
+    }
+
+    @Override
+    public Bundle getAuthToken(
+            AccountAuthenticatorResponse response,
+            Account account,
+            String authTokenType,
+            Bundle options) throws NetworkErrorException {
+        if (!mAccountType.equals(account.type)) {
+            throw new IllegalArgumentException("Request to the wrong authenticator!");
+        }
+        Bundle result = new Bundle();
+        AuthenticatorContentProvider.setTx(
+                new GetAuthTokenTx(account, authTokenType, options, result));
+        boolean isCallbackRequired =
+                options != null && options.getBoolean(Fixtures.KEY_CALLBACK_REQUIRED);
+        long expiryMillis = (options == null) ? 0 : options.getLong(Fixtures.KEY_TOKEN_EXPIRY);
+        if (account.name.startsWith(Fixtures.PREFIX_NAME_SUCCESS)) {
+            // fill bundle with a success result.
+            result.putString(
+                    AccountManager.KEY_AUTHTOKEN, Fixtures.PREFIX_TOKEN + mCounter++);
+            result.putLong(
+                    AbstractAccountAuthenticator.KEY_CUSTOM_TOKEN_EXPIRY,
+                    expiryMillis);
+            result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
+            result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
+        } else if (account.name.startsWith(Fixtures.PREFIX_NAME_INTERVENE)) {
+            // Specify data to be returned by the eventual activity.
+            Intent eventualActivityResultData = new Intent();
+            eventualActivityResultData.putExtra(
+                    AccountManager.KEY_AUTHTOKEN, Fixtures.PREFIX_TOKEN + mCounter++);
+            eventualActivityResultData.putExtra(
+                    AbstractAccountAuthenticator.KEY_CUSTOM_TOKEN_EXPIRY,
+                    expiryMillis);
+            eventualActivityResultData.putExtra(AccountManager.KEY_ACCOUNT_NAME, account.name);
+            eventualActivityResultData.putExtra(AccountManager.KEY_ACCOUNT_TYPE, account.type);
+
+            // Fill result with Intent.
+            Intent intent = new Intent(mContext, TestAuthenticatorActivity.class);
+            intent.putExtra(Fixtures.KEY_RESULT, eventualActivityResultData);
+            intent.putExtra(Fixtures.KEY_CALLBACK, response);
+
+            result.putParcelable(AccountManager.KEY_INTENT, intent);
+
+        } else {
+            // fill with error
+            int errorCode = AccountManager.ERROR_CODE_INVALID_RESPONSE;
+            String errorMsg = "Default Error Message";
+            if (options != null) {
+                errorCode = options.getInt(AccountManager.KEY_ERROR_CODE);
+                errorMsg = options.getString(AccountManager.KEY_ERROR_MESSAGE);
+            }
+            result.putInt(AccountManager.KEY_ERROR_CODE, errorCode);
+            result.putString(AccountManager.KEY_ERROR_MESSAGE, errorMsg);
+        }
+
+        try {
+            return (isCallbackRequired) ? null : result;
+        } finally {
+            if (isCallbackRequired) {
+                response.onResult(result);
+            }
+        }
+    }
+
+    @Override
+    public String getAuthTokenLabel(String authTokenType) {
+        String result = "Label:" + authTokenType;
+        AuthenticatorContentProvider.setTx(
+                new GetAuthTokenLabelTx(authTokenType, result));
+        return result;
+    }
+
+    @Override
+    public Bundle updateCredentials(
+            AccountAuthenticatorResponse response,
+            Account account,
+            String authTokenType,
+            Bundle options) throws NetworkErrorException {
+        if (!mAccountType.equals(account.type)) {
+            throw new IllegalArgumentException("Request to the wrong authenticator!");
+        }
+        Bundle result = new Bundle();
+        AuthenticatorContentProvider.setTx(
+                new UpdateCredentialsTx(account, authTokenType, options, result));
+
+        boolean isCallbackRequired =
+                options != null && options.getBoolean(Fixtures.KEY_CALLBACK_REQUIRED);
+        if (account.name.startsWith(Fixtures.PREFIX_NAME_SUCCESS)) {
+            // fill bundle with a success result.
+            result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
+            result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
+        } else if (account.name.startsWith(Fixtures.PREFIX_NAME_INTERVENE)) {
+            // Specify data to be returned by the eventual activity.
+            Intent eventualActivityResultData = new Intent();
+            eventualActivityResultData.putExtra(AccountManager.KEY_ACCOUNT_NAME, account.name);
+            eventualActivityResultData.putExtra(AccountManager.KEY_ACCOUNT_TYPE, account.type);
+
+            // Fill result with Intent.
+            Intent intent = new Intent(mContext, TestAuthenticatorActivity.class);
+            intent.putExtra(Fixtures.KEY_RESULT, eventualActivityResultData);
+            intent.putExtra(Fixtures.KEY_CALLBACK, response);
+
+            result.putParcelable(AccountManager.KEY_INTENT, intent);
+        } else {
+            // fill with error
+            // fill with error
+            int errorCode = AccountManager.ERROR_CODE_INVALID_RESPONSE;
+            String errorMsg = "Default Error Message";
+            if (options != null) {
+                errorCode = options.getInt(AccountManager.KEY_ERROR_CODE);
+                errorMsg = options.getString(AccountManager.KEY_ERROR_MESSAGE);
+            }
+            result.putInt(AccountManager.KEY_ERROR_CODE, errorCode);
+            result.putString(AccountManager.KEY_ERROR_MESSAGE, errorMsg);
+        }
+
+        try {
+            return (isCallbackRequired) ? null : result;
+        } finally {
+            if (isCallbackRequired) {
+                response.onResult(result);
+            }
+        }
+    }
+
+    @Override
+    public Bundle hasFeatures(
+            AccountAuthenticatorResponse response,
+            Account account,
+            String[] features) throws NetworkErrorException {
+        if (!mAccountType.equals(account.type)) {
+            throw new IllegalArgumentException("Request to the wrong authenticator!");
+        }
+        Bundle result = new Bundle();
+        AuthenticatorContentProvider.setTx(
+                new HasFeaturesTx(account, features, result));
+        boolean isCallbackRequired =
+                Arrays.asList(features).contains(Fixtures.KEY_CALLBACK_REQUIRED);
+        if (account.name.startsWith(Fixtures.PREFIX_NAME_SUCCESS)) {
+            // fill bundle with a success result.
+            result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
+        } else if (account.name.startsWith(Fixtures.PREFIX_NAME_INTERVENE)) {
+            // Specify data to be returned by the eventual activity.
+            Intent eventualActivityResultData = new Intent();
+            eventualActivityResultData.putExtra(AccountManager.KEY_BOOLEAN_RESULT, true);
+
+            Intent intent = new Intent(mContext, TestAuthenticatorActivity.class);
+            intent.putExtra(Fixtures.KEY_RESULT, eventualActivityResultData);
+            intent.putExtra(Fixtures.KEY_CALLBACK, response);
+
+            result.putParcelable(AccountManager.KEY_INTENT, intent);
+        } else {
+            // fill with error
+        }
+
+        try {
+            return (isCallbackRequired) ? null : result;
+        } finally {
+            if (isCallbackRequired) {
+                response.onResult(result);
+            }
+        }
+    }
+}
+
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/TestAuthenticatorActivity.java b/tests/tests/accounts/common/src/android/accounts/cts/common/TestAuthenticatorActivity.java
new file mode 100644
index 0000000..83c0533
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/TestAuthenticatorActivity.java
@@ -0,0 +1,39 @@
+/*
+ * 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 android.accounts.cts.common;
+
+import android.accounts.AccountAuthenticatorResponse;
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+
+public class TestAuthenticatorActivity extends Activity {
+
+    @Override
+    protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        Intent intent = getIntent();
+        AccountAuthenticatorResponse response = intent.getParcelableExtra(Fixtures.KEY_CALLBACK);
+        Intent result = intent.getParcelableExtra(Fixtures.KEY_RESULT);
+        if (response != null) {
+            response.onResult(result.getExtras());
+        }
+        setResult(RESULT_OK, result);
+        finish();
+    }
+}
+
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/AddAccountTx.aidl b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/AddAccountTx.aidl
new file mode 100644
index 0000000..912322a
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/AddAccountTx.aidl
@@ -0,0 +1,3 @@
+package android.accounts.cts.common.tx;
+
+parcelable AddAccountTx;
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/AddAccountTx.java b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/AddAccountTx.java
new file mode 100644
index 0000000..3d829315
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/AddAccountTx.java
@@ -0,0 +1,70 @@
+package android.accounts.cts.common.tx;
+
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AddAccountTx implements Parcelable {
+
+    public static final Parcelable.Creator<AddAccountTx> CREATOR =
+            new Parcelable.Creator<AddAccountTx>() {
+
+                @Override
+                public AddAccountTx createFromParcel(Parcel in) {
+                    return new AddAccountTx(in);
+                }
+
+                @Override
+                public AddAccountTx[] newArray(int size) {
+                    return new AddAccountTx[size];
+                }
+            };
+
+    public final String accountType;
+    public final String authTokenType;
+    public final List<String> requiredFeatures = new ArrayList<>();
+    public final Bundle options;
+    public final Bundle result;
+
+    private AddAccountTx(Parcel in) {
+        accountType = in.readString();
+        authTokenType = in.readString();
+        in.readStringList(requiredFeatures);
+        options = in.readBundle();
+        result = in.readBundle();
+    }
+
+    public AddAccountTx(
+            String accountType,
+            String authTokenType,
+            String[] requiredFeatures,
+            Bundle options,
+            Bundle result) {
+        this.accountType = accountType;
+        this.authTokenType = authTokenType;
+        if (requiredFeatures != null) {
+            for (String feature : requiredFeatures) {
+                this.requiredFeatures.add(feature);
+            }
+        }
+        this.options = options;
+        this.result = result;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeString(accountType);
+        out.writeString(authTokenType);
+        out.writeStringList(requiredFeatures);
+        out.writeBundle(options);
+        out.writeBundle(result);
+    }
+}
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/ConfirmCredentialsTx.aidl b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/ConfirmCredentialsTx.aidl
new file mode 100644
index 0000000..98a6367
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/ConfirmCredentialsTx.aidl
@@ -0,0 +1,3 @@
+package android.accounts.cts.common.tx;
+
+parcelable ConfirmCredentialsTx;
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/ConfirmCredentialsTx.java b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/ConfirmCredentialsTx.java
new file mode 100644
index 0000000..d73b0a5
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/ConfirmCredentialsTx.java
@@ -0,0 +1,54 @@
+package android.accounts.cts.common.tx;
+
+import android.accounts.Account;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class ConfirmCredentialsTx implements Parcelable {
+
+    public static final Parcelable.Creator<ConfirmCredentialsTx> CREATOR =
+            new Parcelable.Creator<ConfirmCredentialsTx>() {
+
+                @Override
+                public ConfirmCredentialsTx createFromParcel(Parcel in) {
+                    return new ConfirmCredentialsTx(in);
+                }
+
+                @Override
+                public ConfirmCredentialsTx[] newArray(int size) {
+                    return new ConfirmCredentialsTx[size];
+                }
+            };
+
+    public final Account account;
+    public final Bundle options;
+    public final Bundle result;
+
+    private ConfirmCredentialsTx(Parcel in) {
+        account = in.readParcelable(null);
+        options = in.readBundle();
+        result = in.readBundle();
+    }
+
+    public ConfirmCredentialsTx(
+            Account account,
+            Bundle options,
+            Bundle result) {
+        this.account = account;
+        this.options = options;
+        this.result = result;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeParcelable(account, flags);
+        out.writeBundle(options);
+        out.writeBundle(result);
+    }
+}
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/EditPropertiesTx.aidl b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/EditPropertiesTx.aidl
new file mode 100644
index 0000000..d9e813f
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/EditPropertiesTx.aidl
@@ -0,0 +1,3 @@
+package android.accounts.cts.common.tx;
+
+parcelable EditPropertiesTx;
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/EditPropertiesTx.java b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/EditPropertiesTx.java
new file mode 100644
index 0000000..4eba64d
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/EditPropertiesTx.java
@@ -0,0 +1,48 @@
+package android.accounts.cts.common.tx;
+
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class EditPropertiesTx implements Parcelable {
+
+    public static final Parcelable.Creator<EditPropertiesTx> CREATOR =
+            new Parcelable.Creator<EditPropertiesTx>() {
+
+                @Override
+                public EditPropertiesTx createFromParcel(Parcel in) {
+                    return new EditPropertiesTx(in);
+                }
+
+                @Override
+                public EditPropertiesTx[] newArray(int size) {
+                    return new EditPropertiesTx[size];
+                }
+            };
+
+    public final String accountType;
+    public final Bundle result;
+
+    private EditPropertiesTx(Parcel in) {
+        accountType = in.readString();
+        result = in.readBundle();
+    }
+
+    public EditPropertiesTx(
+            String accountType,
+            Bundle result) {
+        this.accountType = accountType;
+        this.result = result;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeString(accountType);
+        out.writeBundle(result);
+    }
+}
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAccountRemovalAllowedTx.aidl b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAccountRemovalAllowedTx.aidl
new file mode 100644
index 0000000..cbcd99d
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAccountRemovalAllowedTx.aidl
@@ -0,0 +1,3 @@
+package android.accounts.cts.common.tx;
+
+parcelable GetAccountRemovalAllowedTx;
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAccountRemovalAllowedTx.java b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAccountRemovalAllowedTx.java
new file mode 100644
index 0000000..0e456b0
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAccountRemovalAllowedTx.java
@@ -0,0 +1,49 @@
+package android.accounts.cts.common.tx;
+
+import android.accounts.Account;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class GetAccountRemovalAllowedTx implements Parcelable {
+
+    public static final Parcelable.Creator<GetAccountRemovalAllowedTx> CREATOR =
+            new Parcelable.Creator<GetAccountRemovalAllowedTx>() {
+
+                @Override
+                public GetAccountRemovalAllowedTx createFromParcel(Parcel in) {
+                    return new GetAccountRemovalAllowedTx(in);
+                }
+
+                @Override
+                public GetAccountRemovalAllowedTx[] newArray(int size) {
+                    return new GetAccountRemovalAllowedTx[size];
+                }
+            };
+
+    public final Account account;
+    public final Bundle result;
+
+    private GetAccountRemovalAllowedTx(Parcel in) {
+        account = in.readParcelable(null);
+        result = in.readBundle();
+    }
+
+    public GetAccountRemovalAllowedTx(
+            Account account,
+            Bundle result) {
+        this.account = account;
+        this.result = result;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeParcelable(account, flags);
+        out.writeBundle(result);
+    }
+}
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenLabelTx.aidl b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenLabelTx.aidl
new file mode 100644
index 0000000..82aeb9e
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenLabelTx.aidl
@@ -0,0 +1,3 @@
+package android.accounts.cts.common.tx;
+
+parcelable GetAuthTokenLabelTx;
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenLabelTx.java b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenLabelTx.java
new file mode 100644
index 0000000..4a017dd
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenLabelTx.java
@@ -0,0 +1,47 @@
+package android.accounts.cts.common.tx;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class GetAuthTokenLabelTx implements Parcelable {
+
+    public static final Parcelable.Creator<GetAuthTokenLabelTx> CREATOR =
+            new Parcelable.Creator<GetAuthTokenLabelTx>() {
+
+                @Override
+                public GetAuthTokenLabelTx createFromParcel(Parcel in) {
+                    return new GetAuthTokenLabelTx(in);
+                }
+
+                @Override
+                public GetAuthTokenLabelTx[] newArray(int size) {
+                    return new GetAuthTokenLabelTx[size];
+                }
+            };
+
+    public final String authTokenType;
+    public final String result;
+
+    private GetAuthTokenLabelTx(Parcel in) {
+        authTokenType = in.readString();
+        result = in.readString();
+    }
+
+    public GetAuthTokenLabelTx(
+            String authTokenType,
+            String result) {
+        this.authTokenType = authTokenType;
+        this.result = result;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeString(authTokenType);
+        out.writeString(result);
+    }
+}
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenTx.aidl b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenTx.aidl
new file mode 100644
index 0000000..4ff5abb
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenTx.aidl
@@ -0,0 +1,3 @@
+package android.accounts.cts.common.tx;
+
+parcelable GetAuthTokenTx;
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenTx.java b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenTx.java
new file mode 100644
index 0000000..c328353
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/GetAuthTokenTx.java
@@ -0,0 +1,59 @@
+package android.accounts.cts.common.tx;
+
+import android.accounts.Account;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class GetAuthTokenTx implements Parcelable {
+
+    public static final Parcelable.Creator<GetAuthTokenTx> CREATOR =
+            new Parcelable.Creator<GetAuthTokenTx>() {
+
+                @Override
+                public GetAuthTokenTx createFromParcel(Parcel in) {
+                    return new GetAuthTokenTx(in);
+                }
+
+                @Override
+                public GetAuthTokenTx[] newArray(int size) {
+                    return new GetAuthTokenTx[size];
+                }
+            };
+
+    public final Account account;
+    public final String authTokenType;
+    public final Bundle options;
+    public final Bundle result;
+
+    private GetAuthTokenTx(Parcel in) {
+        account = in.readParcelable(null);
+        authTokenType = in.readString();
+        options = in.readBundle();
+        result = in.readBundle();
+    }
+
+    public GetAuthTokenTx(
+            Account account,
+            String authTokenType,
+            Bundle options,
+            Bundle result) {
+        this.account = account;
+        this.authTokenType = authTokenType;
+        this.options = options;
+        this.result = result;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeParcelable(account, flags);
+        out.writeString(authTokenType);
+        out.writeBundle(options);
+        out.writeBundle(result);
+    }
+}
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/HasFeaturesTx.aidl b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/HasFeaturesTx.aidl
new file mode 100644
index 0000000..20b4a67
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/HasFeaturesTx.aidl
@@ -0,0 +1,3 @@
+package android.accounts.cts.common.tx;
+
+parcelable HasFeaturesTx;
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/HasFeaturesTx.java b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/HasFeaturesTx.java
new file mode 100644
index 0000000..81d3446
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/HasFeaturesTx.java
@@ -0,0 +1,61 @@
+package android.accounts.cts.common.tx;
+
+import android.accounts.Account;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class HasFeaturesTx implements Parcelable {
+
+    public static final Parcelable.Creator<HasFeaturesTx> CREATOR =
+            new Parcelable.Creator<HasFeaturesTx>() {
+
+                @Override
+                public HasFeaturesTx createFromParcel(Parcel in) {
+                    return new HasFeaturesTx(in);
+                }
+
+                @Override
+                public HasFeaturesTx[] newArray(int size) {
+                    return new HasFeaturesTx[size];
+                }
+            };
+
+    public final Account account;
+    public final List<String> features = new ArrayList<>();
+    public final Bundle result;
+
+    private HasFeaturesTx(Parcel in) {
+        account = in.readParcelable(null);
+        in.readStringList(features);
+        result = in.readBundle();
+    }
+
+    public HasFeaturesTx(
+            Account account,
+            String[] features,
+            Bundle result) {
+        this.account = account;
+        if (features != null) {
+            for (String feature : features) {
+                this.features.add(feature);
+            }
+        }
+        this.result = result;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeParcelable(account, flags);
+        out.writeStringList(features);
+        out.writeBundle(result);
+    }
+}
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/UpdateCredentialsTx.aidl b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/UpdateCredentialsTx.aidl
new file mode 100644
index 0000000..8106242
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/UpdateCredentialsTx.aidl
@@ -0,0 +1,3 @@
+package android.accounts.cts.common.tx;
+
+parcelable UpdateCredentialsTx;
diff --git a/tests/tests/accounts/common/src/android/accounts/cts/common/tx/UpdateCredentialsTx.java b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/UpdateCredentialsTx.java
new file mode 100644
index 0000000..ed2e082
--- /dev/null
+++ b/tests/tests/accounts/common/src/android/accounts/cts/common/tx/UpdateCredentialsTx.java
@@ -0,0 +1,59 @@
+package android.accounts.cts.common.tx;
+
+import android.accounts.Account;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class UpdateCredentialsTx implements Parcelable {
+
+    public static final Parcelable.Creator<UpdateCredentialsTx> CREATOR =
+            new Parcelable.Creator<UpdateCredentialsTx>() {
+
+                @Override
+                public UpdateCredentialsTx createFromParcel(Parcel in) {
+                    return new UpdateCredentialsTx(in);
+                }
+
+                @Override
+                public UpdateCredentialsTx[] newArray(int size) {
+                    return new UpdateCredentialsTx[size];
+                }
+            };
+
+    public final Account account;
+    public final String authTokenType;
+    public final Bundle options;
+    public final Bundle result;
+
+    private UpdateCredentialsTx(Parcel in) {
+        account = in.readParcelable(null);
+        authTokenType = in.readString();
+        options = in.readBundle();
+        result = in.readBundle();
+    }
+
+    public UpdateCredentialsTx(
+            Account account,
+            String authTokenType,
+            Bundle options,
+            Bundle result) {
+        this.account = account;
+        this.authTokenType = authTokenType;
+        this.options = options;
+        this.result = result;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeParcelable(account, flags);
+        out.writeString(authTokenType);
+        out.writeBundle(options);
+        out.writeBundle(result);
+    }
+}
diff --git a/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java b/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
new file mode 100644
index 0000000..2068f4c
--- /dev/null
+++ b/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
@@ -0,0 +1,226 @@
+/*
+ * 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 android.accounts.cts;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.AccountManagerFuture;
+import android.accounts.AuthenticatorException;
+import android.accounts.OperationCanceledException;
+import android.accounts.cts.common.AuthenticatorContentProvider;
+import android.accounts.cts.common.Fixtures;
+import android.content.ContentProviderClient;
+import android.content.ContentResolver;
+import android.os.RemoteException;
+import android.test.AndroidTestCase;
+
+import java.io.IOException;
+
+/**
+ * Tests for AccountManager and AbstractAccountAuthenticator related behavior using {@link
+ * android.accounts.cts.common.TestAccountAuthenticator} instances signed with different keys than
+ * the caller. This is important to test that portion of the {@link AccountManager} API intended
+ * for {@link android.accounts.AbstractAccountAuthenticator} implementers.
+ * <p>
+ * You can run those unit tests with the following command line:
+ * <p>
+ *  adb shell am instrument
+ *   -e debug false -w
+ *   -e class android.accounts.cts.AccountManagerUnaffiliatedAuthenticatorTests
+ * android.accounts.cts/android.support.test.runner.AndroidJUnitRunner
+ */
+public class AccountManagerUnaffiliatedAuthenticatorTests extends AndroidTestCase {
+
+    private AccountManager mAccountManager;
+    private ContentProviderClient mProviderClient;
+
+    @Override
+    public void setUp() throws Exception {
+        // bind to the diagnostic service and set it up.
+        mAccountManager = AccountManager.get(getContext());
+        ContentResolver resolver = getContext().getContentResolver();
+        mProviderClient = resolver.acquireContentProviderClient(
+                AuthenticatorContentProvider.AUTHORITY);
+        /*
+         * This will install a bunch of accounts on the device
+         * (see Fixtures.getFixtureAccountNames()).
+         */
+        mProviderClient.call(AuthenticatorContentProvider.METHOD_SETUP, null, null);
+    }
+
+    @Override
+    public void tearDown() throws RemoteException {
+        try {
+            mProviderClient.call(AuthenticatorContentProvider.METHOD_TEARDOWN, null, null);
+        } finally {
+            mProviderClient.release();
+        }
+    }
+
+    public void testNotifyAccountAuthenticated() {
+        try {
+            mAccountManager.notifyAccountAuthenticated(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS);
+            fail("Expected to just barf if the caller doesn't share a signature.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testEditProperties()  {
+        try {
+            mAccountManager.editProperties(
+                    Fixtures.TYPE_STANDARD_UNAFFILIATED,
+                    null, // activity
+                    null, // callback
+                    null); // handler
+            fail("Expecting a OperationCanceledException.");
+        } catch (SecurityException expected) {
+            
+        }
+    }
+
+    public void testAddAccountExplicitly() {
+        try {
+            mAccountManager.addAccountExplicitly(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS,
+                    "shouldn't matter", // password
+                    null); // bundle
+            fail("addAccountExplicitly should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testRemoveAccount_withBooleanResult() {
+        try {
+            mAccountManager.removeAccount(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS,
+                    null,
+                    null);
+            fail("removeAccount should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testRemoveAccount_withBundleResult() {
+        try {
+            mAccountManager.removeAccount(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS,
+                    null, // Activity
+                    null,
+                    null);
+            fail("removeAccount should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testRemoveAccountExplicitly() {
+        try {
+            mAccountManager.removeAccountExplicitly(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS);
+            fail("removeAccountExplicitly should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testGetPassword() {
+        try {
+            mAccountManager.getPassword(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS);
+            fail("getPassword should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testSetPassword() {
+        try {
+            mAccountManager.setPassword(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS,
+                    "Doesn't matter");
+            fail("setPassword should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testClearPassword() {
+        try {
+            mAccountManager.clearPassword(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS);
+            fail("clearPassword should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testGetUserData() {
+        try {
+            mAccountManager.getUserData(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS,
+                    "key");
+            fail("getUserData should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testSetUserData() {
+        try {
+            mAccountManager.setUserData(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS,
+                    "key",
+                    "value");
+            fail("setUserData should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void setAuthToken() {
+        try {
+            mAccountManager.setAuthToken(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS,
+                    "tokenType",
+                    "token");
+            fail("setAuthToken should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testPeekAuthToken() {
+        try {
+            mAccountManager.peekAuthToken(
+                    Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS,
+                    "tokenType");
+            fail("peekAuthToken should just barf if the caller isn't permitted.");
+        } catch (SecurityException expected) {}
+    }
+
+    public void testGetAccounts() {
+        Account[] accounts = mAccountManager.getAccounts();
+        assertEquals(0, accounts.length);
+    }
+
+    public void testGetAccountsByType() {
+        Account[] accounts = mAccountManager.getAccountsByType(
+                Fixtures.TYPE_STANDARD_UNAFFILIATED);
+        assertEquals(0, accounts.length);
+    }
+
+    public void testGetAccountsByTypeAndFeatures()
+            throws OperationCanceledException, AuthenticatorException, IOException {
+        AccountManagerFuture<Account[]> future = mAccountManager.getAccountsByTypeAndFeatures(
+                Fixtures.TYPE_STANDARD_UNAFFILIATED,
+                new String[] { "doesn't matter" },
+                null,  // Callback
+                null);  // Handler
+        Account[] accounts = future.getResult();
+        assertEquals(0, accounts.length);
+    }
+
+    public void testGetAccountsByTypeForPackage() {
+        Account[] accounts = mAccountManager.getAccountsByTypeForPackage(
+                Fixtures.TYPE_STANDARD_UNAFFILIATED,
+                getContext().getPackageName());
+        assertEquals(0, accounts.length);
+    }
+}
+
diff --git a/tests/tests/permission/src/android/permission/cts/AccountManagerTest.java b/tests/tests/permission/src/android/permission/cts/AccountManagerTest.java
deleted file mode 100644
index 5d4378f..0000000
--- a/tests/tests/permission/src/android/permission/cts/AccountManagerTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2013 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 android.permission.cts;
-
-import android.content.Context;
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.accounts.AccountManagerFuture;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Verify GET_ACCOUNTS permissions are enforced.
- */
-public class AccountManagerTest extends AndroidTestCase {
-
-    private AccountManager mAccountManager;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        mAccountManager = AccountManager.get(getContext());
-        assertNotNull(mAccountManager);
-    }
-
-    /**
-     * Verifies that AccountManager.getAccounts() requires Permission.
-     * <p>
-     * Requires Permission: {@link android.Manifest.permission#GET_ACCOUNTS}.
-     */
-    @SmallTest
-    public void testGetAccounts() {
-        try {
-            mAccountManager.getAccounts();
-            fail("AccountManager.getAccounts() did not throw SecurityException as expected");
-        } catch (SecurityException se) {
-            // Expected Exception
-        }
-    }
-
-    /**
-     * Verifies that AccountManager.getAccountsByType() requires Permission.
-     * <p>
-     * Requires Permission: {@link android.Manifest.permission#GET_ACCOUNTS}.
-     */
-    @SmallTest
-    public void testGetAccountsByType() {
-        try {
-            mAccountManager.getAccountsByType(null);
-            fail("AccountManager.getAccountsByType() did not throw SecurityException as expected");
-        } catch (SecurityException se) {
-            // Expected Exception
-        }
-    }
-
-    /**
-     * Verifies that AccountManager.getAccountsByTypeAndFeatures() requires
-     * Permission.
-     * <p>
-     * Requires Permission: {@link android.Manifest.permission#GET_ACCOUNTS}.
-     */
-    @SmallTest
-    public void testGetAccountsByTypeAndFeatures() {
-        try {
-            mAccountManager.getAccountsByTypeAndFeatures("", null, null, null);
-            fail("AccountManager.getAccountsByTypeAndFeatures() did not throw SecurityException as expected");
-        } catch (SecurityException se) {
-            // Expected Exception
-        }
-    }
-}