Fix the background of lockscreen showing the art work of removed media notification
StatusBar inflates notification views by AsyncTask(AsyncInflationTask), and the notification entry will be added to mNotificationData only after the inflation is completed.
It makes a timing issue for media notification if following conditions are met:
1. There already exists one none-media notification which is posted by the same app as the incoming media notification.
2. Any notification posted and its inflation is completed before the media notification and then triggers the findAndUpdateMediaNotifications().
In such case, the media notification entry hasn't been added to mNotificationData yet so we can't find any notification with media controller in this list.
Then we look up MediaSessionManager and try to find any MediaController that has the same package name with any notification in mNotificationData list.
It will then find a MediaController which should belong to the media notification, but then be assigned to the none-media notification since both have the same package name.
We now move the if (medianotification != null) {} block outside the
controller to make sure the correct media notification is set after its
inflation is completed.
Test: runtest systemui
Test: manual - open chrome : 1)download a file 2)play any youtube video 3)screen off then on device
Fixes: 75988950
Change-Id: Ic7f341cd0b0cf675807d2127e61cbb651f9dff75
1 file changed