miui8 android.policy,MIUI8.1 系统可以正常打开app权限页面,但是添加AccessibilityService就出现以下异常...

第一次使用辅助功能望指点

public void openMiuiPermissionActivity(Context context) {

Intent intent = new Intent("miui.intent.action.APP_PERM_EDITOR");

if ("V5".equals(getProperty())) {

PackageInfo pInfo = null;

try {

pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);

} catch (PackageManager.NameNotFoundException e) {

Log.e("canking", "error");

}

intent.setClassName("com.miui.securitycenter", "com.miui.securitycenter.permission.AppPermissionsEditor");

intent.putExtra("extra_package_uid", pInfo.applicationInfo.uid);

} else if ("V8".equals(getProperty())) {

PackageInfo pInfo = null;

try {

pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);

} catch (PackageManager.NameNotFoundException e) {

Log.e("canking", "error");

}

intent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.RealAppPermissionsEditorActivity");

intent.putExtra("extra_package_uid", pInfo.applicationInfo.uid);

} else {

intent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity");

intent.putExtra("extra_pkgname", context.getPackageName());

}

if (isActivityAvailable(context, intent)) {

if (context instanceof Activity) {

Activity a = (Activity) context;

a.startActivityForResult(intent, 2);

}

} else {

Log.e("canking", "Intent is not available!");

}

}

12-26 11:13:10.123 25016-25016/com.javen.callphone I/System.out: 小米rom的版本名>V8

12-26 11:13:10.127 25016-25016/com.javen.callphone E/Javen: com.javen.callphone.utils.AppLogger.log(): 0 invoke 1

12-26 11:13:10.127 25016-25016/com.javen.callphone I/System.out: 判断MIUI的悬浮窗权限:false

12-26 11:13:10.128 25016-25016/com.javen.callphone E/Javen: com.javen.callphone.utils.AppLogger.log(): 0 invoke 1

12-26 11:13:10.131 25016-25016/com.javen.callphone I/Timeline: Timeline: Activity_launch_request time:122171774

12-26 11:13:10.136 25016-25016/com.javen.callphone D/AndroidRuntime: Shutting down VM

12-26 11:13:10.137 25016-25016/com.javen.callphone E/AndroidRuntime: FATAL EXCEPTION: main

Process: com.javen.callphone, PID: 25016

java.lang.IllegalStateException: Could not execute method for android:onClick

at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:293)

at android.view.View.performClick(View.java:5207)

at android.view.View$PerformClick.run(View.java:21177)

at android.os.Handler.handleCallback(Handler.java:739)

at android.os.Handler.dispatchMessage(Handler.java:95)

at android.os.Looper.loop(Looper.java:148)

at android.app.ActivityThread.main(ActivityThread.java:5441)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)

Caused by: java.lang.reflect.InvocationTargetException

at java.lang.reflect.Method.invoke(Native Method)

at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)

at android.view.View.performClick(View.java:5207)

at android.view.View$PerformClick.run(View.java:21177)

at android.os.Handler.handleCallback(Handler.java:739)

at android.os.Handler.dispatchMessage(Handler.java:95)

at android.os.Looper.loop(Looper.java:148)

at android.app.ActivityThread.main(ActivityThread.java:5441)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)

Caused by: java.lang.SecurityException: Permission Denial: starting Intent { act=miui.intent.action.APP_PERM_EDITOR cmp=com.miui.securitycenter/com.miui.permcenter.permissions.RealAppPermissionsEditorActivity (has extras) } from ProcessRecord{1d88e87 25016:com.javen.callphone/u0a325} (pid=25016, uid=10325) requires android.permission.CHANGE_COMPONENT_ENABLED_STATE

at android.os.Parcel.readException(Parcel.java:1620)

at android.os.Parcel.readException(Parcel.java:1573)

at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2661)

at android.app.Instrumentation.execStartActivity(Instrumentation.java:1509)

at android.app.Activity.startActivityForResult(Activity.java:3978)

at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:48)

at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:77)

at android.app.Activity.startActivityForResult(Activity.java:3939)

at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)

at com.javen.callphone.ui.MiActivity.openMiuiPermissionActivity(MiActivity.java:115)

at com.javen.callphone.ui.MiActivity.xiaomiPJ(MiActivity.java:66)

at com.javen.callphone.ui.MiActivity.openAppPermissionView(MiActivity.java:52)

at java.lang.reflect.Method.invoke(Native Method)

at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)

at android.view.View.performClick(View.java:5207)

at android.view.View$PerformClick.run(View.java:21177)

at android.os.Handler.handleCallback(Handler.java:739)

at android.os.Handler.dispatchMessage(Handler.java:95)

at android.os.Looper.loop(Looper.java:148)

at android.app.ActivityThread.main(ActivityThread.java:5441)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)

12-26 11:13:10.164 25016-25016/com.javen.callphone I/Process: Sending signal. PID: 25016 SIG: 9

[image: 手机版本]

You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub

, or mute the thread

.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值