Skip to content
Commit 66c5a8d2 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Dump activities that handle when USB devices get plugged in

When a USB device or accessory gets plugged in the system might
automatically start activities that have a device/accessory filter set
to include the plugged in USB device.

Unfortunately we seen too many apps setting too broad of a filter and it
annoys the user that this apps wants to start every time the device gets
plugged in.

This change dumps the acitivity names and their filters so debugging
such issues is much easier.

To do this, there is some mild refactoring:

1. Split packageMatchesLocked into
- getDeviceFilters to resolve all device filters
- getAccessoryFilterer to resolve all accessories
- Check if a filter matches after resolving all filters. This is no
  performance issue as usually there is only one or two filters per
  activity.

2. Split queryIntentActivitiesForAllProfiles into
- A per user part, so that we can use the exact same intent-resolution
  code for the dump-code
- And a loop over the per user part

Test: adb shell dumpsys usb
      + incident_report usb
      + verified that the output is as expected

Change-Id: I552c963b9a1b1c7df0adc6746af8cd42a4691cd6
parent c4daa74f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment