【持续集成】执行遍历测试,联系人出现1 system_app_crash-com.android.contacts
异常Log如下:
06-05 15:34:27.253 795 5188 E ActivityManager: Sending non-protected broadcast com.meitu.mobile.contacts.bat_delete_contacts from system 2956:com.android.dialer/1000 pkg com.android.dialer
06-05 15:34:27.253 795 5188 E ActivityManager: java.lang.Throwable
06-05 15:34:27.253 795 5188 E ActivityManager: at com.android.server.am.ActivityManagerService.checkBroadcastFromSystem(ActivityManagerService.java:19831)
06-05 15:34:27.253 795 5188 E ActivityManager: at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:20436)
06-05 15:34:27.253 795 5188 E ActivityManager: at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:20587)
06-05 15:34:27.253 795 5188 E ActivityManager: at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:240)
06-05 15:34:27.253 795 5188 E ActivityManager: at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3072)
06-05 15:34:27.253 795 5188 E ActivityManager: at android.os.Binder.execTransact(Binder.java:708)
06-05 15:34:27.296 795 5188 E ActivityTrigger: activityStartTrigger: not whiteListedcom.android.contacts/com.meios.contacts.list.ContactListMultiChoiceActivity/23
06-05 15:34:27.297 795 5188 E ActivityTrigger: activityResumeTrigger: not whiteListedcom.android.contacts/com.meios.contacts.list.ContactListMultiChoiceActivity/23
06-05 15:34:27.306 795 2166 E ActivityTrigger: activityResumeTrigger: not whiteListedcom.android.contacts/com.meios.contacts.list.ContactListMultiChoiceActivity/23
06-05 15:34:27.332 5978 5978 E ActionBarOverlayLayout: Requested split action bar with incompatible window decor! Ignoring request.
[Root Cause] AMS有做如下判断:App无persistent属性的时候当作非系统形式,非系统形式是无权限发送protected广播的,
而需要系统发送的自定义广播需要添加上protected属性
ActivityManagerService.java中代码如下:
switch (UserHandle.getAppId(callingUid)) {
case ....
break;
default:
isCallerSystem = (callerApp != null) && callerApp.persistent;
break;
}
// First line security check before anything else: stop non-system apps from
// sending protected broadcasts.
if (!isCallerSystem) {
if (isProtectedBroadcast) {
String msg = "Permission Denial: not allowed to send broadcast "
+ action + " from pid="
+ callingPid + ", uid=" + callingUid;
Slog.w(TAG, msg);
throw new SecurityException(msg);
}
}
[Solution]联系人已经移除perisistent属性,广播也无需添加protected标签了
网友评论