Merge "Fix accessiblity introspection from the shell user regression." into lmp-dev

This commit is contained in:
Svetoslav
2014-10-01 23:24:46 +00:00
committed by Android (Google) Code Review

View File

@@ -2117,7 +2117,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// performs the current profile parent resolution. // performs the current profile parent resolution.
final int resolvedUserId = mSecurityPolicy final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked( .resolveCallingUserIdEnforcingPermissionsLocked(
UserHandle.getCallingUserId()); UserHandle.USER_CURRENT);
if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) {
return null; return null;
} }
@@ -2148,7 +2148,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// performs the current profile parent resolution. // performs the current profile parent resolution.
final int resolvedUserId = mSecurityPolicy final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked( .resolveCallingUserIdEnforcingPermissionsLocked(
UserHandle.getCallingUserId()); UserHandle.USER_CURRENT);
if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) {
return null; return null;
} }
@@ -2181,7 +2181,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// performs the current profile parent resolution. // performs the current profile parent resolution.
final int resolvedUserId = mSecurityPolicy final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked( .resolveCallingUserIdEnforcingPermissionsLocked(
UserHandle.getCallingUserId()); UserHandle.USER_CURRENT);
if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) {
return false; return false;
} }
@@ -2233,7 +2233,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// performs the current profile parent resolution. // performs the current profile parent resolution.
final int resolvedUserId = mSecurityPolicy final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked( .resolveCallingUserIdEnforcingPermissionsLocked(
UserHandle.getCallingUserId()); UserHandle.USER_CURRENT);
if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) {
return false; return false;
} }
@@ -2285,7 +2285,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// performs the current profile parent resolution. // performs the current profile parent resolution.
final int resolvedUserId = mSecurityPolicy final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked( .resolveCallingUserIdEnforcingPermissionsLocked(
UserHandle.getCallingUserId()); UserHandle.USER_CURRENT);
if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) {
return false; return false;
} }
@@ -2337,7 +2337,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// performs the current profile parent resolution. // performs the current profile parent resolution.
final int resolvedUserId = mSecurityPolicy final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked( .resolveCallingUserIdEnforcingPermissionsLocked(
UserHandle.getCallingUserId()); UserHandle.USER_CURRENT);
if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) {
return false; return false;
} }
@@ -2390,7 +2390,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// performs the current profile parent resolution. // performs the current profile parent resolution.
final int resolvedUserId = mSecurityPolicy final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked( .resolveCallingUserIdEnforcingPermissionsLocked(
UserHandle.getCallingUserId()); UserHandle.USER_CURRENT);
if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) {
return false; return false;
} }
@@ -2441,7 +2441,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// performs the current profile parent resolution. // performs the current profile parent resolution.
final int resolvedUserId = mSecurityPolicy final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked( .resolveCallingUserIdEnforcingPermissionsLocked(
UserHandle.getCallingUserId()); UserHandle.USER_CURRENT);
if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) {
return false; return false;
} }
@@ -2480,7 +2480,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// performs the current profile parent resolution. // performs the current profile parent resolution.
final int resolvedUserId = mSecurityPolicy final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked( .resolveCallingUserIdEnforcingPermissionsLocked(
UserHandle.getCallingUserId()); UserHandle.USER_CURRENT);
if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) {
return false; return false;
} }
@@ -2527,7 +2527,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// performs the current profile parent resolution. // performs the current profile parent resolution.
final int resolvedUserId = mSecurityPolicy final int resolvedUserId = mSecurityPolicy
.resolveCallingUserIdEnforcingPermissionsLocked( .resolveCallingUserIdEnforcingPermissionsLocked(
UserHandle.getCallingUserId()); UserHandle.USER_CURRENT);
if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) {
return false; return false;
} }
@@ -3621,6 +3621,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
if (callingUserId == userId) { if (callingUserId == userId) {
return resolveProfileParentLocked(userId); return resolveProfileParentLocked(userId);
} }
final int callingUserParentId = resolveProfileParentLocked(callingUserId);
if (callingUserParentId == mCurrentUserId &&
(userId == UserHandle.USER_CURRENT
|| userId == UserHandle.USER_CURRENT_OR_SELF)) {
return mCurrentUserId;
}
if (!hasPermission(Manifest.permission.INTERACT_ACROSS_USERS) if (!hasPermission(Manifest.permission.INTERACT_ACROSS_USERS)
&& !hasPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)) { && !hasPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)) {
throw new SecurityException("Call from user " + callingUserId + " as user " throw new SecurityException("Call from user " + callingUserId + " as user "