Merge changes If6c9684f,Iefab4b8b

* changes:
  Extract the logic to dispatch uid state changes into separate method.
  Add tests for ActivityManagerService.dispatchUidsChanged.