Skip to content

android: Determine default config dir and lower minSdk - #46142

Merged
yezhizhen merged 1 commit into
servo:mainfrom
jschwe:android_crash_investigation2
Jul 1, 2026
Merged

android: Determine default config dir and lower minSdk#46142
yezhizhen merged 1 commit into
servo:mainfrom
jschwe:android_crash_investigation2

Conversation

@jschwe

@jschwe jschwe commented Jul 1, 2026

Copy link
Copy Markdown
Member

Android 33+ sets the TMPDIR environment variable, but on older versions it's unset. This leads to a crash on older android versions where the fallback is outside the app sandbox (/data/local/tmp).
This allows us to lower the minSdk version and probably the default config directory should never have been TMPDIR in the first place, since that's not persistent.
I tested with a Pixel 4 emulator API-29, and servoshell seems to work fine. However, our current build system uses API-30 NDK, so for now we just restore API-30 support. A follow-up PR could choose a lower NDK version, and thus lower our minSDK version further. But ideally we add CI testing first.

This PR effectively reverts #46104 and fixes the crash on older devices.

Testing: We don't have automatic tests for android in CI.
Fixes: #46115

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 1, 2026
Android 33+ sets the TMPDIR environment variable, but on older versions
it's unset. This leads to a crash on older android versions where the
fallback is outside the app sandbox (/data/local/tmp).
This allows us to lower the minSdk version. I tested with a Pixel 4
emulator API-29, and servoshell seems to work fine.
According to https://apilevels.com/ API-29 covers 91% of devices, so
it seems reasonable to lower the api level to this for now.
After we add emulator testing to CI, we could lower this further.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
@jschwe
jschwe force-pushed the android_crash_investigation2 branch from 1f32266 to dcf7432 Compare July 1, 2026 07:38
@jschwe
jschwe requested a review from mukilan July 1, 2026 07:39
@jschwe

jschwe commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Note: I'm pretty unfamiliar with JNI in general, so ideally someone more familiar with JNI reviews this, perhaps @mukilan?

@jschwe

jschwe commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

CC @yezhizhen I only tested on emulator, but you have a real android 12 device, right?

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Jul 1, 2026
@yezhizhen yezhizhen added the T-android Do a try run on Android label Jul 1, 2026
@github-actions github-actions Bot removed the T-android Do a try run on Android label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

🔨 Triggering try run (#28505114509) for Android

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

✨ Try run (#28505114509) succeeded.

@yezhizhen yezhizhen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC @yezhizhen I only tested on emulator, but you have a real android 12 device, right?

Now works on my specific device that used to crash.

@yezhizhen
yezhizhen added this pull request to the merge queue Jul 1, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 1, 2026
Merged via the queue into servo:main with commit bda3700 Jul 1, 2026
44 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: Support older android versions (e.g. android 11, 12)

4 participants