错误现场
- 起因:第三方 app 调用原生TvSettings 的 com.android.tv.settings.device.storage.ResetActivity ,发现无法启动,查看Log有报错。
- 原因:未设置 android:exported=“true”
- 错误:ActivityTaskManager: Permission Denial: starting Intent { flg=0x10000000 pkg=com.android.tv.settings cmp=com.android.tv.settings/.device.storage.ResetActivity } from ProcessRecord{4b7ab0a 4789:com.qcode.projector.launcher/u0a29} (pid=4789, uid=10029) not exported from uid 1000
06-12 18:31:36.057 4103 4251 D TvWindowManager: key event key = KEYCODE_DPAD_CENTER
06-12 18:31:36.060 4664 4664 D LatinIME: setFields fail, break
06-12 18:31:36.060 4789 4789 D MainPageProxy: dispatchKeyEvent:KeyEvent {
action=ACTION_DOWN, keyCode=KEYCODE_DPAD_CENTER, scanCode=23, metaState=0, flags=0x8, repeatCount=0, eventTime=300313, downTime=300313, deviceId=7, source=0x301, displayId=-1 }
06-12 18:31:36.060 4789 4789 D JSViewParent: dispatchKeyEvent:KeyEvent {
action=ACTION_DOWN, keyCode=KEYCODE_DPAD_CENTER, scanCode=23, metaState=0, flags=0x8, repeatCount=0, eventTime=300313, downTime=300313, deviceId=7, source=0x301, displayId=-1 }
06-12 18:31:36.061 4789 4789 D JSViewParent: current focus:com.tvcode.js_view_app.view.JSViewItem{
db98d3a V.E...... ........ 0,0-1920,1080} top:com.tvcode.js_view_app.view.JSViewItem{
db98d3a V.E...... ........ 0,0-1920,1080}
06-12 18:31:36.061 4789 4789 V JsViewCore: JsViewCore.dispatchKeyEvent() keyEvent=KeyEvent {
action=ACTION_DOWN, keyCode=KEYCODE_DPAD_CENTER, scanCode=23, metaState=0, flags=0x8, repeatCount=0, eventTime=300313, downTime=300313, deviceId=7, source=0x301, displayId=-1 }
06-12 18:31:36.061 4789 4789 I JsKeyCode: JsView dispatch key consumed true, cost 0ms.
06-12 18:31:36.061 4789 4789 V JsViewCore: JsViewCore.dispatchKeyEvent() js consumed=true
06-12 18:31:36.063 4789 5207 D JSIIntfManager: nativeCallSyncApi:func_name=jLauncherBridge_getSystemSoundEffectEnabled cost=0 ms
06-12 18:31:36.063 4789 4789 D JsPromiseManager: Send promise ack={
"status":1,"id":289,"value":"{\"isEnabled\":false}"}
06-12 18:31:36.064 4789 5207 D JSIIntfManager: nativeCallSyncApi:func_name=jLauncherBridge_getQCastHomepageVersion cost=0 ms
06-12 18:31:36.065 4789 5207 D JSIIntfManager: nativeCallSyncApi:func_name=jLauncherBridge_getHomepage cost=0 ms
06-12 18:31:36.066 4789 5207 D JSIIntfManager: nativeCallSyncApi:func_name=jLauncherBridge_getLocalData cost=0 ms
06-12 18:31:36.067 4789 5207 I JSIConsole: log: DataCollectUtil pageClick , [object Object]
06-12 18:31:36.068 4789 5207 D JLauncherBridge: sendDataCollectLog page_click {
"page_type":"subpage","page_version":"257800","page_title":"璁剧疆","page_vendor":"46","page_area":"璁剧疆","xaxis":"456","yaxis":"0","item_title":"鍑哄巶澶嶄綅","item_id":"4","material_id":"","material_title":"","click_type":"remote","is_rec":"","rec_args":""}
06-12 18:31:36.070 4789 5207 D QcDataCollector: pageClick
06-12 18:31:36.071 4789 5207 D JSIIntfManager: nativeCallSyncApi:func_name=jLauncherBridge_sendDataCollectLog cost=2 ms
06-12 18:31:36.071 4789 6055 D LogBuilder: send http log: https://qc-user-behavior.cn-hangzhou.log.aliyuncs.com/logstores/ott_event/track?APIVersion=0.6.0&__topic__=2024-06-12&uuid=1eb78f1bf15565e4b445c224e73548e6&bi_version=76&reporter=projector&event=page_click&page_type=subpage&page_version=257800&page_title=%E8%AE%BE%E7%BD%AE&page_vendor=46&page_area=%E8%AE%BE%E7%BD%AE&xaxis=456&yaxis=0&item_title=%E5%87%BA%E5%8E%82%E5%A4%8D%E4%BD%8D&item_id=4&click_type=remote
06-12 18:31:36.071 4789 5207 I JSIConsole: log: OnClick in
06-12 18:31:36.078 4789 6055 E LogBuilder: Failed to send error log.
06-12 18:31:36.082 4789 5207 I JSIConsole: log: matrix_item:{
"id":6,"homepageMinVer":"245300","content":{
"value":"{\"packageName\":\"com.android.tv.settings\",\"activity\":\"com.android.tv.settings.device.storage.ResetActivity\",\"param\":[]}","type":"NATIVE_APP"},"favoriteImgUrl":"","materialId":"19569","name":"鍑哄巶澶嶄綅","showCond":[{
"lang_eng":"yes"}],"showTitle":"no","adList":["./images/homepage/20221013/05b3c1bb7c37a060b6c78000f2bddae2.png"],"contents":"ConfigNavConList绯荤粺璁剧疆_SubScene","editableItem":null,"triggerSource":"setting|setting|鍑哄巶澶嶄綅","content_index":4}
06-12 18:31:36.084 4789 5207 D JSIIntfManager: nativeCallSyncApi:func_name=jLauncherBridge_getStringFromFile cost=1 ms
06-12 18:31:36.086 4789 5207 I JSIConsole: log: startWithParams info:, {
"packageName":"com.android.tv.settings","params":"{\"packageName\":\"com.android.tv.settings\",\"activity\":\"com.android.tv.settings.device.storage.ResetActivity\",\"param\":[]}","triggerSource":"setting|setting|鍑哄巶澶嶄綅"}
06-12 18:31:36.058 4103 4250 D GpioService: mFlickerEnable = true
06-12 18:31:36.095 4103 4820 I ActivityTaskManager: START u0 {
flg=0x10000000 pkg=com.android.tv.settings cmp=com.android.tv.settings/.device.storage.ResetActivity} from uid 10029
06-12 18:31:36.096 4103 4820 W ActivityTaskManager: Permission Denial: starting Intent {
flg=0x10000000 pkg=com.android.tv.settings cmp=com.android.tv.settings/.device.storage.ResetActivity } from ProcessRecord{
4b7ab0a 4789:com.qcode.projector.launcher/u0a29} (pid=4789, uid=10029) not exported from uid 1000
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: Invoke failed e=
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: java.lang.reflect.InvocationTargetException
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at java.lang.reflect.Method.invoke(Native Method)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.qcode.enhance.JavaInterfaces.b.a(:50)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.qcode.enhance.JavaInterfaces.a.a(:32)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.qcode.enhance.JavaInterfaces.JSIIntfManager.nativeCallSyncApi(:2)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at java.lang.reflect.Method.invoke(Native Method)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at jsv.obs.m1.b(:16)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at jsv.obs.m1.a(:29)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.qcode.jsi.AbstractLayer.AbstractLayer$Extra.PlatformDispatch(:1)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.qcode.jsi.AbstractLayer.AbstractLayer$JSCore.NativeEnterLoop(Native Method)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at jsv.obs.n1.b(:2)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.qcode.enhance.q$b.run(:6)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.os.Handler.handleCallback(Handler.java:938)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.os.Handler.dispatchMessage(Handler.java:99)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.os.Looper.loop(Looper.java:223)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.os.HandlerThread.run(HandlerThread.java:67)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: Caused by: java.lang.SecurityException: Permission Denial: starting Intent {
flg=0x10000000 pkg=com.android.tv.settings cmp=com.android.tv.settings/.device.storage.ResetActivity } from ProcessRecord{
4b7ab0a 4789:com.qcode.projector.launcher/u0a29} (pid=4789, uid=10029) not exported from uid 1000
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.os.Parcel.createExceptionOrNull(Parcel.java:2386)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.os.Parcel.createException(Parcel.java:2370)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.os.Parcel.readException(Parcel.java:2353)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.os.Parcel.readException(Parcel.java:2295)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:3696)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1723)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.app.Activity.startActivityForResult(Activity.java:5335)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.app.Activity.startActivityForResult(Activity.java:5293)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.app.Activity.startActivity(Activity.java:5679)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at android.app.Activity.startActivity(Activity.java:5632)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.tvcode.js_view_app.jContentShellJBridge.startNativeApp(jContentShellJBridge.java:316)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: ... 15 more
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: Caused by: android.os.RemoteException: Remote stack trace:
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1032)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:999)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:669)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1100)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase: at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1072)
06-12 18:31:36.098 4789 5207 E JavaApiManagerBase:
06-12 18:31:36.099 4789 5207 D JSIIntfManager: nativeCallSyncApi:func_name=jContentShellJBridge_startNativeApp cost=6 ms
06-12 18:31:36.100 4789 5207 E JSIConsole: error: Error: ERROR: SyncDebug invoke failed func=jContentShellJBridge_startNativeApp status=Invoke function failed.
06-12 18:31:36.100 4789 5207 E JSI : Isolate throw exception in static int jsi::JSIExtraManager::ProcessCallback(std::shared_ptr<JSIHandleManager::ContextHandle>, std::shared_ptr<JSIHandleManager::FunctionTask>)
06-12 18:31:36.100 4789 5207 W JSI : V8Throw: TypeError: Failed to exe callback.
06-12 18:31:36.100 4789 5207 W JSI : {
}
06-12 18:31:36.371 4103 4251 D TvWindowManager: key event key = KEYCODE_DPAD_CENTER
解决
<activity android:configChanges="keyboard|keyboardHidden|navigation"
android:exported="true" //添加这句
android:excludeFromRecents="true"
android:name=".device.storage.ResetActivity"
android:theme="@style/Theme.Settings.Transparent"/>