1
0
Fork 0

Fixes #423: [Battery Performance] Set up Fenix and Raptor

master
Colin Lee 2019-02-22 14:34:30 -06:00
parent 9d6ea0ac28
commit f22f3ec9e2
3 changed files with 43 additions and 2 deletions

View File

@ -4,7 +4,9 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
@ -65,6 +67,9 @@
android:resource="@mipmap/ic_launcher"/>
</activity>
<activity android:name=".browser.BrowserPerformanceTestActivity"
android:exported="true"/>
<service
android:name=".customtabs.CustomTabsService"
android:exported="true"

View File

@ -0,0 +1,27 @@
/* 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.browser
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import mozilla.components.support.utils.SafeIntent
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.ext.components
/**
* This activity is used for performance testing with Raptor/tp6:
* https://wiki.mozilla.org/Performance_sheriffing/Raptor
*/
class BrowserPerformanceTestActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
components.core.testConfig = SafeIntent(intent).extras
startActivity(Intent(this, HomeActivity::class.java))
}
}

View File

@ -6,6 +6,7 @@ package org.mozilla.fenix.components
import android.content.Context
import android.content.SharedPreferences
import android.os.Bundle
import android.preference.PreferenceManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@ -34,13 +35,21 @@ import java.util.concurrent.TimeUnit
class Core(private val context: Context) {
private val runtime by lazy {
val runtimeSettings = GeckoRuntimeSettings.Builder()
val builder = GeckoRuntimeSettings.Builder()
testConfig?.let {
builder.extras(it)
}
val runtimeSettings = builder
.crashHandler(CrashHandlerService::class.java)
.build()
GeckoRuntime.create(context, runtimeSettings)
}
var testConfig: Bundle? = null
/**
* The browser engine component initialized based on the build
* configuration (see build variants).