java.lang.SecurityException: Specified package "package name" under uid -1 but it is not in Android 13
Asked Answered
H

0

18

I'm using Settings.ACTION_APPLICATION_DETAILS_SETTINGS in order to request when the user does not grant permission in purpose.

Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getActivity().getPackageName(), null);
intent.setData(uri);
getActivity().startActivity(intent);

The code works well only under android 13. If i run this code in Android 13, It happens an exception.

 "Bad call made by uid 1000. Package "package name" does not belong to uid -1.
noteOperation
java.lang.SecurityException: Specified package "package name" under uid -1 but it is not
at com.android.server.appop.AppOpsService.verifyAndGetBypass(AppOpsService.java:4858)
at com.android.server.appop.AppOpsService.noteOperationUnchecked(AppOpsService.java:3586)
at com.android.server.appop.AppOpsService.noteOperationImpl(AppOpsService.java:3574)
at com.android.server.appop.AppOpsService.-$$Nest$mnoteOperationImpl(Unknown Source:0)
at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.lambda$noteOperation$4(AppOpsService.java:7928)
at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.$r8$lambda$oOwUoG55BBmJ6yiwhp3OAq3tQ30(Unknown Source:0)
at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher$$ExternalSyntheticLambda4.apply(Unknown Source:32)
at com.android.server.policy.AppOpsPolicy.noteOperation(AppOpsPolicy.java:225)
at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.noteOperation(AppOpsService.java:7926)
at com.android.server.appop.AppOpsService.noteOperation(AppOpsService.java:3558)
at com.android.internal.app.IAppOpsService$Stub.onTransact(IAppOpsService.java:486)
at android.os.Binder.execTransactInternal(Binder.java:1316)
at android.os.Binder.execTransact(Binder.java:1280)"

I already set android:exported="true" in AndroidManifest.xml. I don't know why the error happens.
I hope someone tells me about the exception.

Hanks answered 23/8, 2023 at 6:14 Comment(4)
Meet the same error. Have you found a root cause?Carminacarminative
Not yet :( Someone posted this issue on Google Issue tracker. but they ignored it..Hanks
I got the same error. It seems that might have happened for security reasons that may not compile with android 13 or above.Faubourg
@Hanks Where's the link to the issue tracker post?Gracye

© 2022 - 2024 — McMap. All rights reserved.