Neither user 10071 nor current process has android.permission.DEVICE_POWER.java
在本身的activity裏寫了以下代碼android
try {app
IPowerManager power = IPowerManager.Stub.asInterface(ui
ServiceManager.getService("power"));orm
if (power != null) {xml
System.out.println("brightness = " + brightness); --------------- brightness 數值也是對的ip
power.setBacklightBrightness(brightness); ------------ 這裏報錯get
}string
} catch (RemoteException doe) {it
}
報錯提示
09-08 03:06:30.630: ERROR/AndroidRuntime(13726): java.lang.SecurityException: Neither user 10071 nor current process has android.permission.DEVICE_POWER.
可是我已經再androidminifest 裏 定義了
<uses-permission android:name="android.permission.DEVICE_POWER" />
等高人解答~~
不過已經找到問題了。。原來是沒有簽名的問題
手動簽名以後 就能夠了,
終於知道了,搞死人了啊,哈哈
在
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mokoid.LedTest"
android:sharedUserId="android.uid.system">
其中後面一句是必定要加的
第二:
在Android.mk
中經過證書來聲明權限。
LOCAL_CERTIFICATE := platform
須要和manifest中的android:sharedUserId="android.uid.system" 對應起來。
platform 權限問題,最好運行在本身編譯的系統上,才能夠有次特權。
<!-- Allows low-level access to power management -->
<permission android:name="android.permission.DEVICE_POWER"
android:label="@string/permlab_devicePower"
android:description="@string/permdesc_devicePower"
android:protectionLevel="signature" />
若是某個權限(permission)的protectionLevel是signature,則這個權限就只能授予那些跟該權限所在的包擁有同一個數字證書的程序。
A permission that the system grants only if the requesting application is signed with the same certificate as the application that declared the permission.