Merge "Use FooterPreference in xml explicitly"
diff --git a/src/com/android/settings/accounts/AccountSyncSettings.java b/src/com/android/settings/accounts/AccountSyncSettings.java
index ec74cd8..a652056 100644
--- a/src/com/android/settings/accounts/AccountSyncSettings.java
+++ b/src/com/android/settings/accounts/AccountSyncSettings.java
@@ -42,12 +42,14 @@
 import android.view.MenuInflater;
 import android.view.MenuItem;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.appcompat.app.AlertDialog;
 import androidx.preference.Preference;
 
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.widget.EntityHeaderController;
+import com.android.settingslib.widget.FooterPreference;
 
 import com.google.android.collect.Lists;
 
@@ -458,8 +460,7 @@
             syncPref.setChecked(oneTimeSyncMode || syncEnabled);
         }
         if (syncIsFailing) {
-            mFooterPreferenceMixin.createFooterPreference()
-                    .setTitle(R.string.sync_is_failing);
+            createFooterPreference();
         }
     }
 
@@ -552,4 +553,11 @@
                         | DateUtils.FORMAT_SHOW_YEAR
                         | DateUtils.FORMAT_SHOW_TIME);
     }
+
+    @VisibleForTesting
+    void createFooterPreference() {
+        final FooterPreference footerPreference = new FooterPreference(getActivity());
+        footerPreference.setTitle(R.string.sync_is_failing);
+        getPreferenceScreen().addPreference(footerPreference);
+    }
 }
diff --git a/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java b/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
index 1fd7997..c647b8d 100644
--- a/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
+++ b/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
@@ -33,6 +33,7 @@
 import android.util.ArraySet;
 
 import com.android.internal.telephony.SmsApplication;
+import com.android.internal.telephony.euicc.EuiccConnector;
 import com.android.settings.R;
 
 import java.util.ArrayList;
@@ -141,6 +142,12 @@
             keepEnabledPackages.add(defaultSms.getPackageName());
         }
 
+        // Keep Euicc Service enabled.
+        final ComponentInfo euicc = EuiccConnector.findBestComponent(mPm);
+        if (euicc != null) {
+            keepEnabledPackages.add(euicc.packageName);
+        }
+
         keepEnabledPackages.addAll(getEnabledPackageWhitelist());
 
         final LocationManager locationManager =
diff --git a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
index 07925f6..8274634 100755
--- a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
+++ b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
@@ -19,7 +19,6 @@
 import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
 
 import android.app.Activity;
-import android.app.ActivityManager;
 import android.app.admin.DevicePolicyManager;
 import android.app.settings.SettingsEnums;
 import android.content.BroadcastReceiver;
@@ -183,10 +182,6 @@
         super.onCreate(icicle);
         mFinishing = false;
         final Activity activity = getActivity();
-        if (isLockTaskModePinned(activity)) {
-            finishActivity(activity);
-            return;
-        }
         mDpm = (DevicePolicyManager) activity.getSystemService(Context.DEVICE_POLICY_SERVICE);
         mUserManager = (UserManager) activity.getSystemService(Context.USER_SERVICE);
         mPm = activity.getPackageManager();
@@ -197,6 +192,7 @@
             return;
         }
         startListeningToPackageRemove();
+
         setHasOptionsMenu(true);
     }
 
@@ -318,8 +314,9 @@
     @VisibleForTesting
     boolean ensurePackageInfoAvailable(Activity activity) {
         if (mPackageInfo == null) {
+            mFinishing = true;
             Log.w(TAG, "Package info not available. Is this package already uninstalled?");
-            finishActivity(activity);
+            activity.finishAndRemoveTask();
             return false;
         }
         return true;
@@ -334,28 +331,14 @@
     @VisibleForTesting
     boolean ensureDisplayableModule(Activity activity) {
         if (AppUtils.isHiddenSystemModule(activity.getApplicationContext(), mPackageName)) {
+            mFinishing = true;
             Log.w(TAG, "Package is hidden module, exiting: " + mPackageName);
-            finishActivity(activity);
+            activity.finishAndRemoveTask();
             return false;
         }
         return true;
     }
 
-    /**
-     * Check the state of device lock task mode.
-     *
-     * @return true if the device lock task mode pinned.
-     */
-    @VisibleForTesting
-    boolean isLockTaskModePinned(Activity activity) {
-        ActivityManager activityManager = activity.getSystemService(ActivityManager.class);
-        if (activityManager.getLockTaskModeState() == ActivityManager.LOCK_TASK_MODE_PINNED) {
-            Log.w(TAG, "Device lock task mode pinned.");
-            return true;
-        }
-        return false;
-    }
-
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         super.onCreateOptionsMenu(menu, inflater);
@@ -654,11 +637,6 @@
         getContext().unregisterReceiver(mPackageRemovedReceiver);
     }
 
-    private void finishActivity(Activity activity) {
-        mFinishing = true;
-        activity.finishAndRemoveTask();
-    }
-
     @VisibleForTesting
     final BroadcastReceiver mPackageRemovedReceiver = new BroadcastReceiver() {
         @Override
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java
index 50814ee..8fb40bf 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java
@@ -36,7 +36,7 @@
 
 import com.android.settings.R;
 import com.android.settings.testutils.FakeFeatureFactory;
-import com.android.settingslib.accounts.AuthenticatorHelper;
+import com.android.settings.testutils.shadow.ShadowAuthenticationHelper;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.widget.LayoutPreference;
 
@@ -48,11 +48,9 @@
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
 
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = AccountHeaderPreferenceControllerTest.ShadowAuthenticatorHelper.class)
+@Config(shadows = ShadowAuthenticationHelper.class)
 public class AccountHeaderPreferenceControllerTest {
 
     @Mock
@@ -109,12 +107,4 @@
 
         assertThat(label).isEqualTo(account.name);
     }
-
-    @Implements(AuthenticatorHelper.class)
-    public static class ShadowAuthenticatorHelper {
-        @Implementation
-        protected void onAccountsUpdated(Account[] accounts) {
-
-        }
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java b/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java
index dd1778f..59d1f60 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java
@@ -15,6 +15,8 @@
  */
 package com.android.settings.accounts;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
@@ -24,7 +26,9 @@
 import android.os.UserHandle;
 
 import androidx.fragment.app.FragmentActivity;
+import androidx.preference.Preference;
 
+import com.android.settings.testutils.shadow.ShadowAuthenticationHelper;
 import com.android.settings.testutils.shadow.ShadowContentResolver;
 
 import org.junit.After;
@@ -33,6 +37,7 @@
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
+import org.robolectric.shadows.androidx.fragment.FragmentController;
 import org.robolectric.util.ReflectionHelpers;
 
 @RunWith(RobolectricTestRunner.class)
@@ -57,4 +62,18 @@
         settings.onPreferenceTreeClick(preference);
         // no crash
     }
+
+    @Test
+    @Config(shadows = {ShadowAuthenticationHelper.class})
+    public void createFooterPreference_shouldReturnFooter() {
+        final AccountSyncSettings settings = FragmentController.of(new AccountSyncSettings())
+                .create()
+                .get();
+
+        settings.createFooterPreference();
+
+        final Preference footer = settings.getPreferenceScreen().findPreference(
+                "footer_preference");
+        assertThat(footer).isNotNull();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/accounts/TopLevelAccountEntryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/TopLevelAccountEntryPreferenceControllerTest.java
index ced3db1..8fe8e19 100644
--- a/tests/robotests/src/com/android/settings/accounts/TopLevelAccountEntryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/TopLevelAccountEntryPreferenceControllerTest.java
@@ -16,19 +16,12 @@
 
 package com.android.settings.accounts;
 
-import static com.android.settings.accounts.TopLevelAccountEntryPreferenceControllerTest
-        .ShadowAuthenticationHelper.LABELS;
-import static com.android.settings.accounts.TopLevelAccountEntryPreferenceControllerTest
-        .ShadowAuthenticationHelper.TYPES;
-
 import static com.google.common.truth.Truth.assertThat;
 
 import android.content.Context;
-import android.os.UserHandle;
-import android.text.TextUtils;
 
 import com.android.settings.R;
-import com.android.settingslib.accounts.AuthenticatorHelper;
+import com.android.settings.testutils.shadow.ShadowAuthenticationHelper;
 
 import org.junit.After;
 import org.junit.Before;
@@ -37,21 +30,22 @@
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.annotation.Resetter;
 
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = {TopLevelAccountEntryPreferenceControllerTest.ShadowAuthenticationHelper.class})
+@Config(shadows = {ShadowAuthenticationHelper.class})
 public class TopLevelAccountEntryPreferenceControllerTest {
 
     private TopLevelAccountEntryPreferenceController mController;
     private Context mContext;
+    private String[] LABELS;
+    private String[] TYPES;
 
     @Before
     public void setUp() {
         mContext = RuntimeEnvironment.application;
         mController = new TopLevelAccountEntryPreferenceController(mContext, "test_key");
+        LABELS = ShadowAuthenticationHelper.getLabels();
+        TYPES = ShadowAuthenticationHelper.getTypes();
     }
 
     @After
@@ -60,7 +54,6 @@
     }
 
     @Test
-
     public void updateSummary_hasAccount_shouldDisplayUpTo3AccountTypes() {
         assertThat(mController.getSummary())
                 .isEqualTo(LABELS[0] + ", " + LABELS[1] + ", and " + LABELS[2]);
@@ -83,44 +76,4 @@
         // should only show the 2 accounts with labels
         assertThat(mController.getSummary()).isEqualTo(LABELS[0] + " and " + LABELS[1]);
     }
-
-    @Implements(AuthenticatorHelper.class)
-    public static class ShadowAuthenticationHelper {
-
-        static final String[] TYPES = {"type1", "type2", "type3", "type4"};
-        static final String[] LABELS = {"LABEL1", "LABEL2", "LABEL3", "LABEL4"};
-        private static String[] sEnabledAccount = TYPES;
-
-        protected void __constructor__(Context context, UserHandle userHandle,
-                AuthenticatorHelper.OnAccountsUpdateListener listener) {
-        }
-
-        private static void setEnabledAccount(String[] enabledAccount) {
-            sEnabledAccount = enabledAccount;
-        }
-
-        @Resetter
-        public static void reset() {
-            sEnabledAccount = TYPES;
-        }
-
-        @Implementation
-        protected String[] getEnabledAccountTypes() {
-            return sEnabledAccount;
-        }
-
-        @Implementation
-        protected CharSequence getLabelForType(Context context, final String accountType) {
-            if (TextUtils.equals(accountType, TYPES[0])) {
-                return LABELS[0];
-            } else if (TextUtils.equals(accountType, TYPES[1])) {
-                return LABELS[1];
-            } else if (TextUtils.equals(accountType, TYPES[2])) {
-                return LABELS[2];
-            } else if (TextUtils.equals(accountType, TYPES[3])) {
-                return LABELS[3];
-            }
-            return null;
-        }
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
index fcb7518..12b93cd 100644
--- a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
@@ -27,6 +27,7 @@
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.ComponentInfo;
 import android.content.pm.IPackageManager;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
@@ -36,11 +37,12 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 
-import com.android.settings.R;
+import com.android.internal.telephony.euicc.EuiccConnector;
 import com.android.settings.testutils.ApplicationTestUtils;
 import com.android.settingslib.testutils.shadow.ShadowDefaultDialerManager;
 import com.android.settingslib.testutils.shadow.ShadowSmsApplication;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -49,6 +51,8 @@
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
 import org.robolectric.shadows.ShadowApplication;
 import org.robolectric.util.ReflectionHelpers;
 
@@ -105,6 +109,12 @@
                 mPackageManagerService, mDevicePolicyManager);
     }
 
+    @After
+    @Config(shadows = {ShadowEuiccConnector.class})
+    public void tearDown() {
+        ShadowEuiccConnector.reset();
+    }
+
     private void verifyCalculateNumberOfPolicyInstalledApps(boolean async) {
         setUpUsersAndInstalledApps();
 
@@ -165,7 +175,7 @@
                 .thenReturn(PackageManager.INSTALL_REASON_POLICY);
 
         mAppCount = -1;
-        mProvider.calculateNumberOfAppsWithAdminGrantedPermissions(new String[] {PERMISSION}, async,
+        mProvider.calculateNumberOfAppsWithAdminGrantedPermissions(new String[]{PERMISSION}, async,
                 (num) -> mAppCount = num);
         if (async) {
             ShadowApplication.runBackgroundTasks();
@@ -202,7 +212,7 @@
                 .thenReturn(PackageManager.INSTALL_REASON_POLICY);
 
         mAppList = null;
-        mProvider.listAppsWithAdminGrantedPermissions(new String[] {PERMISSION},
+        mProvider.listAppsWithAdminGrantedPermissions(new String[]{PERMISSION},
                 (list) -> mAppList = list);
         assertThat(mAppList).isNotNull();
         assertThat(mAppList.size()).isEqualTo(2);
@@ -251,10 +261,10 @@
                 new ApplicationInfo(app2.activityInfo.applicationInfo)));
 
         assertThat(mProvider.findPersistentPreferredActivities(MAIN_USER_ID,
-                new Intent[] {viewIntent, editIntent, sendIntent}))
+                new Intent[]{viewIntent, editIntent, sendIntent}))
                 .isEqualTo(expectedMainUserActivities);
         assertThat(mProvider.findPersistentPreferredActivities(MANAGED_PROFILE_ID,
-                new Intent[] {viewIntent, editIntent, sendIntent}))
+                new Intent[]{viewIntent, editIntent, sendIntent}))
                 .isEqualTo(expectedManagedUserActivities);
     }
 
@@ -283,6 +293,33 @@
     }
 
     @Test
+    @Config(shadows = {ShadowSmsApplication.class, ShadowDefaultDialerManager.class,
+            ShadowEuiccConnector.class})
+    public void getKeepEnabledPackages_hasEuiccComponent_shouldContainEuiccPackage() {
+        final String testDialer = "com.android.test.defaultdialer";
+        final String testSms = "com.android.test.defaultsms";
+        final String testLocationHistory = "com.android.test.location.history";
+        final String testEuicc = "com.android.test.euicc";
+
+        ShadowSmsApplication.setDefaultSmsApplication(new ComponentName(testSms, "receiver"));
+        ShadowDefaultDialerManager.setDefaultDialerApplication(testDialer);
+        final ComponentInfo componentInfo = new ComponentInfo();
+        componentInfo.packageName = testEuicc;
+        ShadowEuiccConnector.setBestComponent(componentInfo);
+
+        // Spy the real context to mock LocationManager.
+        Context spyContext = spy(RuntimeEnvironment.application);
+        when(mLocationManager.getExtraLocationControllerPackage()).thenReturn(testLocationHistory);
+        when(spyContext.getSystemService(Context.LOCATION_SERVICE)).thenReturn(mLocationManager);
+
+        ReflectionHelpers.setField(mProvider, "mContext", spyContext);
+
+        final Set<String> keepEnabledPackages = mProvider.getKeepEnabledPackages();
+
+        assertThat(keepEnabledPackages).contains(testEuicc);
+    }
+
+    @Test
     @Config(shadows = {ShadowSmsApplication.class, ShadowDefaultDialerManager.class})
     public void getKeepEnabledPackages_shouldContainSettingsIntelligence() {
         final String testDialer = "com.android.test.defaultdialer";
@@ -354,4 +391,23 @@
         resolveInfo.activityInfo = activityInfo;
         return resolveInfo;
     }
+
+    @Implements(EuiccConnector.class)
+    public static class ShadowEuiccConnector {
+
+        private static ComponentInfo sBestComponent;
+
+        @Implementation
+        protected static ComponentInfo findBestComponent(PackageManager packageManager) {
+            return sBestComponent;
+        }
+
+        public static void setBestComponent(ComponentInfo componentInfo) {
+            sBestComponent = componentInfo;
+        }
+
+        public static void reset() {
+            sBestComponent = null;
+        }
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/AppInfoDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/AppInfoDashboardFragmentTest.java
index 01304ea..e46cd06 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/AppInfoDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/AppInfoDashboardFragmentTest.java
@@ -33,7 +33,6 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import android.app.ActivityManager;
 import android.app.admin.DevicePolicyManager;
 import android.content.Context;
 import android.content.Intent;
@@ -87,8 +86,6 @@
     private DevicePolicyManager mDevicePolicyManager;
     @Mock
     private PackageManager mPackageManager;
-    @Mock
-    private ActivityManager mActivityManager;
 
     private AppInfoDashboardFragment mFragment;
     private Context mShadowContext;
@@ -96,13 +93,11 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mShadowContext = spy(RuntimeEnvironment.application);
+        mShadowContext = RuntimeEnvironment.application;
         mFragment = spy(new AppInfoDashboardFragment());
         doReturn(mActivity).when(mFragment).getActivity();
         doReturn(mShadowContext).when(mFragment).getContext();
         doReturn(mPackageManager).when(mActivity).getPackageManager();
-        doReturn(mShadowContext).when(mActivity).getApplicationContext();
-        doReturn(mActivityManager).when(mActivity).getSystemService(ActivityManager.class);
         when(mUserManager.isAdminUser()).thenReturn(true);
 
         ReflectionHelpers.setField(mFragment, "mUserManager", mUserManager);
@@ -207,6 +202,7 @@
         ShadowAppUtils.addHiddenModule(PACKAGE_NAME);
         ReflectionHelpers.setField(mFragment, "mPackageName", PACKAGE_NAME);
 
+
         assertThat(mFragment.ensureDisplayableModule(mActivity)).isFalse();
     }
 
@@ -219,14 +215,6 @@
     }
 
     @Test
-    public void isLockTaskModePinned_pinned_shouldReturnTrue() {
-        doReturn(ActivityManager.LOCK_TASK_MODE_PINNED).when(
-                mActivityManager).getLockTaskModeState();
-
-        assertThat(mFragment.isLockTaskModePinned(mActivity)).isTrue();
-    }
-
-    @Test
     public void createPreference_hasNoPackageInfo_shouldSkip() {
         ReflectionHelpers.setField(mFragment, "mPackageInfo", null);
 
@@ -279,8 +267,9 @@
     public void onActivityResult_uninstalledUpdates_shouldInvalidateOptionsMenu() {
         doReturn(true).when(mFragment).refreshUi();
 
-        mFragment.onActivityResult(AppInfoDashboardFragment.REQUEST_UNINSTALL, 0,
-                mock(Intent.class));
+        mFragment
+                .onActivityResult(AppInfoDashboardFragment.REQUEST_UNINSTALL, 0,
+                        mock(Intent.class));
 
         verify(mActivity).invalidateOptionsMenu();
     }
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAuthenticationHelper.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAuthenticationHelper.java
new file mode 100644
index 0000000..cb7da56
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAuthenticationHelper.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.testutils.shadow;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.os.UserHandle;
+import android.text.TextUtils;
+
+import com.android.settingslib.accounts.AuthenticatorHelper;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.annotation.Resetter;
+
+@Implements(AuthenticatorHelper.class)
+public class ShadowAuthenticationHelper {
+    static final String[] TYPES = {"type1", "type2", "type3", "type4"};
+    static final String[] LABELS = {"LABEL1", "LABEL2", "LABEL3", "LABEL4"};
+    private static String[] sEnabledAccount = TYPES;
+
+    protected void __constructor__(Context context, UserHandle userHandle,
+            AuthenticatorHelper.OnAccountsUpdateListener listener) {
+    }
+
+    public static void setEnabledAccount(String[] enabledAccount) {
+        sEnabledAccount = enabledAccount;
+    }
+
+    @Resetter
+    public static void reset() {
+        sEnabledAccount = TYPES;
+    }
+
+    @Implementation
+    protected String[] getEnabledAccountTypes() {
+        return sEnabledAccount;
+    }
+
+    @Implementation
+    protected CharSequence getLabelForType(Context context, final String accountType) {
+        if (TextUtils.equals(accountType, TYPES[0])) {
+            return LABELS[0];
+        } else if (TextUtils.equals(accountType, TYPES[1])) {
+            return LABELS[1];
+        } else if (TextUtils.equals(accountType, TYPES[2])) {
+            return LABELS[2];
+        } else if (TextUtils.equals(accountType, TYPES[3])) {
+            return LABELS[3];
+        }
+        return null;
+    }
+
+    @Implementation
+    protected Drawable getDrawableForType(Context context, final String accountType) {
+        return context.getPackageManager().getDefaultActivityIcon();
+    }
+
+    public static String[] getTypes() {
+        return TYPES;
+    }
+
+    public static String[] getLabels() {
+        return LABELS;
+    }
+}