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

Commit 5ec73675 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Attempt v2 of "Disables non-system AccessibilityMenu for secondary users.""

parents a0a56c03 fe61b556
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -958,7 +958,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
        final ComponentName menuToMigrate =
                AccessibilityUtils.getAccessibilityMenuComponentToMigrate(mPackageManager, userId);
        if (menuToMigrate != null) {
            mPackageManager.setComponentEnabledSetting(
            // PackageManager#setComponentEnabledSetting disables the component for only the user
            // linked to PackageManager's context, but mPackageManager is linked to the system user,
            // so grab a new PackageManager for the current user to support secondary users.
            final PackageManager userPackageManager =
                    mContext.createContextAsUser(UserHandle.of(userId), /* flags = */ 0)
                            .getPackageManager();
            userPackageManager.setComponentEnabledSetting(
                    menuToMigrate,
                    PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                    PackageManager.DONT_KILL_APP);
@@ -1845,6 +1851,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            // find out a way to detect the device finished the OTA and switch the user.
            migrateAccessibilityButtonSettingsIfNecessaryLocked(userState, null,
                    /* restoreFromSdkInt = */0);
            // Package components are disabled per user, so secondary users also need their migrated
            // Accessibility Menu component disabled.
            disableAccessibilityMenuToMigrateIfNeeded();

            if (announceNewUser) {
                // Schedule announcement of the current user if needed.