ToolKitService代码中配置错误,修复后启动遇到Caused by: java.lang.SecurityException: Starting FGS
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by comparing the manifest service declaration with com.tencent.trtc.apiexample.ToolKitService, then inspect ToolKitService.onCreate at line 33 and the Android 14 foreground-service exception. Verify the corrected declaration and required permission handling on a target SDK 34 device; done means the service starts without the reported SecurityException.
Written by the indexing model from the issue text.
Description
ToolKitService默认配置是这样:
<service
android:name="com.tencent.liteav.utils.ToolKitService"
android:foregroundServiceType="mediaProjection"
android:enabled="true"
android:exported="false" />
这个配置和实际上ToolKitService所在路径不一样。
代码是com.tencent.trtc.apiexample.ToolKitService。
如果我修复这个路径,把target 设置34,跑在34设备上。就会遇到下面错误:
JavaExceptionHandler E Process: com.tencent.trtc.api_example, PID: 12687
java.lang.RuntimeException: Unable to create service com.tencent.trtc.apiexample.ToolKitService: java.lang.SecurityException: Starting FGS with type mediaProjection callerApp=ProcessRecord{3a0477f 12687:com.tencent.trtc.api_example/u0a374} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION] any of the permissions allOf=false [android.permission.CAPTURE_VIDEO_OUTPUT, android:project_media]
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4991)
at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:222)
at android.os.Looper.loop(Looper.java:314)
at android.app.ActivityThread.main(ActivityThread.java:8816)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1090)
Caused by: java.lang.SecurityException: Starting FGS with type mediaProjection callerApp=ProcessRecord{3a0477f 12687:com.tencent.trtc.api_example/u0a374} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION] any of the permissions allOf=false [android.permission.CAPTURE_VIDEO_OUTPUT, android:project_media]
at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
at android.os.Parcel.createException(Parcel.java:3041)
at android.os.Parcel.readException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:2966)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7310)
at android.app.Service.startForeground(Service.java:775)
at com.tencent.trtc.apiexample.ToolKitService.onCreate(ToolKitService.java:33)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4978)
at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:222)
at android.os.Looper.loop(Looper.java:314)
at android.app.ActivityThread.main(ActivityThread.java:8816)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1090)
- Dominant language
- Java
- Stars
- 60
- Forks
- 48
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Tencent-RTC/TRTC_Android
-
本地视频分享推流有视频画面,没声音 Open
Difficulty 4/5 3-5 days Newbie friendliness 20/100
Tencent-RTC/TRTC_Android#27 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Tencent-RTC/TRTC_Android#17 · 2 comments · 1 reaction ·
All issues in Tencent-RTC/TRTC_Android
Similar issues
-
Bug Java Platform: Java
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsentry/sentry-java#6138 · 1 comment ·
-
bug needs triage p2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 comment ·
-
[Studio][Bug] Bulk-deleting a full page of alert rules steps the page back while more rules remain Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/rocketmq-dashboard#4654 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100