Skip to content

Add experimental Android 11 compatibility - #46

Open
ShawnXxy wants to merge 2 commits into
NightMean:mainfrom
ShawnXxy:shawnx-android-11-compatibility
Open

ShawnXxy wants to merge 2 commits into
NightMean:mainfrom
ShawnXxy:shawnx-android-11-compatibility

Conversation

@ShawnXxy

Copy link
Copy Markdown

Breaking change

No intended breaking change. Android 11 support is experimental; Android 12+ remains recommended.

Proposed change

Allow installation on Android 11 without changing the inference runtime or build toolchain.

  • Lower minSdk from 31 to 30; keep compileSdk 36, targetSdk 35, and LiteRT-LM 0.16.1 unchanged.
  • Guard Android 12+ SoC metadata reads. Older devices use an unknown SoC rather than guessing NPU compatibility; generic CPU/GPU model selection remains available.
  • Start downloads below API 33 without consulting the notification runtime permission, including when app notifications are disabled. Apply the platform guard to completion notifications too; retain the Android 13+ permission flow.
  • Add API 30/31 instrumented coverage, JVM regressions, flavor-aware preference assertions, and physical-device acceptance documentation.

This is the Android compatibility portion of #42, rebuilt directly on upstream main at b49ca661. It contains no ModelScope fallback, root Gradle entry point, AGP/Gradle/JDK upgrade, or application-version change. Upstream's relocated instrumented tests and 0.9.7 version are preserved.

Screenshots

N/A. No new UI is introduced.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements or tests
  • Dependency upgrade
  • Documentation

Additional information

Independent branch validation used upstream's AGP 9.2.0 and Gradle 9.4.1:

  • testDevDebugUnitTest and testStableDebugUnitTest: each completed with 1,567 passed, 1 skipped, and no failures.
  • lintDevDebug and lintStableDebug: no errors. No new development-variant lint findings compared with a clean upstream build.
  • Development and stable Android-test sources compiled. The API 30/31 device tests were not executed locally during this split.
  • assembleDevDebug passed; the APK declares minimum API 30, target API 35, and ARM64.

A Windows sharing lock on an existing generated JAR required session-only validation output directories. No build-directory override or tooling workaround is included in this PR.

Earlier testing on a physical Smartisan Android 11 device demonstrated text serving with Gemma-4-E4B-it, including streaming, Chinese text, conversation history, error handling, and recovery after an interrupted stream. That was the combined development build, not this standalone APK. Vision/audio, background serving, broader device coverage, and the new permission flow still need on-device acceptance.

The notification review finding from #42 is addressed here. AndroidX maps POST_NOTIFICATIONS checks to app notification settings below API 33; the previous flow could therefore stall a download when notifications were disabled. Regression tests cover API 30, 31, 32, 33, and 34 behavior.

Checklist

  • The code compiles without errors (./gradlew :app:compileStableDebugKotlin)
  • The change is tested and works locally on a real device or emulator
  • No new warnings from ./gradlew lint
  • There is no commented out code in this PR
  • Existing functionality is not broken

The unchecked items retain the remaining acceptance work: this standalone APK has not been exercised on a device, aggregate lint was not run, and the automated checks do not establish compatibility on every supported device.

Lower the app minimum to API 30 while retaining compileSdk 36, targetSdk 35, and LiteRT-LM 0.16.1. Guard Android 12 SoC metadata and preserve generic CPU/GPU model selection on older devices.

Start downloads below API 33 without checking the runtime notification permission, even when app notifications are disabled. Apply the same platform guard to completion notifications and cover the API 30-34 boundary.

Add API 30/31 instrumented coverage, flavor-aware preference assertions, JVM regressions, and physical-device acceptance documentation. Keep upstream build tooling, source layout, and application version unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 23, 2026 05:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Three moderate findings, one nit, and incomplete API 30/31 device acceptance require final human review.

Review effort: Lite
Findings: None

What changed in this PR

Adds experimental Android 11/API 30 compatibility without changing the inference runtime or build toolchain.

Changes:

  • Lowers minSdk to 30 and guards SoC and notification APIs.
  • Adds JVM/instrumented tests and API 30/31 CI coverage.
  • Updates compatibility, build, and troubleshooting documentation.
File Summary Review note
README.md Documents Android 11 support. No additional finding.
docs/​TROUBLESHOOTING.md Adds Android 11 guidance. No additional finding.
docs/​SDK_COMPATIBILITY.md Records runtime compatibility evidence. No additional finding.
docs/​FAQ.md Updates platform requirements. No additional finding.
docs/​BUILDING.md Adds build and device acceptance instructions. Nit (1 vote): Qualify completion-notification checks when notifications are disabled.
docs/​ARCHITECTURE.md Documents the compatibility boundary. No additional finding.
Android/​src/​app/​src/​test/​java/​com/​ollitert/​llm/​server/​ui/​modelmanager/​AllowlistLoadCoordinatorTest.kt Tests unknown-SoC filtering. No additional finding.
Android/​src/​app/​src/​test/​java/​com/​ollitert/​llm/​server/​ui/​common/​DownloadNotificationPermissionTest.kt Tests notification behavior across API levels. No additional finding.
Android/​src/​app/​src/​test/​java/​com/​ollitert/​llm/​server/​data/​allowlist/​ModelAllowlistJsonTest.kt Tests generic artifact selection. Moderate (1 vote): Pass an explicit unknown SoC to avoid dependence on process-wide SOC.
Android/​src/​app/​src/​test/​java/​com/​ollitert/​llm/​server/​common/​DeviceUtilsTest.kt Tests JVM SoC fallback behavior. No additional finding.
Android/​src/​app/​src/​main/​java/​com/​ollitert/​llm/​server/​ui/​common/​UiUtils.kt Adjusts notification permission flow. No additional finding.
Android/​src/​app/​src/​main/​java/​com/​ollitert/​llm/​server/​runtime/​GpuAvailability.kt Uses guarded SoC diagnostics. No additional finding.
Android/​src/​app/​src/​main/​java/​com/​ollitert/​llm/​server/​data/​repository/​DownloadRepository.kt Guards completion notifications. Moderate (1 vote): Add focused coverage for the sendNotification API guard.
Android/​src/​app/​src/​main/​java/​com/​ollitert/​llm/​server/​common/​DeviceUtils.kt Guards SoC and notification APIs. No additional finding.
Android/​src/​app/​src/​androidTest/​java/​com/​ollitert/​llm/​server/​DeviceCompatibilityTest.kt Adds API 30/31 compatibility checks. No additional finding.
Android/​src/​app/​src/​androidTest/​java/​com/​ollitert/​llm/​server/​data/​prefs/​ServerPrefsTest.kt Makes preference assertions flavor-aware. No additional finding.
Android/​src/​app/​build.gradle.kts Lowers the minimum SDK to 30. No additional finding.
.github/​workflows/​instrumented-tests.yml Adds API 30/31 instrumented-test coverage. Moderate (1 vote): Trigger the matrix for model_allowlists/** changes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Cover repository completion notifications across simulated API 30-34, including denied/granted permission, failure status, cancellation, foreground transitions, and observer cleanup. Keep the injected constructor and runtime SDK default unchanged.

Use an explicit unknown SoC in the allowlist regression, trigger emulator tests for allowlist changes, and qualify notification visibility in the device checklist.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 23, 2026 09:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

One or more issues must be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)

PendingIntent::class,
Uri::class,
)
mockkConstructor(NotificationCompat.Builder::class)
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.

2 participants