错误记录:调用原生TvSettings 的 com.android.tv.settings.device.storage.ResetActivity 无法启动

简介: 本文记录了一个Android TV设置中由于未设置`android:exported="true"`导致`com.android.tv.settings.device.storage.ResetActivity`无法被第三方app启动的错误,并通过添加该属性成功解决了问题。

在这里插入图片描述

错误现场

  • 起因:第三方 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"/>
相关文章
|
6月前
|
数据采集 小程序 数据可视化
智慧校园电子班牌管理系统源码 Java Android原生
家长通过家长小程序端随时了解孩子在校的情况,实时接收学生的出勤情况,学生到校、离校时间。随时了解学生在校的表现、学生成绩排名,及时与教师沟通,关注孩子的健康成长。
74 0
智慧校园电子班牌管理系统源码 Java Android原生
|
安全 Android开发 开发者
Android 原生 Picture in Picture 画中画功能避坑指南(下)
Android 原生 Picture in Picture 画中画功能避坑指南(下)
273 0
|
JavaScript Java Android开发
Cocos Creator Android 平台 Facebook 原生登录(二)
Cocos Creator Android 平台 Facebook 原生登录
208 0
|
开发工具 Android开发 数据安全/隐私保护
Cocos Creator Android 平台 Facebook 原生登录(一)
Cocos Creator Android 平台 Facebook 原生登录
508 0
|
6月前
|
API 开发工具 Android开发
调用Android原生@SystemApi、@Hide方法
调用Android原生@SystemApi、@Hide方法
541 1
|
6月前
|
数据采集 小程序 数据可视化
Java Android原生智慧校园管理系统源码
对班牌的考试模式、班牌模式上课模式进行设置及管理,设置成功后,班牌端将同步应用。
65 0
|
前端开发 Android开发
前端项目实战壹-安卓4.4/6.0无法安装非原生项目无法渲染样式
前端项目实战壹-安卓4.4/6.0无法安装非原生项目无法渲染样式
62 0
|
JavaScript 前端开发 Java
uniapp Android 原生插件开发(Module 扩展为例·2022)(一)
uniapp Android 原生插件开发(Module 扩展为例·2022)
1488 0
uniapp Android 原生插件开发(Module 扩展为例·2022)(一)
|
6月前
|
存储 移动开发 JavaScript
【原生】sd.js帮助您简化繁重的获取数据、存储数据(CRUD)骚操作(吐槽~在安卓9.0以下或者IOS10.X以下手机端H5页面不支持,在这两种情况下的系统只能使用ajax或者原生js请求后台数据)
【原生】sd.js帮助您简化繁重的获取数据、存储数据(CRUD)骚操作(吐槽~在安卓9.0以下或者IOS10.X以下手机端H5页面不支持,在这两种情况下的系统只能使用ajax或者原生js请求后台数据)
|
API Android开发 开发者
Android 原生 Picture in Picture 画中画功能避坑指南(上)
Android 原生 Picture in Picture 画中画功能避坑指南(上)
314 0