问题描述
AOSP camera 无法响应Intent,参考log:
12-12 11:44:59.390 13034 13034 I MainInteractionSession: starting_voiceactivity: Intent { act=android.media.action.STILL_IMAGE_CAMERA flg=0x10018000 (has extras) }
12-12 11:44:59.392 1163 7135 I ActivityTaskManager: START u0 {act=android.media.action.STILL_IMAGE_CAMERA cat=[android.intent.category.VOICE] flg=0x18018000 (has extras)} from uid 10185
12-12 11:44:59.393 13034 13034 D AndroidRuntime: Shutting down VM
--------- beginning of crash
12-12 11:44:59.394 13034 13034 E AndroidRuntime: FATAL EXCEPTION: main
12-12 11:44:59.394 13034 13034 E AndroidRuntime: Process: android.voicesettings.service:session, PID: 13034
12-12 11:44:59.394 13034 13034 E AndroidRuntime: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.STILL_IMAGE_CAMERA flg=0x10018000 (has extras) }
解决方案
需要在AOSP的camera app的intent-filter中加上<category android:name="android.intent.category.VOICE" />。
但google回复不会再维护AOSP camera,所以需要客户自行修改使用的camera app。
可以参考mtk camera的写法,在action android:name="android.media.action.STILL_IMAGE_CAMERA" 对应的intent-filter中加上<category android:name="android.intent.category.VOICE" />。
Example:
<intent-filter>
<action android:name="android.media.action.STILL_IMAGE_CAMERA" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.VOICE" />
</intent-filter>