Don't allow null primary sources

Move default media source to config.xml
Now, when the active media source is removed, we fall back to the
previous source, rather than have a null source.
Update the behavior for restoring removed sources:
-only restore sources with EXTRA_REPLACING set to true
-restore sources by component name rather than package name
-restore sources per media source mode (playback vs browse)

Fixes: 150611732
Test: Manual (replace sources with adb install -r -d, no replacement
with adb uninstall + adb install)

Change-Id: Iddcbf759fabb148a9d3ce5d534713e9c9f28b74f
3 files changed
tree: 7283b868316a46e639a0e99f268d58f45743302b
  1. car-bugreportd/
  2. car-default-input-service/
  3. car-internal-lib/
  4. car-lib/
  5. car-maps-placeholder/
  6. car-systemtest-lib/
  7. car-test-lib/
  8. car-usb-handler/
  9. car_product/
  10. computepipe/
  11. EncryptionRunner/
  12. evs/
  13. experimental/
  14. FrameworkPackageStubs/
  15. obd2-lib/
  16. procfs-inspector/
  17. service/
  18. surround_view/
  19. tests/
  20. tools/
  21. user/
  22. vehicle-hal-support-lib/
  23. watchdog/
  24. .clang-format
  25. .gitignore
  26. Android.mk
  27. CleanSpec.mk
  28. CPPLINT.cfg
  29. OWNERS
  30. PREUPLOAD.cfg
  31. README.md
README.md

Native (C++) code format is required to be compatible with .clang-format file. Run

git clang-format --style=file --extension='h,cpp,cc' HEAD~

Note that clang-format is not desirable for Android java files. Therefore the command line above is limited to specific extensions.