Merge changes I598642b1,I788fa06d

* changes:
  Removing historical tasks when packages are uninstalled.
  Saving the stack state when you rotate.