Merge "Fix the bug of not showing lock screen before entering Smart Lock page." into rvc-dev am: 7afb61e6dc am: b1895fc072 am: 69eaf216eb am: dc3ad75817

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/11949297

Change-Id: Ifcdac2031c098926a3f0f3dd11aef20ca331e6f6
This commit is contained in:
Stanley Wang
2020-06-22 11:14:51 +00:00
committed by Automerger Merge Worker
2 changed files with 30 additions and 7 deletions

View File

@@ -16,10 +16,8 @@
package com.android.settings.security.trustagent;
import static com.android.settings.security.trustagent.TrustAgentListPreferenceController
.PREF_KEY_SECURITY_CATEGORY;
import static com.android.settings.security.trustagent.TrustAgentListPreferenceController
.PREF_KEY_TRUST_AGENT;
import static com.android.settings.security.trustagent.TrustAgentListPreferenceController.PREF_KEY_SECURITY_CATEGORY;
import static com.android.settings.security.trustagent.TrustAgentListPreferenceController.PREF_KEY_TRUST_AGENT;
import static com.google.common.truth.Truth.assertThat;
@@ -172,6 +170,26 @@ public class TrustAgentListPreferenceControllerTest {
verify(mCategory, never()).addPreference(any(Preference.class));
}
@Test
public void onResume_controllerShouldHasKey() {
final List<TrustAgentManager.TrustAgentComponentInfo> agents = new ArrayList<>();
final TrustAgentManager.TrustAgentComponentInfo agent =
mock(TrustAgentManager.TrustAgentComponentInfo.class);
agent.title = "Test_title";
agent.summary = "test summary";
agent.componentName = new ComponentName("pkg", "agent");
agent.admin = null;
agents.add(agent);
when(mTrustAgentManager.getActiveTrustAgents(mActivity, mLockPatternUtils))
.thenReturn(agents);
final String key = PREF_KEY_TRUST_AGENT + 0;
mController.displayPreference(mScreen);
mController.onResume();
assertThat(mController.mTrustAgentsKeyList).containsExactly(key);
}
@Test
public void updateDynamicRawDataToIndex_shouldIndexAgents() {
final List<TrustAgentManager.TrustAgentComponentInfo> agents = new ArrayList<>();
@@ -190,5 +208,4 @@ public class TrustAgentListPreferenceControllerTest {
assertThat(indexRaws).hasSize(1);
}
}