Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 186442a8 authored by Phil Weaver's avatar Phil Weaver Committed by Android (Google) Code Review
Browse files

Merge "Change users without crashing a11y services."

parents c7be1875 af5d0765
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -1315,8 +1315,14 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
    private void updateServicesLocked(UserState userState) {
        Map<ComponentName, Service> componentNameToServiceMap =
                userState.mComponentNameToServiceMap;
        boolean isUnlockingOrUnlocked = mContext.getSystemService(UserManager.class)
        boolean isUnlockingOrUnlocked;
        final long identity = Binder.clearCallingIdentity();
        try {
            isUnlockingOrUnlocked = mContext.getSystemService(UserManager.class)
                    .isUserUnlockingOrUnlocked(userState.mUserId);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }

        for (int i = 0, count = userState.mInstalledServices.size(); i < count; i++) {
            AccessibilityServiceInfo installedService = userState.mInstalledServices.get(i);
@@ -2531,7 +2537,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
            // share the accessibility state of the parent. The call below
            // performs the current profile parent resolution.
            final int resolvedUserId = mSecurityPolicy
                    .resolveCallingUserIdEnforcingPermissionsLocked(UserHandle.USER_CURRENT);
                    .resolveCallingUserIdEnforcingPermissionsLocked(UserHandle.getCallingUserId());
            return resolvedUserId == mCurrentUserId;
        }

+19 −8
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.accessibility;

import android.content.ContentResolver;
import android.content.Context;
import android.os.Binder;
import android.provider.Settings.Secure;
import android.view.accessibility.AccessibilityManager;

@@ -60,11 +61,16 @@ class DisplayAdjustmentUtils {
        final DisplayTransformManager dtm = LocalServices.getService(DisplayTransformManager.class);

        int daltonizerMode = AccessibilityManager.DALTONIZER_DISABLED;
        long identity = Binder.clearCallingIdentity();
        try {
            if (Secure.getIntForUser(cr,
                    Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0, userId) != 0) {
                daltonizerMode = Secure.getIntForUser(cr,
                        Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, DEFAULT_DISPLAY_DALTONIZER, userId);
            }
        } finally {
            Binder.restoreCallingIdentity(identity);
        }

        float[] grayscaleMatrix = null;
        if (daltonizerMode == AccessibilityManager.DALTONIZER_SIMULATE_MONOCHROMACY) {
@@ -83,9 +89,14 @@ class DisplayAdjustmentUtils {
        final ContentResolver cr = context.getContentResolver();
        final DisplayTransformManager dtm = LocalServices.getService(DisplayTransformManager.class);

        long identity = Binder.clearCallingIdentity();
        try {
            final boolean invertColors = Secure.getIntForUser(cr,
                    Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0, userId) != 0;
            dtm.setColorMatrix(DisplayTransformManager.LEVEL_COLOR_MATRIX_INVERT_COLOR,
                    invertColors ? MATRIX_INVERT_COLOR : null);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }
}