以前,使用以下组件之一的意图会将我带到华为的系统设置中,以更改应用程序的自动启动行为。
ComponentName(
"com.huawei.systemmanager",
"com.huawei.systemmanager.startupmgr.ui.StartupNormalAppListActivity"
),
ComponentName(
"com.huawei.systemmanager",
"com.huawei.systemmanager.appcontrol.activity.StartupAppControlActivity"
)
堆栈跟踪:
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.huawei.systemmanager/.startupmgr.ui.StartupNormalAppListActivity } from ProcessRecord{34a529e 19272:com.mk...test/u0a733} (pid=19272, uid=10733) requires com.huawei.permission.external_app_settings.USE_COMPONENT
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.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:3888)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1738)
at androidx.test.runner.MonitoringInstrumentation.execStartActivity(MonitoringInstrumentation.java:545)
at android.app.ContextImpl.startActivity(ContextImpl.java:1049)
at android.app.ContextImpl.startActivity(ContextImpl.java:1005)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2258)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1194)
at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:904)
at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:652)
at com.android.server.wm.HwActivityStarter.startActivity(HwActivityStarter.java:292)
at com.android.server.wm.ActivityStarter.startActivityMayWait(ActivityStarter.java:1647)
堆栈跟踪中提到的权限在我的清单文件中声明。
<uses-permission android:name="com.huawei.permission.external_app_settings.USE_COMPONENT"/>
我记得以前一定可以用,但现在我的华为P30 Pro好像有了安全更新。
现在应该怎么做?为什么它会抱怨缺少权限,虽然已经声明了呢?