Fix buggy code in ProfileSaver.

The code has two bugs:
1. `ResolveTrackedLocations` generates N empty locations and passes them
   to `AddTrackedLocationsToMap`.
2. There is a check in `AddTrackedLocationsToMap` that was intended to
   filter out locations ending with '/' but unintentionally filters out
   empty locations (because std::string::npos has a value of -1 and
   therefore equals to `path.size() - 1` when `path` is empty).

Interestingly, with both bugs present together, they result in correct
behavior. However, we shouldn't rely on bugs that happen to work
together.

Test: art/test.py -b --host -r -t 595-profile-saving
Change-Id: Ic6cddd529b8295df68bef61f0ceb26a26ad93304
1 file changed