GTS fail
run gts -m GtsAssistantHostTestCases
项
<Test result="fail" name="testAssistantTakePhotoWithVoiceInteraction">
<Test result="fail" name="testAssistantTakeSelfieWithVoiceInteraction">
<Test result="fail" name="testAssistantOpenRearCameraWithoutVoiceInteraction">
<Test result="fail" name="testAssistantOpenFrontCameraWithoutVoiceInteraction">
首先看 fail的log
抽取 action 和 intent 参数
16823 16823 I MainInteractionSession: starting_voiceactivity: Intent { act=android.media.action.STILL_IMAGE_CAMERA flg=0x10018000 (has extras) }
1379 2616 I ActivityTaskManager: START u0 {act=android.media.action.STILL_IMAGE_CAMERA typ=null flg=0x18018000 cmp=ComponentInfo{com.sec.android.app.camera/com.sec.android.app.camera.Camera}} from uid 10216
1379 2616 D ApplicationPolicy: getApplicationStateEnabled : pkg = com.sec.android.app.camera userId : 0
------action: android.media.action.STILL_IMAGE_CAMERA
SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{com.google.assistant.extra.USE_FRONT_CAMERA=true, android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, android.intent.extra.USE_FRONT_CAMERA=true, NoUiQuery=true}]
22335 22335 I MainInteractionSession: in onTaskFinished: testcasetype = TAKE_SELFIE, intent: Intent { act=android.media.action.STILL_IMAGE_CAMERA cat=[android.intent.category.VOICE] flg=0x18018000 cmp=com.sec.android.app.camera/.Camera (has extras) }extras: (com.google.assistant.extra.USE_FRONT_CAMERA = true), (android.intent.extra.REFERRER_NAME = android-app://com.google.android.googlequicksearchbox/https/www.google.com), (isVoiceQuery = true), (android.intent.extra.USE_FRONT_CAMERA = true), (NoUiQuery = true),
06-28 16:14:07.210 22335 22335 I MainInteractionSession: sending_broadcast: Bundle = extras: (com.google.assistant.extra.USE_FRONT_CAMERA = true), (Testcase_type = TAKE_SELFIE), (android.intent.extra.REFERRER_NAME = android-app://com.google.android.googlequicksearchbox/https/www.google.com), (isVoiceQuery = true), (android.intent.extra.USE_FRONT_CAMERA = true), (NoUiQuery = true), , intent = Intent { act=android.intent.action.FROM_UTIL_CTS_TEST_TAKE_SELFIE (has extras) }
6885 16878 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, NoUiQuery=true}]
17540 17600 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{com.google.assistant.extra.USE_FRONT_CAMERA=true, android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, android.intent.extra.USE_FRONT_CAMERA=true, NoUiQuery=true}]
18806 18862 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{com.google.assistant.extra.USE_FRONT_CAMERA=true, com.google.assistant.extra.CAMERA_OPEN_ONLY=true, android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, android.intent.extra.USE_FRONT_CAMERA=true, android.intent.extra.CAMERA_OPEN_ONLY=true, NoUiQuery=true}]
19454 19515 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{com.google.assistant.extra.CAMERA_OPEN_ONLY=true, android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, android.intent.extra.CAMERA_OPEN_ONLY=true, NoUiQuery=true}]
20049 20112 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, NoUiQuery=true}]
20694 20750 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{com.google.assistant.extra.CAMERA_OPEN_ONLY=true, android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, android.intent.extra.CAMERA_OPEN_ONLY=true, NoUiQuery=true}]
21327 21388 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{com.google.assistant.extra.USE_FRONT_CAMERA=true, com.google.assistant.extra.CAMERA_OPEN_ONLY=true, android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, android.intent.extra.USE_FRONT_CAMERA=true, android.intent.extra.CAMERA_OPEN_ONLY=true, NoUiQuery=true}]
22368 22428 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, NoUiQuery=true}]
24447 24504 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{com.google.assistant.extra.USE_FRONT_CAMERA=true, com.google.assistant.extra.CAMERA_OPEN_ONLY=true, android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, android.intent.extra.USE_FRONT_CAMERA=true, android.intent.extra.CAMERA_OPEN_ONLY=true, NoUiQuery=true}]
25097 25159 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{com.google.assistant.extra.CAMERA_OPEN_ONLY=true, android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, android.intent.extra.CAMERA_OPEN_ONLY=true, NoUiQuery=true}]
25698 25758 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, NoUiQuery=true}]
27032 27094 D SnapCam_CaptureModule: initModeByIntent myExtras Bundle[{com.google.assistant.extra.USE_FRONT_CAMERA=true, com.google.assistant.extra.CAMERA_OPEN_ONLY=true, android.intent.extra.REFERRER_NAME=android-app://com.google.android.googlequicksearchbox/https/www.google.com, isVoiceQuery=true, android.intent.extra.USE_FRONT_CAMERA=true, android.intent.extra.CAMERA_OPEN_ONLY=true, NoUiQuery=true}]
adb命令模拟:
1.后摄自动拍照
adb shell am start -a android.media.action.STILL_IMAGE_CAMERA -c android.intent.category.VOICE --ez isVoiceQuery true --ez NoUiQuery true --es android.intent.extra.REFERRER_NAME android-app://com.google.android.googlequicksearchbox/https/www.google.com --activity-clear-task
2.前摄自动拍照
adb shell am start -a android.media.action.STILL_IMAGE_CAMERA -c android.intent.category.VOICE --ez com.google.assistant.extra.USE_FRONT_CAMERA true --ez android.intent.extra.USE_FRONT_CAMERA true --ez isVoiceQuery true --ez NoUiQuery true --es android.intent.extra.REFERRER_NAME android-app://com.google.android.googlequicksearchbox/https/www.google.com --activity-clear-task
修改完成后,模拟命令测试
public boolean needAotuCaptureGoogleGTS = false;
f(ACTION_STILL_IMAGE_CAMERA.equals(getIntent().getAction())) {
boolean mGoogleAssistantVOICE = getIntent().hasCategory("android.intent.category.VOICE");
boolean mGoogleAssistantOpenOnly = getIntent().getBooleanExtra("com.google.assistant.extra.CAMERA_OPEN_ONLY", false);
int mGoogleAssistantTimer = getIntent().getIntExtra("com.google.assistant.extra.TIMER_DURATION_SECONDS", 0);
boolean mGoogleAssistantFrontCamera = getIntent().getBooleanExtra("com.google.assistant.extra.USE_FRONT_CAMERA", false);
String mGoogleAssistantMode = getIntent().getStringExtra("com.google.assistant.extra.CAMERA_MODE");
Log.d(TAG, "intent google assistant VOICE " + mGoogleAssistantVOICE + " OPEN_ONLY " + mGoogleAssistantOpenOnly + " Timer " +
mGoogleAssistantTimer + " FrontCamera " + mGoogleAssistantFrontCamera + " Mode " + mGoogleAssistantMode);
needAotuCaptureGoogleGTS = mGoogleAssistantVOICE && !mGoogleAssistantOpenOnly;
Log.d(TAG, "needAotuCaptureGoogleGTS = " + needAotuCaptureGoogleGTS);
}
// GTS test front
if(mGoogleAssistantFrontCamera){
settingsManager.setValue(SettingsManager.KEY_CAMERA_ID,"1");
} else {
settingsManager.setValue(SettingsManager.KEY_CAMERA_ID,"0");
}
private CameraCaptureSession.CaptureCallback mCaptureCallback
= new CameraCaptureSession.CaptureCallback() {
@Override
public void onCaptureCompleted(CameraCaptureSession session,
CaptureRequest request,
TotalCaptureResult result) {
//if gts test capture
if (mActivity.isNeedAotuCaptureGoogleGTS()) {
mHandler.sendEmptyMessage(MSG_TAKE_PICTURE);
}
}