I want to set an alarm using ADB. So as adviced by this documentation, I try to use this command to invoke google voice action intents using adb:

adb shell am start -a android.intent.action.SET_ALARM

I get this error on invoking because of permission denial.

C:\Users\Admin> adb shell am start -a android.intent.action.SET_ALARM
Starting: Intent { act=android.intent.action.SET_ALARM }
Security exception: Permission Denial: starting Intent { act=android.intent.action.SET_ALARM flg=0x10000000 cmp=com.sec.android.app.clockpackage/.alarm.activity.AlarmCTSHandleActivity } from null (pid=3797, uid=2000) requires com.android.alarm.permission.SET_ALARM
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.SET_ALARM flg=0x10000000 cmp=com.sec.android.app.clockpackage/.alarm.activity.AlarmCTSHandleActivity } from null (pid=3797, uid=2000) requires com.android.alarm.permission.SET_ALARM
        at com.android.server.am.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1922)
        at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:630)
        at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:410)
        at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1271)
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6054)
        at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:424)
        at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:142)
        at android.os.ShellCommand.exec(ShellCommand.java:96)
        at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:18825)
        at android.os.Binder.shellCommand(Binder.java:581)
        at android.os.Binder.onTransact(Binder.java:481)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4785)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3888)
        at android.os.Binder.execTransact(Binder.java:682)*

I have tried to grant the permission but it was also unsuccessful

adb shell pm grant -a com.sec.android.app.clockpackage/.alarm.activity.AlarmCTSHandleActivity com.android.alarm.permission.SET_ALARM

*ERROR:"Bad argument: java.lang.IllegalArgumentException: Unknown package: com.sec.android.app.clockpackage/.alarm.activity.AlarmCTSHandleActivity"*
C:\Users\Admin> adb shell pm grant -a com.sec.android.app.clockpackage com.android.alarm.permission.SET_ALARM

Operation not allowed: java.lang.SecurityException: Permission com.android.alarm.permission.SET_ALARM is not a changeable permission type.

Please help me out, I am new to android and i have just started using adb.

Thanks in advance.

  • Is the device rooted? You might need to start that intent with root powers. – Izzy Aug 10 at 13:47
  • No my device is not rooted... i just want to resolve this exception starting: Intent { act=android.intent.action.SET_ALARM } Security exception: Permission Denial: starting Intent { act=android.intent.action.SET_ALARM flg=0x10000000 cmp=com.sec.android.app.clockpackage/.alarm.activity.AlarmCTSHandleActivity } from null (pid=3797, uid=2000) requires com.android.alarm.permission.SET_ALARM – Vinayak Sharma Aug 11 at 14:19
  • Also can someone please tell me how to grant permission to this type of activity/Class cmp=com.sec.android.app.clockpackage/.alarm.activity.AlarmCTSHandleActivity – Vinayak Sharma Aug 11 at 14:23
  • That's not the issue, Vinayak. That package is what provides the alarm functionality. The one lacking the permission to invoke it is the shell user you're connected to via ADB – which is why you'd need root, so you can switch to "super powers". – Izzy Aug 11 at 17:38
  • Okay @Izzy thanks for the info. I'll definitely try this with super user kinda permission to shell and I'll let you know if it works. – Vinayak Sharma Aug 12 at 18:05

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.