Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/integration-tests-ui-critical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,7 @@ jobs:
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: AVD cache
uses: actions/cache@v5
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-api-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }}

- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # pin@v2
with:
api-level: ${{ matrix.api-level }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0131)
- [diff](https://github.com/getsentry/sentry-native/compare/0.12.7...0.13.1)

### Internal

- Check notification permission before launching request to fix flaky API 34 tests ([#5146](https://github.com/getsentry/sentry-java/pull/5146))

## 8.33.0

### Features
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
platform:
android:
disableAnimations: true
onFlowStart:
# Dismiss any ANR dialog (e.g. "Pixel Launcher isn't responding")
- runFlow:
when:
visible: "Close app"
commands:
- tapOn: "Close app"
# Close notification shade if left open from a previous test
- pressKey: back
- pressKey: home
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ name: App Start Tests
all: allow
- assertVisible: "Welcome!"
- tapOn: "Trigger Notification"
# Grant notification permission if the system dialog appears
- runFlow:
when:
visible: "Allow"
commands:
- tapOn: "Allow"
- tapOn: "Finish Activity"
- assertNotVisible: "Welcome!"
- waitForAnimationToEnd
Expand All @@ -45,6 +51,12 @@ name: App Start Tests
all: allow
- assertVisible: "Welcome!"
- tapOn: "Trigger Notification"
# Grant notification permission if the system dialog appears
- runFlow:
when:
visible: "Allow"
commands:
- tapOn: "Allow"
- tapOn: "Finish Activity"
- assertNotVisible: "Welcome!"
- killApp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.sentry.uitest.android.critical

import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.widget.Toast
Expand All @@ -22,6 +23,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
import io.sentry.Sentry
import io.sentry.android.core.performance.AppStartMetrics
import io.sentry.uitest.android.critical.NotificationHelper.showNotification
Expand Down Expand Up @@ -82,7 +84,13 @@ class MainActivity : ComponentActivity() {
Button(onClick = { finish() }) { Text("Finish Activity") }
Button(
onClick = {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
ContextCompat.checkSelfPermission(
this@MainActivity,
android.Manifest.permission.POST_NOTIFICATIONS,
) != PackageManager.PERMISSION_GRANTED
) {
requestPermissionLauncher.launch(android.Manifest.permission.POST_NOTIFICATIONS)
} else {
postNotification()
Expand All @@ -91,6 +99,9 @@ class MainActivity : ComponentActivity() {
) {
Text("Trigger Notification")
}
Button(onClick = { android.os.Process.killProcess(android.os.Process.myPid()) }) {
Text("Kill Process")
}
Button(
onClick = {
startActivity(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ object NotificationHelper {
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

// Create notification channel for Android 8.0+ (API 26+)
// Delete first to ensure the channel is recreated with the correct importance,
// since Android preserves channel settings across app reinstalls (adb install -r).
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationManager.deleteNotificationChannel(CHANNEL_ID)
val channel =
NotificationChannel(CHANNEL_ID, "Notifications", NotificationManager.IMPORTANCE_DEFAULT)
channel.description = "description"
Expand Down
Loading