)]}'
{
  "commit": "d4b09d4e16a9dc2bb08b1e06b87c02de3f46308c",
  "tree": "6b672fc42e0bf918f7f76ee1d2765175158f396a",
  "parents": [
    "7080fa528272d4353e9979cf693e5b4dc1d0db8b"
  ],
  "author": {
    "name": "Philip P. Moltmann",
    "email": "moltmann@google.com",
    "time": "Fri Apr 28 17:25:37 2017 -0700"
  },
  "committer": {
    "name": "Philip P. Moltmann",
    "email": "moltmann@google.com",
    "time": "Tue May 09 10:18:41 2017 -0700"
  },
  "message": "Fixes for handling users + default for USB\n\nOnce a user plugs in a USB device (or accessory) the user can decide\nwhich app should be started by default once the device is plugged in.\nI.e. this app becomes the \"default\" for this USB device. If the user has\na work profile the default app is set for all profiles of the current\nprofile group (i.e. personal and work profile) as at any point in time\none profile group is visible on the screen.\n\nThere were some issues in the code:\n- fix small obvious bugs\n\n- use userPackage (\u003d\u003dpackageName + user) everywhere instead of only\n  packageName as we have to distinguish between apps of different\n  profiles.\n- Stop accessing userPackage.packageName whereever possible to avoid\n  mistakenly ignoring the user\n\n- Monitor packages of all users and deal only with users of the current\n  profile group.\n- Do not react to package changes/updates/modifications. While it is\n  possible that an app gained the ability to deal with new USB devices on\n  update, we should not clear the default app for a default device. This\n  is because (1) this situation is exceedingly rare and (2) we do not\n  easily know when an app gained the ability to deal with a device. The\n  user can still manually clear the USB default app via Settings.\n\n- The old DeviceFilter.matches code did not make sense. An app that\n  wanted to replace the previous default app would have needed to know\n  the serial number of the device.\n\nTest: - Searched for access to UserPackage.packageName and we only use it\n        directly three times now. I checked these occurances and it is save\n        to use.\n      - Ran the following test\n        - Install app that can handle a USB device in personal profile\n\t- make this app the default for this USB device\n\t- Install same app in work profile -\u003e default was be cleared as\n                                              it is not clear if the user\n\t\t\t\t\t      might prefer the other app\n\t- make the work app the default for this USB device\n\t- update non-work app -\u003e default should not be cleared as the the\n                                 update is usually not triggered by the\n\t\t\t\t user and we should just keep the\n\t\t\t\t selection the user made before\n\t- update work app -\u003e App is already default\n\t- uninstall work app -\u003e default should be cleared as the default\n                                app was removed\nFixes: 36610004\nChange-Id: I294b582c36228169ac12a02d8007a4541e386d57\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "93cfd11b3d46639b1fb8154195e0316866a0b054",
      "old_mode": 33188,
      "old_path": "services/usb/java/com/android/server/usb/UsbProfileGroupSettingsManager.java",
      "new_id": "5399bb9e5d80cae331fc48581e278dbc5a5458ae",
      "new_mode": 33188,
      "new_path": "services/usb/java/com/android/server/usb/UsbProfileGroupSettingsManager.java"
    }
  ]
}
