Fix NPE when get metadata without set any

* The metadata embedded database entity was set to null by the
  DAO implementation if all metadata are null.
* Add NonNull to the publicMetadata.
* Add unit test to cover this kind of situation.

Bug: 123575407
Test: Manual, runtest bluetooth
Change-Id: I5f2c2bd73f131e3dbd392381a10a7d1c2124e04c
2 files changed