Android系统的应用程序DEVICE_POWER权限错误 [英] Android system application DEVICE_POWER permission error

查看:3184
本文介绍了Android系统的应用程序DEVICE_POWER权限错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用 goToSleep()方法将手机进入深睡状态。 程序安装到/系统/应用程序目录中,这样的Andr​​oid系统信息说,它是一个系统的应用,但如果我尝试调用goToSleep()我得到这个错误

I try to use goToSleep() method to put phone into deep sleep. Program was installed into /system/app directory so Android System Info says, that it is a system application, but if i try call goToSleep() i get this error

无论用户10085也不是当前进程android.permission.DEVICE_POWER。

code取样:

            IPowerManager mPowerManager = IPowerManager.Stub.asInterface(ServiceManager.getService("power"));

            long time = SystemClock.uptimeMillis() + 1000;
            try {
                mPowerManager.goToSleep(time);
            } catch (RemoteException e) {
                 Toast.makeText(getApplicationContext(), "error: " + e.toString(), Toast.LENGTH_LONG).show();
                e.printStackTrace();
            }

AndroidManifest.xml中

AndroidManifest.xml

<permission android:name="android.permission.DEVICE_POWER"/> 
<uses-permission android:name="android.permission.DEVICE_POWER" />
<permission android:name="android.permission.REBOOT"/>
<uses-permission android:name="android.permission.REBOOT"/>

据我了解,如果我运行系统的应用比我能获得对所有的Andr​​oid隐藏或系统功能的访问,还是我错了?

As i understand, if i run system application than i can gain access to all android hide or system functions, or i'm wrong?

的事情,我尝试做运行的应用程序的系统应用程序了:

Things that i try to do to run app as system applicaiton:

  1. 将文件复制到/系统/应用程序
  2. CHOWN 0:0
  3. 搭配chmod 4755
  4. 乌戈搭配chmod + S

也许别人已经遇到这个问题。任何建议将是有益的。

Maybe someone else has already encountered this problem. Any suggestions would be helpful

推荐答案

通过查看源$ C ​​$ CS我看你需要签名许可,我认为这是不够的是一个系统的应用程序,你需要用的ROM相同的证书,一个在 /system/framework/android/framework-res.apk

by looking in source codes I see you need signature permission, I think it's not enough to be a system app, you need to be signed with same cert of the rom, the one in /system/framework/android/framework-res.apk

这篇关于Android系统的应用程序DEVICE_POWER权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆