Merge "DO NOT MERGE" into pi-car-dev
diff --git a/tests/robotests/Android.mk b/tests/robotests/Android.mk
index 44359b1..17130f0 100644
--- a/tests/robotests/Android.mk
+++ b/tests/robotests/Android.mk
@@ -1,5 +1,5 @@
#############################################
-# Car Settings Robolectric test target. #
+# Car Settings Robolectric test target. #
#############################################
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
@@ -26,7 +26,7 @@
include $(BUILD_STATIC_JAVA_LIBRARY)
#############################################################
-# Car Settings runner target to run the previous target. #
+# Car Settings runner target to run the previous target. #
#############################################################
include $(CLEAR_VARS)
diff --git a/tests/robotests/src/com/android/car/settings/accounts/AccountSyncPreferenceControllerTest.java b/tests/robotests/src/com/android/car/settings/accounts/AccountSyncPreferenceControllerTest.java
index 10bb745..aee57e3 100644
--- a/tests/robotests/src/com/android/car/settings/accounts/AccountSyncPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/car/settings/accounts/AccountSyncPreferenceControllerTest.java
@@ -22,6 +22,7 @@
import static org.robolectric.RuntimeEnvironment.application;
import android.accounts.Account;
+import android.content.ContentResolver;
import android.content.SyncAdapterType;
import android.os.UserHandle;
@@ -80,8 +81,8 @@
"type5", /* userVisible */ true, /* supportsUploading */ true);
SyncAdapterType[] syncAdapters = {syncAdapterType};
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
- ShadowContentResolver.setIsSyncable(mAccount, "authority", SYNCABLE);
- ShadowContentResolver.setSyncAutomaticallyAsUser(mAccount,
+ ContentResolver.setIsSyncable(mAccount, "authority", SYNCABLE);
+ ContentResolver.setSyncAutomaticallyAsUser(mAccount,
"authority", /* sync= */ true, /* userId= */ mUserId);
mController.updateState(mPreference);
@@ -98,8 +99,8 @@
/* accountType */ "type1", /* userVisible */ false, /* supportsUploading */ true);
SyncAdapterType[] syncAdapters = {syncAdapterType};
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
- ShadowContentResolver.setIsSyncable(mAccount, "authority", SYNCABLE);
- ShadowContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority", /* sync= */
+ ContentResolver.setIsSyncable(mAccount, "authority", SYNCABLE);
+ ContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority", /* sync= */
true, /* userId= */ mUserId);
mController.updateState(mPreference);
@@ -116,7 +117,7 @@
"type1", /* userVisible */ true, /* supportsUploading */ true);
SyncAdapterType[] syncAdapters = {syncAdapterType};
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
- ShadowContentResolver.setIsSyncable(mAccount, "authority", NOT_SYNCABLE);
+ ContentResolver.setIsSyncable(mAccount, "authority", NOT_SYNCABLE);
mController.updateState(mPreference);
@@ -132,9 +133,9 @@
"type1", /* userVisible */ true, /* supportsUploading */ true);
SyncAdapterType[] syncAdapters = {syncAdapterType};
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
- ShadowContentResolver.setIsSyncable(mAccount, "authority", SYNCABLE);
- ShadowContentResolver.setMasterSyncAutomaticallyAsUser(true, mUserId);
- ShadowContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority", /* sync= */
+ ContentResolver.setIsSyncable(mAccount, "authority", SYNCABLE);
+ ContentResolver.setMasterSyncAutomaticallyAsUser(true, mUserId);
+ ContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority", /* sync= */
false, /* userId= */ mUserId);
mController.updateState(mPreference);
@@ -151,8 +152,8 @@
"type1", /* userVisible */ true, /* supportsUploading */ true);
SyncAdapterType[] syncAdapters = {syncAdapterType};
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
- ShadowContentResolver.setIsSyncable(mAccount, "authority", SYNCABLE);
- ShadowContentResolver.setMasterSyncAutomaticallyAsUser(false, mUserId);
+ ContentResolver.setIsSyncable(mAccount, "authority", SYNCABLE);
+ ContentResolver.setMasterSyncAutomaticallyAsUser(false, mUserId);
mController.updateState(mPreference);
@@ -168,8 +169,8 @@
"type1", /* userVisible */ true, /* supportsUploading */ true);
SyncAdapterType[] syncAdapters = {syncAdapterType};
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
- ShadowContentResolver.setIsSyncable(mAccount, "authority", SYNCABLE);
- ShadowContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority", /* sync= */
+ ContentResolver.setIsSyncable(mAccount, "authority", SYNCABLE);
+ ContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority", /* sync= */
true, /* userId= */ mUserId);
mController.updateState(mPreference);
@@ -193,19 +194,19 @@
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
// Enable sync for the first three authorities and disable it for the fourth one
- ShadowContentResolver.setIsSyncable(mAccount, "authority1", SYNCABLE);
- ShadowContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority1", /* sync= */
+ ContentResolver.setIsSyncable(mAccount, "authority1", SYNCABLE);
+ ContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority1", /* sync= */
true, /* userId= */ mUserId);
- ShadowContentResolver.setIsSyncable(mAccount, "authority2", SYNCABLE);
- ShadowContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority2", /* sync= */
+ ContentResolver.setIsSyncable(mAccount, "authority2", SYNCABLE);
+ ContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority2", /* sync= */
true, /* userId= */ mUserId);
- ShadowContentResolver.setIsSyncable(mAccount, "authority3", SYNCABLE);
- ShadowContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority3", /* sync= */
+ ContentResolver.setIsSyncable(mAccount, "authority3", SYNCABLE);
+ ContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority3", /* sync= */
true, /* userId= */ mUserId);
- ShadowContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority4", /* sync= */
+ ContentResolver.setSyncAutomaticallyAsUser(mAccount, "authority4", /* sync= */
false, /* userId= */ mUserId);
mController.updateState(mPreference);
diff --git a/tests/robotests/src/com/android/car/settings/common/ErrorDialogTest.java b/tests/robotests/src/com/android/car/settings/common/ErrorDialogTest.java
index 448374b..7bd0654 100644
--- a/tests/robotests/src/com/android/car/settings/common/ErrorDialogTest.java
+++ b/tests/robotests/src/com/android/car/settings/common/ErrorDialogTest.java
@@ -45,9 +45,7 @@
public void setUpTestActivity() {
MockitoAnnotations.initMocks(this);
- mTestActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ mTestActivity = Robolectric.setupActivity(BaseTestActivity.class);
mTestFragment = new TestBaseFragment();
mTestActivity.launchFragment(mTestFragment);
diff --git a/tests/robotests/src/com/android/car/settings/location/LocationSettingsFragmentTest.java b/tests/robotests/src/com/android/car/settings/location/LocationSettingsFragmentTest.java
index fa3b396..a5d2544 100644
--- a/tests/robotests/src/com/android/car/settings/location/LocationSettingsFragmentTest.java
+++ b/tests/robotests/src/com/android/car/settings/location/LocationSettingsFragmentTest.java
@@ -51,9 +51,7 @@
mLocationManager = (LocationManager) RuntimeEnvironment.application
.getSystemService(Service.LOCATION_SERVICE);
- mActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ mActivity = Robolectric.setupActivity(BaseTestActivity.class);
}
@After
diff --git a/tests/robotests/src/com/android/car/settings/security/ConfirmLockPinPasswordFragmentTest.java b/tests/robotests/src/com/android/car/settings/security/ConfirmLockPinPasswordFragmentTest.java
index e63f8b3..e3788a1 100644
--- a/tests/robotests/src/com/android/car/settings/security/ConfirmLockPinPasswordFragmentTest.java
+++ b/tests/robotests/src/com/android/car/settings/security/ConfirmLockPinPasswordFragmentTest.java
@@ -41,11 +41,7 @@
@Before
public void initFragment() {
- mTestActivity = Robolectric.buildActivity(TestSettingsScreenLockActivity.class)
- .create()
- .start()
- .resume()
- .get();
+ mTestActivity = Robolectric.setupActivity(TestSettingsScreenLockActivity.class);
mPinFragment = ConfirmLockPinPasswordFragment.newPinInstance(/* isInSetupWizard= */ false);
mTestActivity.launchFragment(mPinFragment);
diff --git a/tests/robotests/src/com/android/car/settings/security/ConfirmRemoveScreenLockDialogTest.java b/tests/robotests/src/com/android/car/settings/security/ConfirmRemoveScreenLockDialogTest.java
index aac7a2b..21e760a 100644
--- a/tests/robotests/src/com/android/car/settings/security/ConfirmRemoveScreenLockDialogTest.java
+++ b/tests/robotests/src/com/android/car/settings/security/ConfirmRemoveScreenLockDialogTest.java
@@ -44,11 +44,9 @@
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- mTestActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
mDialog = new ConfirmRemoveScreenLockDialog();
mDialog.setConfirmRemoveScreenLockListener(mListener);
+ mTestActivity = Robolectric.setupActivity(BaseTestActivity.class);
mTestActivity.showDialog(mDialog, TEST_TAG);
}
diff --git a/tests/robotests/src/com/android/car/settings/system/ResetNetworkConfirmFragmentTest.java b/tests/robotests/src/com/android/car/settings/system/ResetNetworkConfirmFragmentTest.java
index 0e511be..16fdc53 100644
--- a/tests/robotests/src/com/android/car/settings/system/ResetNetworkConfirmFragmentTest.java
+++ b/tests/robotests/src/com/android/car/settings/system/ResetNetworkConfirmFragmentTest.java
@@ -83,9 +83,7 @@
setEuiccResetCheckbox(false);
setNetworkSubscriptionId("");
- BaseTestActivity testActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ BaseTestActivity testActivity = Robolectric.setupActivity(BaseTestActivity.class);
ResetNetworkConfirmFragment fragment = new ResetNetworkConfirmFragment();
testActivity.launchFragment(fragment);
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowAccountManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowAccountManager.java
index 2cd21c8..eb0a280 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowAccountManager.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowAccountManager.java
@@ -27,17 +27,17 @@
@Implements(AccountManager.class)
public class ShadowAccountManager extends org.robolectric.shadows.ShadowAccountManager {
@Implementation
- public Account[] getAccountsByTypeAsUser(String type, UserHandle userHandle) {
+ protected Account[] getAccountsByTypeAsUser(String type, UserHandle userHandle) {
return getAccountsByType(type);
}
@Implementation
- public AuthenticatorDescription[] getAuthenticatorTypesAsUser(int userId) {
+ protected AuthenticatorDescription[] getAuthenticatorTypesAsUser(int userId) {
return getAuthenticatorTypes();
}
@Implementation
- public Account[] getAccountsAsUser(int userId) {
+ protected Account[] getAccountsAsUser(int userId) {
return getAccounts();
}
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowActionListItem.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowActionListItem.java
index 3f62eef..4ff0181 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowActionListItem.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowActionListItem.java
@@ -35,17 +35,17 @@
private View.OnClickListener mPrimaryActionOnClickListener;
@Implementation
- public void setTitle(CharSequence title) {
+ protected void setTitle(CharSequence title) {
mTitle = title;
}
@Implementation
- public void setPrimaryActionIcon(Drawable icon, int size) {
+ protected void setPrimaryActionIcon(Drawable icon, int size) {
mIcon = icon;
}
@Implementation
- public void setAction(String text, boolean showDivider, View.OnClickListener listener) {
+ protected void setAction(String text, boolean showDivider, View.OnClickListener listener) {
mPrimaryActionText = text;
mPrimaryActionOnClickListener = listener;
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowBluetoothAdapter.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowBluetoothAdapter.java
index f0bcd55..87dfe9f 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowBluetoothAdapter.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowBluetoothAdapter.java
@@ -33,7 +33,7 @@
}
@Implementation
- public boolean factoryReset() {
+ protected boolean factoryReset() {
sResetCalledCount++;
return true;
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowCar.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowCar.java
index dc0c883..2aaa1f0 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowCar.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowCar.java
@@ -46,7 +46,7 @@
* Returns a mocked version of a {@link Car} object.
*/
@Implementation
- public static Car createCar(Context context, ServiceConnection serviceConnection) {
+ protected static Car createCar(Context context, ServiceConnection serviceConnection) {
if (serviceConnection != null) {
doAnswer((Answer<Void>) invocation -> {
serviceConnection.onServiceConnected(null, null);
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowCarUserManagerHelper.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowCarUserManagerHelper.java
index 62c8a54..ab496d3 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowCarUserManagerHelper.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowCarUserManagerHelper.java
@@ -43,107 +43,107 @@
}
@Implementation
- public void setUserName(UserInfo user, String name) {
+ protected void setUserName(UserInfo user, String name) {
sMockInstance.setUserName(user, name);
}
@Implementation
- public UserInfo getCurrentProcessUserInfo() {
+ protected UserInfo getCurrentProcessUserInfo() {
return sMockInstance.getCurrentProcessUserInfo();
}
@Implementation
- public int getCurrentProcessUserId() {
+ protected int getCurrentProcessUserId() {
return sMockInstance.getCurrentProcessUserId();
}
@Implementation
- public boolean isCurrentProcessUser(UserInfo userInfo) {
+ protected boolean isCurrentProcessUser(UserInfo userInfo) {
return sMockInstance.isCurrentProcessUser(userInfo);
}
@Implementation
- public List<UserInfo> getAllSwitchableUsers() {
+ protected List<UserInfo> getAllSwitchableUsers() {
return sMockInstance.getAllSwitchableUsers();
}
@Implementation
- public UserInfo createNewNonAdminUser(String userName) {
+ protected UserInfo createNewNonAdminUser(String userName) {
return sMockInstance.createNewNonAdminUser(userName);
}
@Implementation
- public void registerOnUsersUpdateListener(OnUsersUpdateListener listener) {
+ protected void registerOnUsersUpdateListener(OnUsersUpdateListener listener) {
sMockInstance.registerOnUsersUpdateListener(listener);
}
@Implementation
- public void unregisterOnUsersUpdateListener(OnUsersUpdateListener listener) {
+ protected void unregisterOnUsersUpdateListener(OnUsersUpdateListener listener) {
sMockInstance.unregisterOnUsersUpdateListener(listener);
}
@Implementation
- public boolean isUserLimitReached() {
+ protected boolean isUserLimitReached() {
return sMockInstance.isUserLimitReached();
}
@Implementation
- public boolean canCurrentProcessModifyAccounts() {
+ protected boolean canCurrentProcessModifyAccounts() {
return sMockInstance.canCurrentProcessModifyAccounts();
}
@Implementation
- public boolean canCurrentProcessAddUsers() {
+ protected boolean canCurrentProcessAddUsers() {
return sMockInstance.canCurrentProcessAddUsers();
}
@Implementation
- public int getMaxSupportedRealUsers() {
+ protected int getMaxSupportedRealUsers() {
return sMockInstance.getMaxSupportedRealUsers();
}
@Implementation
- public boolean canCurrentProcessRemoveUsers() {
+ protected boolean canCurrentProcessRemoveUsers() {
return sMockInstance.canCurrentProcessRemoveUsers();
}
@Implementation
- public boolean canUserBeRemoved(UserInfo userInfo) {
+ protected boolean canUserBeRemoved(UserInfo userInfo) {
return sMockInstance.canUserBeRemoved(userInfo);
}
@Implementation
- public void grantAdminPermissions(UserInfo user) {
+ protected void grantAdminPermissions(UserInfo user) {
sMockInstance.grantAdminPermissions(user);
}
@Implementation
- public boolean isCurrentProcessDemoUser() {
+ protected boolean isCurrentProcessDemoUser() {
return sMockInstance.isCurrentProcessDemoUser();
}
@Implementation
- public boolean isCurrentProcessAdminUser() {
+ protected boolean isCurrentProcessAdminUser() {
return sMockInstance.isCurrentProcessAdminUser();
}
@Implementation
- public boolean isCurrentProcessGuestUser() {
+ protected boolean isCurrentProcessGuestUser() {
return sMockInstance.isCurrentProcessGuestUser();
}
@Implementation
- public boolean removeUser(UserInfo userInfo, String guestUserName) {
+ protected boolean removeUser(UserInfo userInfo, String guestUserName) {
return sMockInstance.removeUser(userInfo, guestUserName);
}
@Implementation
- public void setUserRestriction(UserInfo userInfo, String restriction, boolean enable) {
+ protected void setUserRestriction(UserInfo userInfo, String restriction, boolean enable) {
sMockInstance.setUserRestriction(userInfo, restriction, enable);
}
@Implementation
- public boolean hasUserRestriction(String restriction, UserInfo userInfo) {
+ protected boolean hasUserRestriction(String restriction, UserInfo userInfo) {
return sMockInstance.hasUserRestriction(restriction, userInfo);
}
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowCarrierConfigManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowCarrierConfigManager.java
index 382a26b..58cc473 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowCarrierConfigManager.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowCarrierConfigManager.java
@@ -29,7 +29,7 @@
private SparseArray<PersistableBundle> mBundles = new SparseArray<>();
@Implementation
- public PersistableBundle getConfigForSubId(int subId) {
+ protected PersistableBundle getConfigForSubId(int subId) {
return mBundles.get(subId);
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowConnectivityManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowConnectivityManager.java
index dc3db4e..03a06dd 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowConnectivityManager.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowConnectivityManager.java
@@ -32,7 +32,7 @@
}
@Implementation
- public void factoryReset() {
+ protected void factoryReset() {
sResetCalledCount++;
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowContentResolver.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowContentResolver.java
index dce1a0d..3d33afa 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowContentResolver.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowContentResolver.java
@@ -44,23 +44,23 @@
private static Map<Integer, Boolean> sMasterSyncAutomatically = new HashMap<>();
@Implementation
- public static SyncAdapterType[] getSyncAdapterTypesAsUser(int userId) {
+ protected static SyncAdapterType[] getSyncAdapterTypesAsUser(int userId) {
return sSyncAdapterTypes;
}
@Implementation
- public static int getIsSyncableAsUser(Account account, String authority, int userId) {
+ protected static int getIsSyncableAsUser(Account account, String authority, int userId) {
return sSyncable.getOrDefault(authority, SYNCABLE);
}
@Implementation
- public static boolean getSyncAutomaticallyAsUser(Account account, String authority,
+ protected static boolean getSyncAutomaticallyAsUser(Account account, String authority,
int userId) {
return sSyncAutomatically.getOrDefault(authority, true);
}
@Implementation
- public static boolean getMasterSyncAutomaticallyAsUser(int userId) {
+ protected static boolean getMasterSyncAutomaticallyAsUser(int userId) {
return sMasterSyncAutomatically.getOrDefault(userId, true);
}
@@ -69,18 +69,18 @@
}
@Implementation
- public static void setIsSyncable(Account account, String authority, int syncable) {
+ protected static void setIsSyncable(Account account, String authority, int syncable) {
sSyncable.put(authority, syncable);
}
@Implementation
- public static void setSyncAutomaticallyAsUser(Account account, String authority, boolean sync,
- @UserIdInt int userId) {
+ protected static void setSyncAutomaticallyAsUser(Account account, String authority,
+ boolean sync, @UserIdInt int userId) {
sSyncAutomatically.put(authority, sync);
}
@Implementation
- public static void setMasterSyncAutomaticallyAsUser(boolean sync, @UserIdInt int userId) {
+ protected static void setMasterSyncAutomaticallyAsUser(boolean sync, @UserIdInt int userId) {
sMasterSyncAutomatically.put(userId, sync);
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowEuiccManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowEuiccManager.java
index 2c120bc..f4f581f 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowEuiccManager.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowEuiccManager.java
@@ -33,7 +33,7 @@
}
@Implementation
- public boolean isEnabled() {
+ protected boolean isEnabled() {
return mIsEnabled;
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowLocalePicker.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowLocalePicker.java
index 050b3bb..ed59177 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowLocalePicker.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowLocalePicker.java
@@ -35,7 +35,7 @@
}
@Implementation
- public static void updateLocale(Locale locale) {
+ protected static void updateLocale(Locale locale) {
sLocaleUpdated = true;
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowLocaleStore.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowLocaleStore.java
index 591c859..a9dc5ce 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowLocaleStore.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowLocaleStore.java
@@ -51,7 +51,7 @@
}
@Implementation
- public static Set<LocaleStore.LocaleInfo> getLevelLocales(Context context,
+ protected static Set<LocaleStore.LocaleInfo> getLevelLocales(Context context,
Set<String> ignorables, LocaleStore.LocaleInfo parent, boolean translatedOnly) {
if (parent != null) {
return sLocaleInfoRelationships.getOrDefault(parent, new HashSet<>());
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowLocationManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowLocationManager.java
index e04f75e..e92d342 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowLocationManager.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowLocationManager.java
@@ -29,7 +29,7 @@
public class ShadowLocationManager {
@Implementation
- public void setLocationEnabledForUser(boolean enabled, UserHandle userHandle) {
+ protected void setLocationEnabledForUser(boolean enabled, UserHandle userHandle) {
int newMode = enabled
? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY
: Settings.Secure.LOCATION_MODE_OFF;
@@ -41,7 +41,7 @@
}
@Implementation
- public boolean isLocationEnabled() {
+ protected boolean isLocationEnabled() {
return Settings.Secure.getInt(RuntimeEnvironment.application.getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF)
!= Settings.Secure.LOCATION_MODE_OFF;
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowLockPatternUtils.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowLockPatternUtils.java
index c74a44a..d29352b 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowLockPatternUtils.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowLockPatternUtils.java
@@ -37,7 +37,7 @@
}
@Implementation
- public void clearLock(String savedCredential, int userHandle) {
+ protected void clearLock(String savedCredential, int userHandle) {
sInstance.clearLock(savedCredential, userHandle);
}
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowNetworkPolicyManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowNetworkPolicyManager.java
index 1a9ac85..d9b208f 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowNetworkPolicyManager.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowNetworkPolicyManager.java
@@ -36,7 +36,7 @@
}
@Implementation
- public void factoryReset(String subscriber) {
+ protected void factoryReset(String subscriber) {
sResetCalledForSubscriberCount.put(subscriber,
sResetCalledForSubscriberCount.getOrDefault(subscriber, 0) + 1);
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowPowerManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowPowerManager.java
index 1a48d9c..9433b6e 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowPowerManager.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowPowerManager.java
@@ -37,12 +37,12 @@
}
@Implementation
- public int getMinimumScreenBrightnessSetting() {
+ protected int getMinimumScreenBrightnessSetting() {
return sInstance.getMinimumScreenBrightnessSetting();
}
@Implementation
- public int getMaximumScreenBrightnessSetting() {
+ protected int getMaximumScreenBrightnessSetting() {
return sInstance.getMaximumScreenBrightnessSetting();
}
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowRecoverySystem.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowRecoverySystem.java
index bb1390c..90f37d7 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowRecoverySystem.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowRecoverySystem.java
@@ -33,7 +33,7 @@
}
@Implementation
- public static boolean wipeEuiccData(Context context, final String packageName) {
+ protected static boolean wipeEuiccData(Context context, final String packageName) {
sWipeEuiccDataCalledCount++;
return true;
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowRingtoneManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowRingtoneManager.java
index 4f4148e..3f95b35 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowRingtoneManager.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowRingtoneManager.java
@@ -34,7 +34,7 @@
}
@Implementation
- public static Ringtone getRingtone(final Context context, Uri ringtoneUri) {
+ protected static Ringtone getRingtone(final Context context, Uri ringtoneUri) {
return sRingtone;
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowSecureSettings.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowSecureSettings.java
index a817f0a..391c6f2 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowSecureSettings.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowSecureSettings.java
@@ -35,12 +35,12 @@
new WeakHashMap<>();
@Implementation
- public static int getInt(ContentResolver cr, String name, int def) {
+ protected static int getInt(ContentResolver cr, String name, int def) {
return getIntForUser(cr, name, def, cr.getUserId());
}
@Implementation
- public static int getIntForUser(ContentResolver resolver, String name, int def,
+ protected static int getIntForUser(ContentResolver resolver, String name, int def,
int userHandle) {
final Table<Integer, String, Object> userTable = getUserTable(resolver);
synchronized (userTable) {
@@ -50,7 +50,7 @@
}
@Implementation
- public static boolean putIntForUser(ContentResolver resolver, String name, int value,
+ protected static boolean putIntForUser(ContentResolver resolver, String name, int value,
int userHandle) {
final Table<Integer, String, Object> userTable = getUserTable(resolver);
synchronized (userTable) {
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowTelephonyManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowTelephonyManager.java
index a75d1c7..e349bfd 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowTelephonyManager.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowTelephonyManager.java
@@ -38,13 +38,13 @@
}
@Implementation
- public void factoryReset(int subId) {
+ protected void factoryReset(int subId) {
sSubIdsWithResetCalledCount.put(subId,
sSubIdsWithResetCalledCount.getOrDefault(subId, 0) + 1);
}
@Implementation
- public String getSubscriberId(int subId) {
+ protected String getSubscriberId(int subId) {
return subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID ? null : SUBSCRIBER_ID;
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowTextListItem.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowTextListItem.java
index adb78a6..4db770b 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowTextListItem.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowTextListItem.java
@@ -45,29 +45,29 @@
}
@Implementation
- public void setTitle(CharSequence title) {
+ protected void setTitle(CharSequence title) {
mTitle = title;
}
@Implementation
- public void setBody(CharSequence body) {
+ protected void setBody(CharSequence body) {
mBody = body;
}
@Implementation
- public void setBody(CharSequence body, boolean asPrimary) {
+ protected void setBody(CharSequence body, boolean asPrimary) {
mBody = body;
}
@Implementation
- public void setSwitch(boolean checked, boolean showDivider,
+ protected void setSwitch(boolean checked, boolean showDivider,
CompoundButton.OnCheckedChangeListener listener) {
mSwitchChecked = checked;
mSwitchOnCheckedChangeListener = listener;
}
@Implementation
- public void setOnClickListener(View.OnClickListener listener) {
+ protected void setOnClickListener(View.OnClickListener listener) {
mOnClickListener = listener;
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowUserIconProvider.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowUserIconProvider.java
index 77d2102..acddacc 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowUserIconProvider.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowUserIconProvider.java
@@ -27,12 +27,12 @@
@Implements(UserIconProvider.class)
public class ShadowUserIconProvider {
@Implementation
- public Drawable getUserIcon(UserInfo userInfo, Context context) {
+ protected Drawable getUserIcon(UserInfo userInfo, Context context) {
return null;
}
@Implementation
- public Drawable getDefaultGuestIcon(Context context) {
+ protected Drawable getDefaultGuestIcon(Context context) {
return null;
}
}
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowWifiManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowWifiManager.java
index ee86ed4..ebbe385 100644
--- a/tests/robotests/src/com/android/car/settings/testutils/ShadowWifiManager.java
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowWifiManager.java
@@ -32,7 +32,7 @@
}
@Implementation
- public void factoryReset() {
+ protected void factoryReset() {
sResetCalledCount++;
}
diff --git a/tests/robotests/src/com/android/car/settings/users/ChooseNewAdminFragmentTest.java b/tests/robotests/src/com/android/car/settings/users/ChooseNewAdminFragmentTest.java
index 33af33e..b6f41b5 100644
--- a/tests/robotests/src/com/android/car/settings/users/ChooseNewAdminFragmentTest.java
+++ b/tests/robotests/src/com/android/car/settings/users/ChooseNewAdminFragmentTest.java
@@ -54,9 +54,7 @@
public void setUpTestActivity() {
MockitoAnnotations.initMocks(this);
ShadowCarUserManagerHelper.setMockInstance(mCarUserManagerHelper);
- mTestActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ mTestActivity = Robolectric.setupActivity(BaseTestActivity.class);
}
@After
diff --git a/tests/robotests/src/com/android/car/settings/users/ConfirmCreateNewUserDialogTest.java b/tests/robotests/src/com/android/car/settings/users/ConfirmCreateNewUserDialogTest.java
index 1056122..35844ff 100644
--- a/tests/robotests/src/com/android/car/settings/users/ConfirmCreateNewUserDialogTest.java
+++ b/tests/robotests/src/com/android/car/settings/users/ConfirmCreateNewUserDialogTest.java
@@ -45,9 +45,7 @@
public void setUpTestActivity() {
MockitoAnnotations.initMocks(this);
- mTestActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ mTestActivity = Robolectric.setupActivity(BaseTestActivity.class);
mTestFragment = new TestBaseFragment();
mTestActivity.launchFragment(mTestFragment);
diff --git a/tests/robotests/src/com/android/car/settings/users/ConfirmExitRetailModeDialogTest.java b/tests/robotests/src/com/android/car/settings/users/ConfirmExitRetailModeDialogTest.java
index 0cb965a..c7e7047 100644
--- a/tests/robotests/src/com/android/car/settings/users/ConfirmExitRetailModeDialogTest.java
+++ b/tests/robotests/src/com/android/car/settings/users/ConfirmExitRetailModeDialogTest.java
@@ -45,9 +45,7 @@
public void setUpTestActivity() {
MockitoAnnotations.initMocks(this);
- mTestActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ mTestActivity = Robolectric.setupActivity(BaseTestActivity.class);
mTestFragment = new TestBaseFragment();
mTestActivity.launchFragment(mTestFragment);
diff --git a/tests/robotests/src/com/android/car/settings/users/ConfirmGrantAdminPermissionsDialogTest.java b/tests/robotests/src/com/android/car/settings/users/ConfirmGrantAdminPermissionsDialogTest.java
index 1066a7d..732426f 100644
--- a/tests/robotests/src/com/android/car/settings/users/ConfirmGrantAdminPermissionsDialogTest.java
+++ b/tests/robotests/src/com/android/car/settings/users/ConfirmGrantAdminPermissionsDialogTest.java
@@ -45,9 +45,7 @@
public void setUpTestActivity() {
MockitoAnnotations.initMocks(this);
- mTestActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ mTestActivity = Robolectric.setupActivity(BaseTestActivity.class);
}
@Test
diff --git a/tests/robotests/src/com/android/car/settings/users/ConfirmRemoveUserDialogTest.java b/tests/robotests/src/com/android/car/settings/users/ConfirmRemoveUserDialogTest.java
index 6a5af6e..9084aec 100644
--- a/tests/robotests/src/com/android/car/settings/users/ConfirmRemoveUserDialogTest.java
+++ b/tests/robotests/src/com/android/car/settings/users/ConfirmRemoveUserDialogTest.java
@@ -45,9 +45,7 @@
public void setUpTestActivity() {
MockitoAnnotations.initMocks(this);
- mTestActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ mTestActivity = Robolectric.setupActivity(BaseTestActivity.class);
}
@Test
diff --git a/tests/robotests/src/com/android/car/settings/users/EditUsernameFragmentTest.java b/tests/robotests/src/com/android/car/settings/users/EditUsernameFragmentTest.java
index 2192f7d..2bb7e5e 100644
--- a/tests/robotests/src/com/android/car/settings/users/EditUsernameFragmentTest.java
+++ b/tests/robotests/src/com/android/car/settings/users/EditUsernameFragmentTest.java
@@ -59,9 +59,7 @@
public void setUpTestActivity() {
MockitoAnnotations.initMocks(this);
ShadowCarUserManagerHelper.setMockInstance(mCarUserManagerHelper);
- mTestActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ mTestActivity = Robolectric.setupActivity(BaseTestActivity.class);
}
@After
diff --git a/tests/robotests/src/com/android/car/settings/users/UserDetailsFragmentTest.java b/tests/robotests/src/com/android/car/settings/users/UserDetailsFragmentTest.java
index 6f6835b..b96e9d5 100644
--- a/tests/robotests/src/com/android/car/settings/users/UserDetailsFragmentTest.java
+++ b/tests/robotests/src/com/android/car/settings/users/UserDetailsFragmentTest.java
@@ -75,9 +75,7 @@
ShadowApplication shadowApp = ShadowApplication.getInstance();
shadowApp.setSystemService(Context.USER_SERVICE, mUserManager);
- mTestActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ mTestActivity = Robolectric.setupActivity(BaseTestActivity.class);
}
@After
diff --git a/tests/robotests/src/com/android/car/settings/users/UsersBasePreferenceControllerTest.java b/tests/robotests/src/com/android/car/settings/users/UsersBasePreferenceControllerTest.java
index c4f4a87..ad92425 100644
--- a/tests/robotests/src/com/android/car/settings/users/UsersBasePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/car/settings/users/UsersBasePreferenceControllerTest.java
@@ -63,7 +63,6 @@
@Override
protected void userClicked(UserInfo userInfo) {
- return;
}
}
diff --git a/tests/robotests/src/com/android/car/settings/users/UsersListFragmentTest.java b/tests/robotests/src/com/android/car/settings/users/UsersListFragmentTest.java
index fed8ebe..dad284f 100644
--- a/tests/robotests/src/com/android/car/settings/users/UsersListFragmentTest.java
+++ b/tests/robotests/src/com/android/car/settings/users/UsersListFragmentTest.java
@@ -70,9 +70,7 @@
MockitoAnnotations.initMocks(this);
ShadowCarUserManagerHelper.setMockInstance(mCarUserManagerHelper);
mContext = RuntimeEnvironment.application;
- mTestActivity = Robolectric.buildActivity(BaseTestActivity.class)
- .setup()
- .get();
+ mTestActivity = Robolectric.setupActivity(BaseTestActivity.class);
}
@After
diff --git a/tests/robotests/src/com/android/car/settings/users/UsersListPreferenceControllerTest.java b/tests/robotests/src/com/android/car/settings/users/UsersListPreferenceControllerTest.java
index d795689..fd413f9 100644
--- a/tests/robotests/src/com/android/car/settings/users/UsersListPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/car/settings/users/UsersListPreferenceControllerTest.java
@@ -42,7 +42,7 @@
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
-import java.util.Arrays;
+import java.util.Collections;
@RunWith(CarSettingsRobolectricTestRunner.class)
@Config(shadows = {ShadowCarUserManagerHelper.class, ShadowUserIconProvider.class})
@@ -73,7 +73,7 @@
when(mCarUserManagerHelper.getCurrentProcessUserInfo()).thenReturn(TEST_CURRENT_USER);
when(mCarUserManagerHelper.isCurrentProcessUser(TEST_CURRENT_USER)).thenReturn(true);
when(mCarUserManagerHelper.getAllSwitchableUsers()).thenReturn(
- Arrays.asList(TEST_OTHER_USER));
+ Collections.singletonList(TEST_OTHER_USER));
}
@After
diff --git a/tests/robotests/src/com/android/car/settings/wifi/details/WifiInfoProviderImplTest.java b/tests/robotests/src/com/android/car/settings/wifi/details/WifiInfoProviderImplTest.java
index 41d8928..032e1a9 100644
--- a/tests/robotests/src/com/android/car/settings/wifi/details/WifiInfoProviderImplTest.java
+++ b/tests/robotests/src/com/android/car/settings/wifi/details/WifiInfoProviderImplTest.java
@@ -42,7 +42,6 @@
import android.os.Handler;
import com.android.car.settings.CarSettingsRobolectricTestRunner;
-import com.android.car.settings.common.FragmentController;
import com.android.car.settings.wifi.details.WifiInfoProvider.Listener;
import com.android.settingslib.wifi.AccessPoint;
@@ -66,8 +65,6 @@
@Mock
private AccessPoint mMockAccessPoint;
@Mock
- private FragmentController mMockFragmentController;
- @Mock
private ConnectivityManager mMockConnectivityManager;
@Mock
private Network mMockNetwork;