Add setCapacity and removeRange to WatchedSparseBooleanMatrix

- This CL adds #setCapacity and #removeRange APIs to
  WatchedSparseBooleanMatrix for AppsFilter to update filter
  cache more efficiently when a user is created or deleted.

- Fix a crash in the #pack function when the caller invokes #compat
  to shrink the matrix.

Test: atest WatcherTest
Bug: 187853334
Change-Id: I6a3c87a7492793767f888487381182955d564d62
2 files changed