From 4e8f3a26876fbcb111cf69aa9e762d50d9068a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Wed, 24 Mar 2021 16:56:12 +0000 Subject: [PATCH] Bug 1699646 - Add Android device information to the profile meta object r=geckoview-reviewers,agi,gerald,julienw Differential Revision: https://phabricator.services.mozilla.com/D109408 --- .../java/org/mozilla/gecko/GeckoJavaSampler.java | 12 ++++++++++++ tools/profiler/core/platform.cpp | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoJavaSampler.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoJavaSampler.java index 8dd714ecc8b5..6d50c368c5f8 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoJavaSampler.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoJavaSampler.java @@ -5,6 +5,7 @@ package org.mozilla.gecko; +import android.os.Build; import android.os.Looper; import android.os.SystemClock; import android.util.Log; @@ -446,4 +447,15 @@ public class GeckoJavaSampler { sMarkerStorage.stop(); } } + + /** + * Returns the device brand and model as a string. + */ + @WrapForJNI + public static String getDeviceInformation() { + final StringBuilder sb = new StringBuilder(Build.BRAND); + sb.append(" "); + sb.append(Build.MODEL); + return sb.toString(); + } } diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index 572280ebfdfe..8040f83acfc3 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -2636,6 +2636,12 @@ static void StreamMetaJSCustomObject( aPreRecordedMetaInformation.mProcessInfoCpuCount); } +#if defined(GP_OS_android) + jni::String::LocalRef deviceInformation = + java::GeckoJavaSampler::GetDeviceInformation(); + aWriter.StringProperty("device", deviceInformation->ToCString()); +#endif + aWriter.StartObjectProperty("sampleUnits"); { aWriter.StringProperty("time", "ms");