Merge "Use proper platform version checks (libstats)" into rvc-dev am: b797431342

Change-Id: Iaa9b4d4e650c23cd5fc761047919fad8cf82b837
This commit is contained in:
Ruchir Rastogi 2020-05-11 18:00:34 +00:00 committed by Automerger Merge Worker
commit c7de5847f1
2 changed files with 2 additions and 20 deletions

View File

@ -28,17 +28,8 @@ using android::base::boot_clock;
using android::base::GetProperty;
const static int kStatsEventTag = 1937006964;
/* Checking ro.build.version.release is fragile, as the release field is
* an opaque string without structural guarantees. However, testing confirms
* that on Q devices, the property is "10," and on R, it is "R." Until
* android_get_device_api_level() is updated, this is the only solution.
*
* TODO(b/146019024): migrate to android_get_device_api_level()
*/
const bool StatsEventCompat::mPlatformAtLeastR =
GetProperty("ro.build.version.codename", "") == "R" ||
android_get_device_api_level() > __ANDROID_API_Q__;
android_get_device_api_level() >= __ANDROID_API_R__;
// initializations of static class variables
bool StatsEventCompat::mAttemptedLoad = false;

View File

@ -21,16 +21,7 @@
using android::base::GetProperty;
/* Checking ro.build.version.release is fragile, as the release field is
* an opaque string without structural guarantees. However, testing confirms
* that on Q devices, the property is "10," and on R, it is "R." Until
* android_get_device_api_level() is updated, this is the only solution.
*
*
* TODO(b/146019024): migrate to android_get_device_api_level()
*/
const static bool mPlatformAtLeastR = GetProperty("ro.build.version.codename", "") == "R" ||
android_get_device_api_level() > __ANDROID_API_Q__;
const static bool mPlatformAtLeastR = android_get_device_api_level() >= __ANDROID_API_R__;
TEST(StatsEventCompatTest, TestDynamicLoading) {
StatsEventCompat event;