AR/FR: Tests using stubbed values.

Also a simplifying change to MasterClear.

Test: Standard robotests
Bug: 63937032
Change-Id: I54fe60c2e38d938148f89d043bf8a7f7698edc42
This commit is contained in:
Carlos Valdivia
2018-01-21 18:57:28 -08:00
parent aaf307e71d
commit 08c8820b29
2 changed files with 86 additions and 7 deletions

View File

@@ -76,7 +76,7 @@ public class MasterClear extends InstrumentedPreferenceFragment {
private static final String TAG = "MasterClear";
private static final int KEYGUARD_REQUEST = 55;
private static final int CREDENTIAL_CONFIRM_REQUEST = 56;
@VisibleForTesting static final int CREDENTIAL_CONFIRM_REQUEST = 56;
static final String ERASE_EXTERNAL_EXTRA = "erase_sd";
static final String ERASE_ESIMS_EXTRA = "erase_esim";
@@ -157,9 +157,12 @@ public class MasterClear extends InstrumentedPreferenceFragment {
.setAction("android.accounts.action.PRE_FACTORY_RESET");
// Check to make sure that the intent is supported.
final PackageManager pm = context.getPackageManager();
final List<ResolveInfo> resolutions =
pm.queryIntentActivities(requestAccountConfirmation, 0);
if (resolutions != null && resolutions.size() > 0) {
final ResolveInfo resolution = pm.resolveActivity(requestAccountConfirmation, 0);
if (resolution != null
&& resolution.activityInfo != null
&& packageName.equals(resolution.activityInfo.packageName)) {
// Note that we need to check the packagename to make sure that an Activity resolver
// wasn't returned.
getActivity().startActivityForResult(
requestAccountConfirmation, CREDENTIAL_CONFIRM_REQUEST);
return true;