Merge "fix package visibility for installed accessibility services" into sc-dev
This commit is contained in:
@@ -872,18 +872,32 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
|
|||||||
"userId=" + userId);
|
"userId=" + userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int resolvedUserId;
|
||||||
|
final List<AccessibilityServiceInfo> serviceInfos;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
// We treat calls from a profile as if made by its parent as profiles
|
// We treat calls from a profile as if made by its parent as profiles
|
||||||
// share the accessibility state of the parent. The call below
|
// share the accessibility state of the parent. The call below
|
||||||
// performs the current profile parent resolution.
|
// performs the current profile parent resolution.
|
||||||
final int resolvedUserId = mSecurityPolicy
|
resolvedUserId = mSecurityPolicy
|
||||||
.resolveCallingUserIdEnforcingPermissionsLocked(userId);
|
.resolveCallingUserIdEnforcingPermissionsLocked(userId);
|
||||||
|
serviceInfos = new ArrayList<>(
|
||||||
if (Binder.getCallingPid() == OWN_PROCESS_ID) {
|
getUserStateLocked(resolvedUserId).mInstalledServices);
|
||||||
return new ArrayList<>(getUserStateLocked(resolvedUserId).mInstalledServices);
|
|
||||||
}
|
|
||||||
return getUserStateLocked(resolvedUserId).mInstalledServices;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Binder.getCallingPid() == OWN_PROCESS_ID) {
|
||||||
|
return serviceInfos;
|
||||||
|
}
|
||||||
|
final PackageManagerInternal pm = LocalServices.getService(
|
||||||
|
PackageManagerInternal.class);
|
||||||
|
final int callingUid = Binder.getCallingUid();
|
||||||
|
for (int i = serviceInfos.size() - 1; i >= 0; i--) {
|
||||||
|
final AccessibilityServiceInfo serviceInfo = serviceInfos.get(i);
|
||||||
|
if (pm.filterAppAccess(serviceInfo.getComponentName().getPackageName(), callingUid,
|
||||||
|
resolvedUserId)) {
|
||||||
|
serviceInfos.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return serviceInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user