android / android/android-test

Activity Scenario `launch` function in the `1.5.0-alpha02` release sets flags on passed in Intent

Open
#1,494 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
11h 29m
Merged PRs (30d)
2

Description

### Description
In the Navigation library of AndroidX there are [tests](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt;l=556?q=testNavigateViaImplicitDeepLink&ss=androidx%2Fplatform%2Fframeworks%2Fsupport) that use the `ActivityScenario.launch(Intent)` function in order to start an activity in the test environment. When upgrading to `androidx.test:core:1.5.0-alpha02` those tests started to fail and after investigation it was found that the new `launch` function caused [this check](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt;l=1272?q=handleDeepLink&ss=androidx%2Fplatform%2Fframeworks%2Fsupport) in Navigation to be true. In a real world scenario, the flag is not set unless done so explicitly by the user.

### Steps to Reproduce

Launch an activity from an intent using the `launch` function and check the flags of the activity's intent.

### Expected Results

Either no extras flags are set on the intent, or the same flags that used to be set are still set.

### Actual Results

New flag is set on the intent.

### AndroidX Test and Android OS Versions

1.5.0-alpha02 and API 29 (but fails on all of them)

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by launching an activity with ActivityScenario.launch(Intent) and inspect the resulting intent flags. Compare the behavior in androidx.test:core:1.5.0-alpha02 with the previous release, using the linked NavControllerRouteTest.kt and NavController.kt checks to confirm the unintended flag is no longer set. Done means launch preserves the prior flags or leaves them unset unless explicitly provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.