Skip to content

Commit

Permalink
Merge branch 'release/5.198.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
daxtheduck committed Apr 30, 2024
2 parents 90c0877 + 8f73237 commit d77b2c7
Show file tree
Hide file tree
Showing 303 changed files with 4,555 additions and 2,890 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ads-end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: find . -name "*.apk" -exec mv '{}' apk/release.apk \;

- name: ADS Preview Flows
uses: mobile-dev-inc/action-maestro-cloud@v1.4.1
uses: mobile-dev-inc/action-maestro-cloud@v1.8.1
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-nightly-autofill.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: find . -name "*.apk" -exec mv '{}' apk/release.apk \;

- name: Autofill Critical Path E2E Flows
uses: mobile-dev-inc/action-maestro-cloud@v1.6.0
uses: mobile-dev-inc/action-maestro-cloud@v1.8.1
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: find . -name "*.apk" -exec mv '{}' apk/release.apk \;

- name: Ad click detection flows
uses: mobile-dev-inc/action-maestro-cloud@v1.4.1
uses: mobile-dev-inc/action-maestro-cloud@v1.8.1
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
Expand All @@ -65,7 +65,7 @@ jobs:

- name: Privacy Tests
if: always()
uses: mobile-dev-inc/action-maestro-cloud@v1.4.1
uses: mobile-dev-inc/action-maestro-cloud@v1.8.1
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
Expand All @@ -76,7 +76,7 @@ jobs:

- name: Security Tests
if: always()
uses: mobile-dev-inc/action-maestro-cloud@v1.4.1
uses: mobile-dev-inc/action-maestro-cloud@v1.8.1
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
Expand All @@ -87,7 +87,7 @@ jobs:

- name: Release Tests
if: always()
uses: mobile-dev-inc/action-maestro-cloud@v1.4.1
uses: mobile-dev-inc/action-maestro-cloud@v1.8.1
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
Expand All @@ -98,7 +98,7 @@ jobs:

- name: Notifications permissions Android 13+
if: always()
uses: mobile-dev-inc/action-maestro-cloud@v1.4.1
uses: mobile-dev-inc/action-maestro-cloud@v1.8.1
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/privacy-dashboard-end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: find . -name "*.apk" -exec mv '{}' apk/release.apk \;

- name: Ad click detection flows
uses: mobile-dev-inc/action-maestro-cloud@v1.4.1
uses: mobile-dev-inc/action-maestro-cloud@v1.8.1
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
Expand All @@ -67,7 +67,7 @@ jobs:

- name: Privacy Tests
if: always()
uses: mobile-dev-inc/action-maestro-cloud@v1.4.1
uses: mobile-dev-inc/action-maestro-cloud@v1.8.1
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-critical-path.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
run: find . -name "*.apk" -exec mv '{}' apk/release.apk \;

- name: Sync Flows
uses: mobile-dev-inc/action-maestro-cloud@v1.6.0
uses: mobile-dev-inc/action-maestro-cloud@v1.8.1
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
Expand Down
1 change: 1 addition & 0 deletions .maestro/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ appStartup:
enabled: false
appSize:
enabled: false
disableRetries: true

flows:
- "**"
7 changes: 6 additions & 1 deletion .maestro/shared/open_bookmarks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ appId: com.duckduckgo.mobile.android
---
- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- tapOn: "Bookmarks"
- tapOn: "Bookmarks"
- runFlow:
when:
visible: "Download Missing Icons?"
commands:
- tapOn: "Not Now"
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ appId: com.duckduckgo.mobile.android
id: "com.duckduckgo.mobile.android:id/touch_outside"
# Now, we create a new folder
- runFlow: ../../shared/open_bookmarks.yaml
- runFlow:
when:
visible: "Download Missing Icons?"
commands:
- tapOn: "Not Now"
- tapOn: "Add Folder"
- tapOn: "Title"
- inputText: "${output.bookmarks.folders[0]}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ appId: com.duckduckgo.mobile.android
- assertVisible: "${output.bookmarks.titles[1]}"
- assertVisible: "${output.bookmarks.folders[0]}"
- tapOn: "${output.bookmarks.folders[0]}"
- assertVisible: "${output.bookmarks.titles[2]}"
- tapOn: "Navigate up"
- tapOn: "Navigate up"
- assertVisible: "${output.bookmarks.titles[2]}"
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ data class Anr(
val stackTrace: List<String>,
val timestamp: String,
val webView: String,
val customTab: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class AnrOfflinePixelSender @Inject constructor(
mapOf(
ANR_STACKTRACE to ss,
ANR_WEBVIEW_VERSION to it.webView,
ANR_CUSTOM_TAB to it.customTab.toString(),
),
mapOf(),
COUNT,
Expand All @@ -58,6 +59,7 @@ class AnrOfflinePixelSender @Inject constructor(
companion object {
const val ANR_STACKTRACE = "stackTrace"
const val ANR_WEBVIEW_VERSION = "webView"
const val ANR_CUSTOM_TAB = "customTab"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.os.Debug
import android.os.Handler
import android.os.Looper
import com.duckduckgo.app.anrs.store.AnrsDatabase
import com.duckduckgo.app.browser.customtabs.CustomTabDetector
import com.duckduckgo.browser.api.BrowserLifecycleObserver
import com.duckduckgo.browser.api.WebViewVersionProvider
import com.duckduckgo.di.scopes.AppScope
Expand Down Expand Up @@ -59,6 +60,7 @@ internal fun Any.notifyAll() = (this as Object).notifyAll()

class AnrSupervisorRunnable @Inject constructor(
private val webViewVersionProvider: WebViewVersionProvider,
private val customTabDetector: CustomTabDetector,
anrsDatabase: AnrsDatabase,
) : Runnable {

Expand Down Expand Up @@ -89,9 +91,9 @@ class AnrSupervisorRunnable @Inject constructor(
logcat { "UI Thread responded within ${ANR_THRESHOLD_MILLIS}ms" }
} else {
val e = AnrException(handler.looper.thread)
logcat { "ANR Detected: ${e.threadStateMap}" }
logcat { "In custom tab: ${customTabDetector.isCustomTab()}. ANR Detected: ${e.threadStateMap}." }

anrDao.insert(e.asAnrData(webViewVersionProvider.getFullVersion()).asAnrEntity())
anrDao.insert(e.asAnrData(webViewVersionProvider.getFullVersion(), customTabDetector.isCustomTab()).asAnrEntity())

// wait until thread responds again
callback.wait()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class CrashOfflinePixelSender @Inject constructor(
EXCEPTION_APP_VERSION to exception.version,
EXCEPTION_TIMESTAMP to exception.timestamp,
EXCEPTION_WEBVIEW_VERSION to webViewVersionProvider.getFullVersion(),
EXCEPTION_CUSTOM_TAB to exception.customTab.toString(),
)

if (isVerifiedPlayStoreInstall()) {
Expand Down Expand Up @@ -88,5 +89,6 @@ class CrashOfflinePixelSender @Inject constructor(
private const val EXCEPTION_APP_VERSION = "v"
private const val EXCEPTION_TIMESTAMP = "t"
private const val EXCEPTION_WEBVIEW_VERSION = "webView"
private const val EXCEPTION_CUSTOM_TAB = "customTab"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ internal data class AnrData(
val stackTrace: ArrayList<String>,
val timeStamp: String = FORMATTER_SECONDS.format(LocalDateTime.now()),
val webView: String,
val customTab: Boolean,
)

internal fun AnrData.asAnrEntity(): AnrEntity {
Expand All @@ -50,24 +51,27 @@ internal fun AnrData.asAnrEntity(): AnrEntity {
stackTrace = stackTrace,
timestamp = timeStamp,
webView = webView,
customTab = customTab,
)
}

internal fun Throwable.asAnrData(webView: String): AnrData {
internal fun Throwable.asAnrData(webView: String, customTab: Boolean): AnrData {
return AnrData(
name = this.toString().replace(": $message", "", true),
message = message,
stackTrace = stackTrace.asStringArray(),
file = stackTrace.getOrNull(0)?.fileName,
lineNumber = stackTrace.getOrNull(0)?.lineNumber ?: Int.MIN_VALUE,
webView = webView,
customTab = customTab,
)
}

internal fun CrashLogger.Crash.asCrashEntity(
appVersion: String,
processName: String,
webView: String,
customTab: Boolean,
): ExceptionEntity {
val timestamp = FORMATTER_SECONDS.format(LocalDateTime.now())
val stacktrace = this.t.asLog().sanitizeStackTrace()
Expand All @@ -80,6 +84,7 @@ internal fun CrashLogger.Crash.asCrashEntity(
version = appVersion,
timestamp = timestamp,
webView = webView,
customTab = customTab,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ private fun AnrEntity.asAnr(): Anr {
stackTrace = stackTrace,
timestamp = timestamp,
webView = webView,
customTab = customTab,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.duckduckgo.app.anr

import com.duckduckgo.anrs.api.CrashLogger
import com.duckduckgo.app.anrs.store.UncaughtExceptionDao
import com.duckduckgo.app.browser.customtabs.CustomTabDetector
import com.duckduckgo.app.di.ProcessName
import com.duckduckgo.appbuildconfig.api.AppBuildConfig
import com.duckduckgo.browser.api.WebViewVersionProvider
Expand All @@ -31,11 +32,19 @@ class RealCrashLogger @Inject constructor(
private val appBuildConfig: AppBuildConfig,
private val uncaughtExceptionDao: UncaughtExceptionDao,
private val webViewVersionProvider: WebViewVersionProvider,
private val customTabDetector: CustomTabDetector,
@ProcessName private val processName: String,
) : CrashLogger {
override fun logCrash(crash: CrashLogger.Crash) {
checkMainThread()

uncaughtExceptionDao.add(crash.asCrashEntity(appBuildConfig.versionName, processName, webViewVersionProvider.getFullVersion()))
uncaughtExceptionDao.add(
crash.asCrashEntity(
appBuildConfig.versionName,
processName,
webViewVersionProvider.getFullVersion(),
customTabDetector.isCustomTab(),
),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ data class AnrEntity(
val stackTrace: List<String>,
val timestamp: String,
val webView: String,
val customTab: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.squareup.moshi.Types.newParameterizedType

@Database(
exportSchema = true,
version = 2,
version = 3,
entities = [AnrEntity::class],
)
@TypeConverters(AnrTypeConverter::class)
Expand All @@ -38,14 +38,21 @@ abstract class AnrsDatabase : RoomDatabase() {
companion object {

private val MIGRATION_1_TO_2: Migration = object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE `anr_entity` ADD COLUMN `webView` TEXT NOT NULL DEFAULT \"unknown\"")
override fun migrate(db: SupportSQLiteDatabase) {
db.execSQL("ALTER TABLE `anr_entity` ADD COLUMN `webView` TEXT NOT NULL DEFAULT \"unknown\"")
}
}

private val MIGRATION_2_TO_3: Migration = object : Migration(1, 2) {
override fun migrate(db: SupportSQLiteDatabase) {
db.execSQL("ALTER TABLE `anr_entity` ADD COLUMN `customTab` TEXT NOT NULL DEFAULT \"false\"")
}
}

val ALL_MIGRATIONS: List<Migration>
get() = listOf(
MIGRATION_1_TO_2,
MIGRATION_2_TO_3,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase

@Database(
exportSchema = true,
version = 2,
version = 3,
entities = [ExceptionEntity::class],
)
abstract class CrashDatabase : RoomDatabase() {
Expand All @@ -32,14 +32,21 @@ abstract class CrashDatabase : RoomDatabase() {
companion object {

private val MIGRATION_1_TO_2: Migration = object : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE `uncaught_exception_entity` ADD COLUMN `webView` TEXT NOT NULL DEFAULT \"unknown\"")
override fun migrate(db: SupportSQLiteDatabase) {
db.execSQL("ALTER TABLE `uncaught_exception_entity` ADD COLUMN `webView` TEXT NOT NULL DEFAULT \"unknown\"")
}
}

private val MIGRATION_2_TO_3: Migration = object : Migration(1, 2) {
override fun migrate(db: SupportSQLiteDatabase) {
db.execSQL("ALTER TABLE `uncaught_exception_entity` ADD COLUMN `customTab` TEXT NOT NULL DEFAULT \"false\"")
}
}

val ALL_MIGRATIONS: List<Migration>
get() = listOf(
MIGRATION_1_TO_2,
MIGRATION_2_TO_3,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ data class ExceptionEntity(
val version: String,
val timestamp: String,
val webView: String,
val customTab: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ package com.duckduckgo.anvil.annotations
import kotlin.reflect.KClass

/**
* Anvil annotation to generate and contribute the Map<ActivityParams, Class<ActivityParams>> to the activity starter
* Anvil annotation to generate and contribute the Map<ActivityParams, Class<ActivityParams>> to the activity starter.
* It is also possible to define a [screenName], that can be used to deeplink to a screen from RMF.
*
* The [screenName] should be named as [feature].<screenName>. For instance, for the VPN feature has many sub-screens, eg. main, settings and so
* they could be named "vpn.main", "vpn.settings" etc.
* Not all screens will have a parent feature, for instance the main settings screen would be named just "settings"
*
* Usage:
* ```kotlin
* @ContributeToActivityStarter(ExampleActivityParams::class)
* @ContributeToActivityStarter(ExampleActivityParams::class, screenName = "example")
* class MyActivity {
*
* }
Expand Down
Loading

0 comments on commit d77b2c7

Please sign in to comment.