avalancha
avalancha

Reputation: 1774

"SecurityException: Permission Denial: starting Intent" in Android Auto

When I request permissions in Android Auto via the CarContext according to the docs, the app crashes when

Abbreviated Stack Trace:

FATAL EXCEPTION: main
    Process: PID: 31279
    java.lang.RuntimeException: java.lang.SecurityException: Permission Denial: starting Intent { act=androidx.car.app.action.REQUEST_PERMISSIONS flg=0x10000000 cmp=com.kurviger.app.debug/androidx.car.app.CarAppPermissionActivity (has extras) } from ProcessRecord{cee9b01 31279:com.kurviger.app.debug/u0a1092} (pid=31279, uid=11092) with launchDisplayId=64
    at androidx.car.app.utils.RemoteUtils.lambda$dispatchCallFromHost$0(RemoteUtils.java:153)
    [...]
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:871)
 Caused by: java.lang.SecurityException: Permission Denial: starting Intent { act=androidx.car.app.action.REQUEST_PERMISSIONS flg=0x10000000 cmp=com.kurviger.app.debug/androidx.car.app.CarAppPermissionActivity (has extras) } from ProcessRecord{cee9b01 31279:com.kurviger.app.debug/u0a1092} (pid=31279, uid=11092) with launchDisplayId=64
    [...]
    at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:2051)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:2002)
    at android.app.ContextImpl.startActivity(ContextImpl.java:1161)
    at android.app.ContextImpl.startActivity(ContextImpl.java:1132)
    at android.content.ContextWrapper.startActivity(ContextWrapper.java:438)
    at androidx.car.app.CarContext.requestPermissions(CarContext.java:620)
    at androidx.car.app.CarContext.requestPermissions(CarContext.java:553)

Important, this happens regardless of whether you have increased your targetSDK to 35 or not! There is no notion of this in the Behaviour Changes docs

Upvotes: 3

Views: 123

Answers (1)

avalancha
avalancha

Reputation: 1774

Even though I currently see no hint to this in the Changelog, the solution seems to be to update your androidx.car.app:app SDK Version to 1.7.0-beta

There were likely some changes in the Manifest or the CarContext, to fix the Intent handling, which has been changed (allegedly only for apps targeting Android 15) as described here

Upvotes: 3

Related Questions