Skip to content
Commit 21fbcd7c authored by Nahun Kim's avatar Nahun Kim Committed by Todd Kennedy
Browse files

Fix a timing issue where LauncherApps registers its callback twice

There is an edge case while the launcher process is killed and restarted by unexpected behavior.
LauncherApps unregisters a listener by being called back onCallbackDied from PackageCallbackList when the launcher process is killed.
However the launcher process is immediately restarted and registers a listener in the middle of processing binderDied() even before calling the onCallbackDied() in the binderDied().

This solution is to maintain a boolean, isWatchingPackageBroadcasts, determining whether or not the monitor has been registered.
startWatchingPackageBroadcasts() and stopWatchingPackageBroadcasts() are always called with the mListeners lock held, it can check/toggle the state safely in those methods.

Test: compile & verify basic functions working
Bug: 162753652
Change-Id: If91e4bc32b17b88576777699b3d8d9f409fae91d
parent 4873666f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment