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

Commit 59f07690 authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Owner should not be announces as a user switch.

1. The accessibility layer announces user switches. Even though
   the initial switch to the owner on a singe user device is a
   valid use switch we should not announce it for accessibility.

bug:7264693

Change-Id: Idf022fab6b74c84b7a96bc4ed7c7fee2b83029a6
parent bfbf6e12
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3934,6 +3934,6 @@
    <!-- Text spoken when the user stops preforming a gesture that would enable accessibility. [CHAR LIMIT=none] -->
    <string name="enable_accessibility_canceled">Enable accessibility canceled.</string>
    <!-- Text spoken when the current user is switched if accessibility is enabled. [CHAR LIMIT=none] -->
    <string name="user_switched">Switched to user <xliff:g id="name" example="Bob">%1$s</xliff:g>.</string>
    <string name="user_switched">Current user <xliff:g id="name" example="Bob">%1$s</xliff:g>.</string>

</resources>
+10 −4
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {

    // TODO: This is arbitrary. When there is time implement this by watching
    //       when that accessibility services are bound.
    private static final int WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS = 5000;
    private static final int WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS = 3000;

    private static final String FUNCTION_REGISTER_UI_TEST_AUTOMATION_SERVICE =
        "registerUiTestAutomationService";
@@ -659,6 +659,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                        oldUserState.mUserId, 0).sendToTarget();
            }

            // Announce user changes only if more that one exist.
            UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
            final boolean announceNewUser = userManager.getUsers().size() > 1;

            // The user changed.
            mCurrentUserId = userId;

@@ -666,11 +670,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
            mMainHandler.obtainMessage(MainHandler.MSG_SEND_RECREATE_INTERNAL_STATE,
                    mCurrentUserId, 0).sendToTarget();

            if (announceNewUser) {
                // Schedule announcement of the current user if needed.
                mMainHandler.sendEmptyMessageDelayed(MainHandler.MSG_ANNOUNCE_NEW_USER_IF_NEEDED,
                        WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS);
            }
        }
    }

    private void removeUser(int userId) {
        synchronized (mLock) {