Skip to content

Android compat: document intents via native file dialogs; iOS background execution guide - #6130

Merged
shai-almog merged 3 commits into
masterfrom
android-compat-document-intents
Oct 29, 2026
Merged

shai-almog merged 3 commits into
masterfrom
android-compat-document-intents

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Addresses discussion #6127.

Document intents. `ACTION_OPEN_DOCUMENT`, `ACTION_CREATE_DOCUMENT` and non-media `ACTION_GET_CONTENT` threw `ActivityNotFoundException`. They now open `Display.showOpenDialog` / `showSaveDialog` and return through `onActivityResult` (activities and fragments) and the AndroidX contracts (`OpenDocument`, `OpenMultipleDocuments`, `CreateDocument`, `GetMultipleContents`; non-media `GetContent`). Adds `ClipData`, `Intent.get/setClipData`, `ContentResolver.openOutputStream(uri, mode)` and no-op persistable URI permissions.

`CREATE_DOCUMENT` cannot match Android on iOS, where the picker only exports an existing file: the app gets a staged file at once, and closing the stream it wrote shows the Save dialog. Documented in the class and the guide.

Guide. New "Opening and creating documents" and "Background execution on iOS" sections in `Android-Interop.asciidoc`, mapping foreground services, background location (already wired: manifest -> `location` background mode -> `allowsBackgroundLocationUpdates`) and WorkManager to iOS behaviour, with porting advice.

Tests: `DocumentIntentsTest` (8) on new `HeadlessImplementation` dialog hooks; android-compat suite 599/599, SpotBugs 0, cast-semantics clean.

🤖 Generated with Claude Code

shai-almog and others added 3 commits October 29, 2026 04:30
…und guide

ACTION_OPEN_DOCUMENT, ACTION_CREATE_DOCUMENT and non-media GET_CONTENT
threw ActivityNotFoundException. They now open Display.showOpenDialog /
showSaveDialog and return through onActivityResult and the AndroidX
contracts (OpenDocument, OpenMultipleDocuments, CreateDocument,
GetMultipleContents). Adds ClipData, persistable-permission no-ops and
openOutputStream(uri, mode).

The developer guide gains a section mapping Android foreground services,
background location and WorkManager to iOS behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Encode-safe staging names, async CREATE_DOCUMENT result, staging cleanup,
safe append mode, wildcard filters; guide no longer states an unverified
background window length.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ancelled save

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: No alerts found (report)
  • Paragraph capitalization: No paragraph capitalization issues (report)
  • LanguageTool: No grammar matches (report)
  • Image references: No unused images detected (report)

@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare Preview

@github-actions

Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ✅ ByteCodeTranslator: 0 findings (no issues)
    • ✅ android: 0 findings (no issues)
    • ✅ android-compat: 0 findings (no issues)
    • ✅ android-res-compiler: 0 findings (no issues)
    • ✅ backend: 0 findings (no issues)
    • ✅ backend-test: 0 findings (no issues)
    • ✅ build-engine: 0 findings (no issues)
    • ✅ build-hint-catalog: 0 findings (no issues)
    • ✅ build-hint-tools: 0 findings (no issues)
    • ✅ codenameone-gradle-plugin: 0 findings (no issues)
    • ✅ codenameone-maven-plugin: 0 findings (no issues)
    • ✅ core-unittests: 0 findings (no issues)
    • ✅ desktop-compat-runtime: 0 findings (no issues)
    • ✅ fxml-compiler: 0 findings (no issues)
    • ✅ ios: 0 findings (no issues)
    • ✅ javac: 0 findings (no issues)
    • ✅ javafx-compat: 0 findings (no issues)
    • ✅ project-model: 0 findings (no issues)
    • ✅ swing-compat: 0 findings (no issues)
  • ✅ PMD: 0 findings (no issues) [Report archive]
  • ✅ Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog

shai-almog commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 191 screenshots: 191 matched.

Native Android coverage

  • 📊 Line coverage: 18.89% (48254/255442 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 17.63% (229194/1300322), branch 12.03% (16820/139781), complexity 9.67% (12913/133522), method 14.57% (9123/62602), class 25.09% (1774/7070)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6356 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.ClassReader – 0.00% (0/1524 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.MethodWriter – 0.00% (0/922 lines covered)
      • kotlinx.coroutines.channels.kotlinx.coroutines.channels.BufferedChannel – 0.00% (0/832 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/735 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • okio.okio.Buffer – 0.00% (0/687 lines covered)
      • com.codename1.androidcompat.rt.com.codename1.androidcompat.rt.TextXmlPullParser – 0.00% (0/623 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 18.89% (48254/255442 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 17.63% (229194/1300322), branch 12.03% (16820/139781), complexity 9.67% (12913/133522), method 14.57% (9123/62602), class 25.09% (1774/7070)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6356 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.ClassReader – 0.00% (0/1524 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.MethodWriter – 0.00% (0/922 lines covered)
      • kotlinx.coroutines.channels.kotlinx.coroutines.channels.BufferedChannel – 0.00% (0/832 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/735 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • okio.okio.Buffer – 0.00% (0/687 lines covered)
      • com.codename1.androidcompat.rt.com.codename1.androidcompat.rt.TextXmlPullParser – 0.00% (0/623 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend scalar fallback (no native SIMD)
SIMD int-add (64K x300) java 170ms / native 109ms = 1.5x speedup
SIMD float-mul (64K x300) java 136ms / native 84ms = 1.6x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 87.000 ms
Base64 CN1 decode 84.000 ms
Base64 native encode 461.000 ms
Base64 encode ratio (CN1/native) 0.189x (81.1% faster)
Base64 native decode 277.000 ms
Base64 decode ratio (CN1/native) 0.303x (69.7% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog

shai-almog commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 227 screenshots: 227 matched.
✅ JavaScript-port screenshot tests passed.

@shai-almog

shai-almog commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 192 screenshots: 192 matched.
✅ Native Mac screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 564 seconds

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 63ms / native 3ms = 21.0x speedup
SIMD float-mul (64K x300) java 62ms / native 3ms = 20.6x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 49.000 ms
Base64 CN1 decode 58.000 ms
Image encode benchmark iterations 100
Image createMask (SIMD off) 10.000 ms
Image createMask (SIMD on) 4.000 ms
Image createMask ratio (SIMD on/off) 0.400x (60.0% faster)
Image applyMask (SIMD off) 86.000 ms
Image applyMask (SIMD on) 69.000 ms
Image applyMask ratio (SIMD on/off) 0.802x (19.8% faster)
Image modifyAlpha (SIMD off) 64.000 ms
Image modifyAlpha (SIMD on) 49.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.766x (23.4% faster)
Image modifyAlpha removeColor (SIMD off) 55.000 ms
Image modifyAlpha removeColor (SIMD on) 46.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.836x (16.4% faster)

ParparVM vs HotSpot (JDK 25): macOS arm64

Runner CPU: Apple M1 (Virtual) (baseline macos-arm64)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A ratio more than 20% (time) / 25% (RAM) above its baseline in vm/selfhost/perf-baseline/ is a regression and fails; one that far below is an improvement, reported but not failed (a row whose calibration runs were noisier carries a wider tolerance), and for RAM the change must also exceed 0.05x in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (HelloCodenameOne) 3 0.80x (base 0.96x, -16.9%) 0.88x (base 0.93x, -4.7%) ok
translator (self) 3 0.62x (base 0.62x, -0.7%) 0.78x (base 0.78x, -0.1%) ok
intArithmetic 3 1.02x (base 1.03x, -1.5%) 0.12x (base 0.12x, +1.5%) ok
longArithmetic 3 1.05x (base 1.03x, +2.3%) 0.12x (base 0.07x, +64.4%) ok
mathTranscendental 3 1.00x (base 1.01x, -0.8%) 0.12x (base 0.12x, +0.4%) ok
arraySequential 3 0.46x (base 0.42x, +9.4%) 0.53x (base 0.53x, +0.3%) ok
arrayRandom 3 0.97x (base 0.99x, -1.8%) 0.33x (base 0.32x, +0.5%) ok
objectAllocation 3 1.03x (base 1.11x, -6.6%) 0.95x (base 0.72x, +31.8%) ok
valueEscape 3 0.52x (base 0.51x, +3.3%) 0.09x (base 0.09x, +1.4%) ok
hashMapChurn 3 1.00x (base 1.18x, -14.8%) 0.08x (base 0.07x, +14.0%) ok
stringBuilding 3 0.88x (base 0.84x, +5.0%) 0.46x (base 0.46x, -1.5%) ok
recursion 3 1.26x (base 1.24x, +2.1%) 0.12x (base 0.12x, +0.7%) ok
quicksort 3 0.99x (base 1.01x, -2.1%) 0.11x (base 0.11x, +1.6%) ok

Result: no regression

@shai-almog

shai-almog commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 184 screenshots: 184 matched.
✅ Native Apple TV (tvOS, Metal) screenshot tests passed.

@shai-almog

shai-almog commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 189 screenshots: 189 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 1919 seconds

Build and Run Timing

Metric Duration
Simulator Boot 50000 ms
Simulator Boot (Run) 1000 ms
App Install 13000 ms
App Launch 2000 ms
Test Execution 430000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 172ms / native 3ms = 57.3x speedup
SIMD float-mul (64K x300) java 212ms / native 9ms = 23.5x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 92.000 ms
Base64 CN1 decode 57.000 ms
Base64 native encode 1469.000 ms
Base64 encode ratio (CN1/native) 0.063x (93.7% faster)
Base64 native decode 1141.000 ms
Base64 decode ratio (CN1/native) 0.050x (95.0% faster)
Base64 SIMD encode 77.000 ms
Base64 encode ratio (SIMD/CN1) 0.837x (16.3% faster)
Base64 SIMD decode 100.000 ms
Base64 decode ratio (SIMD/CN1) 1.754x (75.4% slower)
Base64 encode ratio (SIMD/native) 0.052x (94.8% faster)
Base64 decode ratio (SIMD/native) 0.088x (91.2% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 14.000 ms
Image createMask (SIMD on) 365.000 ms
Image createMask ratio (SIMD on/off) 26.071x (2507.1% slower)
Image applyMask (SIMD off) 54.000 ms
Image applyMask (SIMD on) 33.000 ms
Image applyMask ratio (SIMD on/off) 0.611x (38.9% faster)
Image modifyAlpha (SIMD off) 297.000 ms
Image modifyAlpha (SIMD on) 31.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.104x (89.6% faster)
Image modifyAlpha removeColor (SIMD off) 85.000 ms
Image modifyAlpha removeColor (SIMD on) 35.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.412x (58.8% faster)

@shai-almog

shai-almog commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 249 screenshots: 249 matched.
✅ Native Apple Watch (watchOS, Core Graphics) screenshot tests passed.

@shai-almog
shai-almog merged commit 93cf33f into master Oct 29, 2026
44 of 47 checks passed
@shai-almog
shai-almog deleted the android-compat-document-intents branch October 29, 2026 12:34
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.

1 participant