Prevent wrong system ui visibility callback after the user swipe

If we return vis without clearing clearable flags, it will be set to
IStatusBarService in updateSystemUiVisibilityLw(), and then be
callbacked to WMS via statusBarVisibilityChanged(), and then be
dispatched to the client; which is wrong because WMS should dispatch
the new value to the client, not the old one.

https://code.google.com/p/android/issues/detail?id=79991

Change-Id: I2a06d1fbe66e854e639d86a39784f8c6a3303674
[ActivityManager] Use synchronized to protect object

Symptom: ArrayIndexOutOfBoundsException at mResourcePackages
Root Cause: Race condition issue
Solution: Use synchronized to protect object

Change-Id: Ia2d89d50919d95d95f6f8ac2eb75594a93e8f2da
Merge "[ActivityManager] Use synchronized to protect object"
Merge "Prevent wrong system ui visibility callback after the user swipe"