Any one have a suggestion how to solve this error ?
I am trying to run lock task with intent getLaunchIntentForPackage but I have no idea why this error is coming and which type of permission it wants to run this task.
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.example.videoplayer cmp=com.example.videoplayer/.MainActivity } from ProcessRecord{fd194a9 7523:com.example.lock/u0a190} (pid=7523, uid=10190) with lockTaskMode=true
at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
at android.os.Parcel.createException(Parcel.java:2409)
at android.os.Parcel.readException(Parcel.java:2392)
at android.os.Parcel.readException(Parcel.java:2334)
at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:2326)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1758)
at android.app.Activity.startActivityForResult(Activity.java:5407)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:597)
at android.app.Activity.startActivity(Activity.java:5747)
at com.example.lock.MainActivity.launchApp(MainActivity.kt:110)
at com.example.lock.MainActivity.onCreate$lambda-0(MainActivity.kt:62)
at com.example.lock.MainActivity.$r8$lambda$yGvyKllS4GN5cYzDCcbSf8EdXb0(Unknown Source:0)
at com.example.lock.MainActivity$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
at android.view.View.performClick(View.java:7455)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1194)
at android.view.View.performClickInternal(View.java:7432)
at android.view.View.access$3700(View.java:835)
at android.view.View$PerformClick.run(View.java:28810)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7842)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.wm.SafeActivityOptions.checkPermissions(SafeActivityOptions.java:283)
at com.android.server.wm.SafeActivityOptions.getOptions(SafeActivityOptions.java:155)
at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:1006)
at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:670)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1223)
I'm currently running into the same error. The only thing I can hand to you is that it can be solved by using the DevicePolicyManager.setLockTaskPackages as stated on the android site: https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode#allowlist_apps
Related
facebookincubator/Battery-Metrics repo's getSnapshot method in class SystemMetricsCollector is crashing because of java.lang.SecurityException: Calling identity is not authorized on android 13. It was working on android 12 and on versions before. Logs for the crash are:
java.lang.RuntimeException: Unable to start activity ComponentInfo{AppName/com.AppName.ux.activity.MainActivity}: java.lang.SecurityException: Calling identity is not authorized at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3686) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3823) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2306) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7892) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) Caused by: java.lang.SecurityException: Calling identity is not authorized at android.os.Parcel.createExceptionOrNull(Parcel.java:3011) at android.os.Parcel.createException(Parcel.java:2995) at android.os.Parcel.readException(Parcel.java:2978) at android.os.Parcel.readException(Parcel.java:2920) at android.net.INetworkStatsService$Stub$Proxy.openSessionForUsageStats(INetworkStatsService.java:469) at android.app.usage.NetworkStats.<init>(NetworkStats.java:111) at android.app.usage.NetworkStatsManager.querySummary(NetworkStatsManager.java:424) at android.app.usage.NetworkStatsManager.querySummary(NetworkStatsManager.java:397) at com.facebook.battery.metrics.network.NetworkStatsManagerBytesCollector.getBytesForType(NetworkStatsManagerBytesCollector.java:51) at com.facebook.battery.metrics.network.NetworkStatsManagerBytesCollector.getTotalBytes(NetworkStatsManagerBytesCollector.java:38) at com.facebook.battery.metrics.network.NetworkMetricsCollector.getSnapshot(NetworkMetricsCollector.java:53) at com.facebook.battery.metrics.network.NetworkMetricsCollector.getSnapshot(NetworkMetricsCollector.java:33) at com.facebook.battery.metrics.composite.CompositeMetricsCollector.getSnapshot(CompositeMetricsCollector.java:99) at com.AppName.features.appsetup.ux.workflow.tasks.LaunchScreenTask.process(LaunchScreenTask.java:66) at com.AppName.features.appsetup.ux.workflow.WorkflowExecutor.execute(WorkflowExecutor.java:84) at com.AppName.ux.activity.MainActivity.startWorkflow(MainActivity.java:414) at com.AppName.ux.activity.MainActivity.workflowDelegation(MainActivity.java:1134) at com.AppName.ux.activity.MainActivity.ecsEventHandler(MainActivity.java:568) at com.AppName.ux.activity.MainActivity.onCreate(MainActivity.java:324) at android.app.Activity.performCreate(Activity.java:8285) at android.app.Activity.performCreate(Activity.java:8264) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3667)
I try to share of files in android 11,but i get an exception:
java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.DOWNLOAD_COMPLETE flg=0x10 pkg=ru.alexanderkozlovskiy.test (has extras) } in ru.alexanderkozlovskiy.test.ActivityMain$loadReciever$1#bbd5a77
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1572)
at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:7861)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: java.lang.SecurityException: UID 10415 does not have permission to content://downloads/all_downloads/1199 [user 0] [prefix]
You can see my code on https://github.com/AlexandrKozlovskiy/share_issue. Thanks everybody for any help.
I am testing a new app on a physical device:
REDMI NOTE 9 PRO
android 10
MIUI 12
I am trying to access to startSoftAp that is a hidden method of WifiManager class. That is I want programmatically start and stop tethering.
Following this approach and many other links such as:
https://www.xda-developers.com/android-development-bypass-hidden-api-restrictions/
https://www.reddit.com/r/androiddev/comments/deyz14/apparently_you_can_destroy_hidden_api_blacklist/
I am facing a new issue regarding
android.permission.NETWORK_STACK
that I am not able to fix. The main cause is
Caused by: **java.lang.SecurityException: WifiService: Neither user
10448 nor current process has android.permission.NETWORK_STACK.
Obviously I tried to specify this via manifest file but this is a non-SDK permission or hidden permission. Then them method described by many programmer to bypass hidden API seems is missing something about this permission.
Here is the stack trace.
**java.lang.reflect.InvocationTargetException**
at java.lang.reflect.Method.invoke(Native Method)
at com.example.tel_info.MainActivity.setHotspot(MainActivity.java:111)
at com.example.tel_info.MainActivity.onCreate(MainActivity.java:85)
at android.app.Activity.performCreate(Activity.java:7893)
at android.app.Activity.performCreate(Activity.java:7880)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3283)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3457)
at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5372)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5280)
at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7562)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.example.tel_info.HideClass.startSoftApInstance(HideClass.java:42)
Caused by: **java.lang.SecurityException: WifiService: Neither user 10448 nor current process has android.permission.NETWORK_STACK.**
at android.os.Parcel.createException(Parcel.java:2074)
at android.os.Parcel.readException(Parcel.java:2042)
at android.os.Parcel.readException(Parcel.java:1990)
at android.net.wifi.IWifiManager$Stub$Proxy.startSoftAp(IWifiManager.java:3031)
at android.net.wifi.WifiManager.startSoftAp(WifiManager.java:2721)
Caused by: android.os.RemoteException: Remote stack trace:
at android.app.ContextImpl.enforce(ContextImpl.java:1906)
at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1934)
at com.android.server.wifi.WifiServiceImpl.enforceNetworkStackPermission(WifiServiceImpl.java:915)
at com.android.server.wifi.WifiServiceImpl.startSoftAp(WifiServiceImpl.java:1206)
at android.net.wifi.IWifiManager$Stub.onTransact(IWifiManager.java:1359)
How to grant this to my app? Thanks in advance.
I am facing two inter related issue,
I am facing following issue in Android Oreo device,
java.lang.RuntimeException: Error receiving broadcast Intent { act=com.example.bluetooth.le.ACTION_REMOTE_RSSI_UPDATED flg=0x10 (has extras) } in com.linka.linkaapikit.module.widget.LockGattUpdateReceiver$1#762cfd9
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52197(LoadedApk.java:1315)
at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:172)
at android.app.ActivityThread.main(ActivityThread.java:6590)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.SecurityException: Failed to find provider null for user 0; expected to find a valid ContentProvider for this authority
at android.os.Parcel.readException(Parcel.java:2005)
at android.os.Parcel.readException(Parcel.java:1951)
at android.content.IContentService$Stub$Proxy.notifyChange(IContentService.java:801)
at android.content.ContentResolver.notifyChange(ContentResolver.java:2049)
at android.content.ContentResolver.notifyChange(ContentResolver.java:2000)
at android.content.ContentResolver.notifyChange(ContentResolver.java:1970)
at com.activeandroid.Model.save(Model.java:162)
After that i find following solutions,
add in Android Manifest
<provider
android:name="com.activeandroid.content.ContentProvider"
android:authorities="com.myapp"
android:enabled="true"
android:exported="false"
/>
But after adding this line i got another issue that are following,
java.lang.IncompatibleClassChangeError: Superclass org.apache.http.params.BasicHttpParams of org.apache.http.params.SyncBasicHttpParams is declared final (declaration of 'org.apache.http.params.SyncBasicHttpParams' appears in /data/app/com.kolonishare-6KsxqUHOK_Q45cGI0D0bHg==/base.apk:classes16.dex)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at com.activeandroid.ModelInfo.scanForModelClasses(ModelInfo.java:187)
at com.activeandroid.ModelInfo.scanForModel(ModelInfo.java:152)
at com.activeandroid.ModelInfo.<init>(ModelInfo.java:63)
at com.activeandroid.Cache.initialize(Cache.java:66)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:44)
at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:34)
at com.activeandroid.content.ContentProvider.onCreate(ContentProvider.java:39)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1919)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1894)
at android.app.ActivityThread.installProvider(ActivityThread.java:6285)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
I clean and also rebuild project, invalidate restart but getting same error.
you need put your xml in this
<provider android:name="com.activeandroid.content.ContentProvider"
android:authorities="${applicationId}.fileprovider"
android:enabled="true"
android:exported="false" />
I've tried this code but It's not working Properly.
Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", true);
sendBroadcast(intent, Manifest.permission.WRITE_SECURE_SETTINGS);
Getting this Error:
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.setting/com.setting.activity.TraceLocationActivity}:
java.lang.SecurityException: Permission Denial: not allowed to send
broadcast android.location.GPS_ENABLED_CHANGE from pid=28258,
uid=10395
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2793)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Caused by: java.lang.SecurityException: Permission Denial: not allowed to send
broadcast android.location.GPS_ENABLED_CHANGE from pid=28258,
uid=10395
at android.os.Parcel.readException(Parcel.java:1665)
at android.os.Parcel.readException(Parcel.java:1618)
at android.app.ActivityManagerProxy.broadcastIntent(ActivityManagerNative.java:3533)
at android.app.ContextImpl.sendBroadcast(ContextImpl.java:1012)
at android.content.ContextWrapper.sendBroadcast(ContextWrapper.java:426)
at com.setting.activity.TraceLocationActivity.onCreate(TraceLocationActivity.java:46)
at android.app.Activity.performCreate(Activity.java:6915)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
How can i On GPS Automatically without asking User?
This is not possible, for obvious privacy and security reasons.