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
Neither user 10085 nor current process has android.permission.DEVICE_POWER.
Code sampling:
            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
<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"/>
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:
- copy file to /system/app
 - chown 0:0
 - chmod 4755
 - chmod ugo+s
 
Maybe someone else has already encountered this problem. Any suggestions would be helpful