Commit 20198ebe authored by Brandon Wylie's avatar Brandon Wylie Committed by Commit Bot

Check that Chrome is Google signed before sending request to AGSA

Bug: 1053930
Change-Id: I0824edd19864686b0f9e48210dc61d8a821602ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2064788Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Brandon Wylie <wylieb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742820}
parent 25e4f2ea
......@@ -215,6 +215,8 @@ public class AssistantVoiceSearchService implements TemplateUrlService.TemplateU
return false;
}
// AGSA will throw an exception if Chrome isn't Google signed.
if (!mExternalAuthUtils.isChromeGoogleSigned()) return false;
if (!mExternalAuthUtils.isGoogleSigned(IntentHandler.PACKAGE_GSA)) return false;
return mMinMemoryMb <= availableMemoryMb && mMinAndroidSdkVersion <= Build.VERSION.SDK_INT
......
......@@ -69,6 +69,7 @@ public class AssistantVoiceSearchServiceUnitTest {
public void setUp() throws NameNotFoundException {
MockitoAnnotations.initMocks(this);
doReturn(true).when(mExternalAuthUtils).isChromeGoogleSigned();
doReturn(true).when(mExternalAuthUtils).isGoogleSigned(IntentHandler.PACKAGE_GSA);
mPackageInfo = new PackageInfo();
......@@ -99,6 +100,14 @@ public class AssistantVoiceSearchServiceUnitTest {
Assert.assertTrue(mAssistantVoiceSearchService.shouldRequestAssistantVoiceSearch());
}
@Test
@Feature("OmniboxAssistantVoiceSearch")
public void testStartVoiceRecognition_StartsAssistantVoiceSearch_ChromeNotSigned() {
doReturn(false).when(mExternalAuthUtils).isChromeGoogleSigned();
Assert.assertFalse(mAssistantVoiceSearchService.shouldRequestAssistantVoiceSearch());
}
@Test
@Feature("OmniboxAssistantVoiceSearch")
public void testStartVoiceRecognition_StartsAssistantVoiceSearch_AGSANotSigned() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment