Fix ClassCastException in WatchedIntentResolver

Bug: 187691893

IntentResolver.sortResults() is a generic method that assumes its
argument is a List<IntentFilter>, although this is not explicit in the
data types.  The assumption fails in WatchedIntentResolver, which is
actually holding List<WatchedIntentFilter>.

The change follows the same path as server/firewall/IntentFirewall:
sortResults() is overridden in WatchedIntentResolver to accept the
proper type.  While we are at it, we force the class parameters in
WatchedIntentResolver to be WatchedIntentFilter (because that is
always true).  This means no casting is required to support
sortResults().

Finally, WatchedIntentResolver is moved into the server.pm package,
where it is actually used.  Should the need arise, it can be elevated
back to the server package.

Test: atest
 * CtsContentTestCases:IntentFilterTest
 * CtsDynamicMimeHostTestCases
 * FrameworksServicesTests:AppsFilterTest

Change-Id: Id1546c6711f95e0970c018b0e54cad7f3a8ac4b7
4 files changed