SecurityException,FOREGROUND_SERVICE?

coding404
  • 1
新手上路,请多包涵

在华为的平板上开不了终端,日志如下:

BOARD=MRX-W09
CPU_ABI2=armeabi
HOST=cn-central-1c-b483ea9d61577559675903-1287160553-47hmb
SUPPORTED_64_BIT_ABIS=[Ljava.lang.String;@4f1be6a
CPU_ABI=armeabi-v7a
PERMISSIONS_REVIEW_REQUIRED=true
DISPLAY=MRX-W09 10.0.1.135(C00E120R1P120)
SUPPORTED_ABIS=[Ljava.lang.String;@2ee8f5b
FINGERPRINTEX=HUAWEI/MRX-W09/HWMRX:10/HUAWEIMRX-W09/10.0.1.135C00:user/release-keys
FINGERPRINT=HUAWEI/MRX-W09/HWMRX:10/HUAWEIMRX-W09/10.0.1.135C00:user/release-keys
PRODUCT=MRX-W09
ID=HUAWEIMRX-W09
HWFINGERPRINT=///MRX-LGRP3-CHN 10.0.1.135/MRX-W09-CUST 10.0.1.120(C00)/MRX-W09-PRELOAD 10.0.1.120(C00R1)//
TYPE=user
SERIAL=unknown
DEVICE=HWMRX
MODEL=MRX-W09
MANUFACTURER=HUAWEI
USER=test
BRAND=HUAWEI
SUPPORTED_32_BIT_ABIS=[Ljava.lang.String;@3d1455
HARDWARE=kirin990
IS_DEBUGGABLE=false
BOOTLOADER=unknown
RADIO=unknown
UNKNOWN=unknown
IS_EMULATOR=false
TAGS=release-keys
java.lang.RuntimeException: Unable to start service org.qpython.qpy.console.TermService@534a974 with Intent { cmp=com.hipipal.qpyplus/org.qpython.qpy.console.TermService }: java.lang.SecurityException: Permission Denial: startForeground from pid=21067, uid=10144 requires android.permission.FOREGROUND_SERVICE

at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4697)
at android.app.ActivityThread.access$2900(ActivityThread.java:298)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:22¡£74)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8201)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

Caused by: java.lang.SecurityException: Permission Denial: startForeground from pid=21067, uid=10144 requires android.permission.FOREGROUND_SERVICE

at android.os.Parcel.createException(Parcel.java:2071)
at android.os.Parcel.readException(Parcel.java:2039)
at android.os.Parcel.readException(Parcel.java:1987)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6155)
at android.app.Service.startForeground(Service.java:713)
at org.qpython.qpy.console.TermService.onStartCommand(TermService.java:101)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4677)
... 8 more

Caused by: android.os.RemoteException: Remote stack trace:

at com.android.server.am.ActivityManagerService.enforcePermission(ActivityManagerService.java:6319)
at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:1343)
at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:995)
at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:14768)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2795)

java.lang.SecurityException: Permission Denial: startForeground from pid=21067, uid=10144 requires android.permission.FOREGROUND_SERVICE

at android.os.Parcel.createException(Parcel.java:2071)
at android.os.Parcel.readException(Parcel.java:2039)
at android.os.Parcel.readException(Parcel.java:1987)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6155)
at android.app.Service.startForeground(Service.java:713)
at org.qpython.qpy.console.TermService.onStartCommand(TermService.java:101)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4677)
at android.app.ActivityThread.access$2900(ActivityThread.java:298)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2274)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8201)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

Caused by: android.os.RemoteException: Remote stack trace:

at com.android.server.am.ActivityManagerService.enforcePermission(ActivityManagerService.java:6319)
at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:1343)
at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:995)
at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:14768)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2795)

android.os.RemoteException: Remote stack trace:

at com.android.server.am.ActivityManagerService.enforcePermission(ActivityManagerService.java:6319)
at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:1343)
at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:995)
at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:14768)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2795)
回复
阅读 1.5k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏