android / android/testing-samples

The launcher name on Android 11 is returned as com.android.settings instead of the actual launcher package name

Open
#348 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
9.3k
Forks
3.6k
PR merge metrics
No merged PRs in 30d

Description

`getLauncherPackagename()` returns `com.android.settings`. So `mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT);` doesn't really wait for the launcher package.
I believe this is due to the package visibility changes on Android 11.

Our test setup consisted of this check before starting with the tests:
`String currentPackageName = device.getCurrentPackageName();
if (currentPackageName != null) {
assertEquals(packageName, currentPackageName);
}`

This failed as currentPackageName returned as `com.google.android.apps.nexuslauncher` and getLauncherPackagename() returned `com.android.settings`.

Contributor guide

Open the contributing guide

Research direction

Start by tracing getLauncherPackagename() and the mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT) call, then reproduce the setup check using device.getCurrentPackageName() on Android 11. Done means the launcher package is identified as the actual launcher rather than com.android.settings and the wait targets that package.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.