Key input consumers by token and not by name
- Currently input consumers are singletons keyed by static name, which is problematic because the per-user Launcher process registers and unregisters the input consumer when SysUI binds to the current user's TouchInteractionService. However, the ordering of service create and destroy when switching users is not guaranteed, so you can end up with user 2's service being created before user 1's service destroy is called. Currently this crashes because we expect singletons. - This change changes the tracking of input consumers to be by token (which is already passed by the caller), and uses the token for identifying the input consumer to destroy. In addition, it only enforces a singleton check for input consumers registered for the same user. And when fetching an input consumer by name, the last registered consumer with that name takes precedence and is returned. This allows multiple Launcher processes to register a consumer for the current user without preventing the closing Launcher service from removing its previously registered consumer. Fixes: 300973954 Test: Verify with multiple users that there's no race between registering and destroying the recents input consumer Change-Id: I64d2453c3671747b5799f26b628448fdf03bdb77
Loading
Please register or sign in to comment