Fixes #423: [Battery Performance] Set up Fenix and Raptor
parent
9d6ea0ac28
commit
f22f3ec9e2
|
@ -4,7 +4,9 @@
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
<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
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
@ -65,6 +67,9 @@
|
||||||
android:resource="@mipmap/ic_launcher"/>
|
android:resource="@mipmap/ic_launcher"/>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name=".browser.BrowserPerformanceTestActivity"
|
||||||
|
android:exported="true"/>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".customtabs.CustomTabsService"
|
android:name=".customtabs.CustomTabsService"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
|
|
@ -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))
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ package org.mozilla.fenix.components
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.os.Bundle
|
||||||
import android.preference.PreferenceManager
|
import android.preference.PreferenceManager
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
@ -34,13 +35,21 @@ import java.util.concurrent.TimeUnit
|
||||||
class Core(private val context: Context) {
|
class Core(private val context: Context) {
|
||||||
|
|
||||||
private val runtime by lazy {
|
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)
|
.crashHandler(CrashHandlerService::class.java)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
GeckoRuntime.create(context, runtimeSettings)
|
GeckoRuntime.create(context, runtimeSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var testConfig: Bundle? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The browser engine component initialized based on the build
|
* The browser engine component initialized based on the build
|
||||||
* configuration (see build variants).
|
* configuration (see build variants).
|
||||||
|
|
Loading…
Reference in New Issue