Avoid hardcoding /storage/emulated/0 in memory metrics test.

In https://r.android.com/1224837 we hardcoded this path instead of
using the value of ${EXTERNAL_STORAGE}, because the latter triggered
an issue with the way the tradefed test runner does URL encoding. This
issue is only triggered when the filename has a + sign in it. So the
better fix is to avoid that + sign. Since that was coming from the ISO
8601 formatting of a timestamp with a timezone, this can be done by
simply switching to UTC.

This change also switches from java.util.Date to the superior
java.time, and simplifies the code along the way.

Bug: 145514052
Test: atest libcore-memory-metrics-tests
Change-Id: I93264fa43c91a6d5697b8511d406a85aeece6111
1 file changed