Created
March 11, 2020 19:02
-
-
Save mstange/f1dcb86e5caef78cd6ba9c0713c19198 to your computer and use it in GitHub Desktop.
When opening Fenix with an app link intent, this starts the Android sampling profiler. When opening the settings panel, the profiler is stopped and the result is dumped to /sdcard/Android/data/org.mozilla.fenix.performancetest/files/fenix.trace. The trace files can be opened with the profiler in Android Studio.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/build.gradle b/app/build.gradle | |
index 1f1926a2..5ed912b2 100644 | |
--- a/app/build.gradle | |
+++ b/app/build.gradle | |
@@ -64,17 +64,18 @@ android { | |
applicationIdSuffix ".fenix.debug" | |
manifestPlaceholders.isRaptorEnabled = "true" | |
resValue "bool", "IS_DEBUG", "true" | |
pseudoLocalesEnabled true | |
} | |
forPerformanceTest releaseTemplate >> { // the ">>" concatenates the raptor-specific options with the template | |
manifestPlaceholders.isRaptorEnabled = "true" | |
applicationIdSuffix ".fenix.performancetest" | |
- debuggable true | |
+ buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true" | |
+ signingConfig signingConfigs.debug | |
} | |
fenixNightly releaseTemplate >> { | |
applicationIdSuffix ".fenix.nightly" | |
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true" | |
} | |
fenixBeta releaseTemplate >> { | |
applicationIdSuffix ".fenix.beta" | |
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true" | |
diff --git a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt | |
index 05b917ee..99c30613 100644 | |
--- a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt | |
+++ b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt | |
@@ -2,16 +2,17 @@ | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
package org.mozilla.fenix | |
import android.app.Activity | |
import android.content.Intent | |
import android.os.Bundle | |
+import android.os.Debug | |
import androidx.annotation.VisibleForTesting | |
import kotlinx.coroutines.MainScope | |
import kotlinx.coroutines.launch | |
import mozilla.components.feature.intent.processing.IntentProcessor | |
import org.mozilla.fenix.components.IntentProcessorType | |
import org.mozilla.fenix.components.getType | |
import org.mozilla.fenix.components.metrics.Event | |
import org.mozilla.fenix.ext.components | |
@@ -23,16 +24,18 @@ import org.mozilla.fenix.shortcut.NewTabShortcutIntentProcessor | |
* Processes incoming intents and sends them to the corresponding activity. | |
*/ | |
class IntentReceiverActivity : Activity() { | |
@VisibleForTesting | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
+ Debug.startMethodTracingSampling("fenix.trace", 8*1024*1024, 5000) | |
+ | |
MainScope().launch { | |
// The intent property is nullable, but the rest of the code below | |
// assumes it is not. If it's null, then we make a new one and open | |
// the HomeActivity. | |
val intent = intent?.let { Intent(intent) } ?: Intent() | |
intent.stripUnwantedFlags() | |
processIntent(intent) | |
} | |
diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt | |
index 5c64120a..37eb970a 100644 | |
--- a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt | |
+++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt | |
@@ -1,16 +1,17 @@ | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
package org.mozilla.fenix.components.toolbar | |
import android.app.Activity | |
import android.content.Intent | |
+import android.os.Debug | |
import androidx.annotation.VisibleForTesting | |
import androidx.navigation.NavController | |
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout | |
import com.google.android.material.snackbar.Snackbar | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.ExperimentalCoroutinesApi | |
import kotlinx.coroutines.MainScope | |
@@ -128,16 +129,17 @@ class DefaultBrowserToolbarController( | |
trackToolbarItemInteraction(item) | |
Do exhaustive when (item) { | |
ToolbarMenu.Item.Back -> sessionUseCases.goBack.invoke(currentSession) | |
ToolbarMenu.Item.Forward -> sessionUseCases.goForward.invoke(currentSession) | |
ToolbarMenu.Item.Reload -> sessionUseCases.reload.invoke(currentSession) | |
ToolbarMenu.Item.Stop -> sessionUseCases.stopLoading.invoke(currentSession) | |
ToolbarMenu.Item.Settings -> browserAnimator.captureEngineViewAndDrawStatically { | |
+ Debug.stopMethodTracing() | |
val directions = BrowserFragmentDirections.actionBrowserFragmentToSettingsFragment() | |
navController.nav(R.id.browserFragment, directions) | |
} | |
ToolbarMenu.Item.Library -> browserAnimator.captureEngineViewAndDrawStatically { | |
val directions = BrowserFragmentDirections.actionBrowserFragmentToLibraryFragment() | |
navController.nav(R.id.browserFragment, directions) | |
} | |
is ToolbarMenu.Item.RequestDesktop -> sessionUseCases.requestDesktopSite.invoke( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment