CaptureModule: improve instant capture trigger

Add a check with isVoiceInteractionRoot() to check that we've actually
been launched via voice interaction and not a spoofed intent. Also move
the CAMERA_OPEN_ONLY check up as there's no point in having the check
inside, it just triggers the "Trigger instant capture!" log message
erroneously.

Issue: FP2A10-205
Test: run gts-dev -m GtsAssistantHostTestCases
Change-Id: I2d8d757a33fbbb6e529b530a1ff0661853839b53
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 7213e34..fdb7a12 100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -481,13 +481,12 @@
 
         // Check if we should take a snapshot without user interaction
         if (intentAction != null && intentAction.equals(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA) &&
-                intentCategories != null && intentCategories.contains(Intent.CATEGORY_VOICE)) {
+                intentCategories != null && intentCategories.contains(Intent.CATEGORY_VOICE) &&
+                activity.isVoiceInteractionRoot() &&
+                !intent.getBooleanExtra("com.google.assistant.extra.CAMERA_OPEN_ONLY", false)) {
             Log.i(TAG, "Trigger instant capture!");
 
-            if (!intent.getBooleanExtra("com.google.assistant.extra.CAMERA_OPEN_ONLY", false)) {
-                mInstantCaptureSnapShot = true;
-            }
-
+            mInstantCaptureSnapShot = true;
             mInstantCaptureDelay = intent.getIntExtra("android.intent.extra.TIMER_DURATION_SECONDS", 0);
         }