Android What permissions required to call PowerManager.goToSleep(n) put device in sleep mode?

前端 未结 3 1842
星月不相逢
星月不相逢 2020-11-28 15:24

Already set android.permissions.DEVICE_POWER in manifest of my app. Still complains that neither user nor process have this permission when I call PowerManager.gotoSleep(n)

相关标签:
3条回答
  • 2020-11-28 15:36
    java -jar signapk.jar platform.x509.pem platform.pk8 bin/TestApp-unsigned.apk bin/TestApp.apk
    

    I had the exact same problem and this worked for me. Get signapk.jar from https://github.com/appium/sign. the repository also includes the Android test certificate, which works e.g. with a rooted nook.

    0 讨论(0)
  • 2020-11-28 15:41

    In old version, I read that it is a signature-protected permission, i.e. only apps that got signed as system apps are allowed to.

    0 讨论(0)
  • 2020-11-28 15:55

    DEVICE_POWER is a level 2 permission and protected permission and hence it is not provided to any app which request it via manifest, to get this permission successfully we need to have Platform certificate in our make file and shared user id set in manifest as system...

    LOCAL_CERTIFICATE := platform (makefile entry)
    
    android.uid.system (shared  user id )
    

    There isnt a way around this i have looked around havent found any ...

    0 讨论(0)
提交回复
热议问题