Skip to content

Add e-ink mode with device detection#22663

Open
jkmassel wants to merge 7 commits intotrunkfrom
jkmassel/ereader-support
Open

Add e-ink mode with device detection#22663
jkmassel wants to merge 7 commits intotrunkfrom
jkmassel/ereader-support

Conversation

@jkmassel
Copy link
Contributor

@jkmassel jkmassel commented Mar 7, 2026

Description

Adds e-ink mode support for e-reader devices (Onyx BOOX, PocketBook, Kobo, reMarkable, etc.). When enabled, the app disables all animations for faster screen refreshes and forces light mode.

Key changes:

  • E-ink device detection (EinkDeviceDetector): Checks Build.MANUFACTURER, Build.BRAND, and Build.MODEL against a list of known e-ink devices sourced from KOReader's device database. Handles dual-use manufacturers (e.g. Hisense, Xiaomi) by requiring model pattern matches.
  • Auto-detection prompt: On first launch, if an e-ink device is detected, a dialog prompts the user to enable e-ink mode. The prompt only shows once.
  • E-ink color scheme (colorSchemeEink): A dedicated Material 3 color scheme optimized for e-ink displays. Forces light mode when active.
  • Animation suppression: All AniUtils animations skip to their end state immediately. Activity transitions are disabled via BaseAppCompatActivity.
  • Settings toggle: "E-ink mode (Beta)" switch in App Settings for manual enable/disable.
  • Device Info screen: New Compose screen accessible from Help & Support showing device build properties and whether the device matches the e-reader list. Includes a "Copy to Clipboard" button for easy bug reporting.
  • Analytics: Tracks EINK_PROMPT_SHOWN, EINK_PROMPT_ACCEPTED, EINK_PROMPT_DISMISSED, and APP_SETTINGS_EINK_MODE_CHANGED.

Testing instructions

E-ink auto-detection prompt:

  1. Install the app on an e-ink device (or modify EinkDeviceDetector to return true for your device – this is the more likely testing flow)
  2. Launch the app for the first time
  • Verify a dialog appears with title "E-ink display detected"
  1. Tap "Enable"
  • Verify the app recreates with e-ink mode active and no animations
  1. Force stop and relaunch the app
  • Verify the prompt does not appear again

Manual toggle:

  1. Go to Me → App Settings
  • Verify "E-ink mode (Beta)" toggle is visible
  1. Enable the toggle
  • Verify the app recreates with e-ink mode active
  • Verify no animations occur when navigating between screens
  • Verify dark mode is ignored (always light)
  1. Disable the toggle
  • Verify normal colors and animations return

Device Info screen:

  1. Go to Me → Help & Support
  • Verify "Device Info" button is visible below "Application Log"
  1. Tap "Device Info"
  • Verify the screen shows Application, Device, and Android sections
  • Verify "Matches known E-reader list" shows "Yes" or "No" correctly
  1. Tap "Copy to Clipboard"
  • Verify a toast confirms the copy and the clipboard contains the device info text

🤖 Generated with Claude Code

@dangermattic
Copy link
Collaborator

dangermattic commented Mar 7, 2026

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Mar 7, 2026

Project manifest changes for WordPress

The following changes in the WordPress's merged AndroidManifest.xml file were detected (build variant: jetpackVanillaRelease):

--- ./build/reports/diff_manifest/WordPress/jetpackVanillaRelease/base_manifest.txt	2026-03-09 01:46:28.447486398 +0000
+++ ./build/reports/diff_manifest/WordPress/jetpackVanillaRelease/head_manifest.txt	2026-03-09 01:46:31.357493933 +0000
@@ -478,6 +478,10 @@
             android:label="@string/help_buttons_screen_title"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
+            android:name="org.wordpress.android.ui.accounts.DeviceInfoActivity"
+            android:label="@string/device_info_title"
+            android:theme="@style/WordPress.NoActionBar" />
+        <activity
             android:name="org.wordpress.android.ui.main.feedbackform.FeedbackFormActivity"
             android:label="@string/feedback_form_title"
             android:theme="@style/WordPress.NoActionBar" />

Go to https://buildkite.com/automattic/wordpress-android/builds/25357/canvas?sid=019cd03c-fc38-4ac1-9428-e9a7e8378cb1, click on the Artifacts tab and audit the files.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Mar 7, 2026

Project manifest changes for WordPress

The following changes in the WordPress's merged AndroidManifest.xml file were detected (build variant: wordpressVanillaRelease):

--- ./build/reports/diff_manifest/WordPress/wordpressVanillaRelease/base_manifest.txt	2026-03-09 01:46:07.456832046 +0000
+++ ./build/reports/diff_manifest/WordPress/wordpressVanillaRelease/head_manifest.txt	2026-03-09 01:46:10.416855979 +0000
@@ -284,6 +284,10 @@
             android:label="@string/help_buttons_screen_title"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
+            android:name="org.wordpress.android.ui.accounts.DeviceInfoActivity"
+            android:label="@string/device_info_title"
+            android:theme="@style/WordPress.NoActionBar" />
+        <activity
             android:name="org.wordpress.android.ui.main.feedbackform.FeedbackFormActivity"
             android:label="@string/feedback_form_title"
             android:theme="@style/WordPress.NoActionBar" />

Go to https://buildkite.com/automattic/wordpress-android/builds/25357/canvas?sid=019cd03c-fc37-437f-bcd0-fb55355bbbbc, click on the Artifacts tab and audit the files.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Mar 7, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr22663-4c3dfef
Build Number1486
Application IDorg.wordpress.android.prealpha
Commit4c3dfef
Installation URL04lpe0jnan3n8
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Mar 7, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr22663-4c3dfef
Build Number1486
Application IDcom.jetpack.android.prealpha
Commit4c3dfef
Installation URL7jp95o5irhai8
Note: Google Login is not supported on these builds.

@jkmassel jkmassel self-assigned this Mar 9, 2026
@jkmassel jkmassel added this to the 26.7 milestone Mar 9, 2026
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 171 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.99%. Comparing base (5c53a01) to head (4c3dfef).
⚠️ Report is 1 commits behind head on trunk.

Files with missing lines Patch % Lines
...ordpress/android/ui/accounts/DeviceInfoActivity.kt 0.00% 116 Missing ⚠️
...main/java/org/wordpress/android/util/AniUtils.java 0.00% 38 Missing ⚠️
.../java/org/wordpress/android/ui/prefs/AppPrefs.java 0.00% 5 Missing ⚠️
.../org/wordpress/android/ui/prefs/AppPrefsWrapper.kt 0.00% 4 Missing ⚠️
...a/org/wordpress/android/util/EinkDeviceDetector.kt 92.98% 4 Missing ⚠️
...n/java/org/wordpress/android/util/AppThemeUtils.kt 0.00% 3 Missing ⚠️
...wordpress/android/ui/main/BaseAppCompatActivity.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22663      +/-   ##
==========================================
- Coverage   38.01%   37.99%   -0.03%     
==========================================
  Files        2268     2270       +2     
  Lines      116720   116944     +224     
  Branches    16180    16199      +19     
==========================================
+ Hits        44376    44433      +57     
- Misses      68707    68874     +167     
  Partials     3637     3637              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jkmassel jkmassel requested review from adalpari and nbradbury March 9, 2026 04:30
@adalpari
Copy link
Contributor

adalpari commented Mar 9, 2026

5. Tap "Enable"

  • Verify the app recreates with the grayscale theme and no animations

Enabling the theme from the prompt does not relaunch the app. Manually relaunching the app is not showing the grayscale theme either.

Screen_recording_20260309_130528.mp4

@adalpari
Copy link
Contributor

adalpari commented Mar 9, 2026

5. Disable the toggle

  • Verify normal colors and animations return

Enabling and disabling the settings toggles is not taking any effect either

Screen_recording_20260309_131034.mp4

@adalpari
Copy link
Contributor

adalpari commented Mar 9, 2026

  1. Go to Me → Help & Support
  • Verify "Device Info" button is visible below "Application Log"

Should we include this in the new Modern Support screen as well?

@nbradbury
Copy link
Contributor

This dialog is quite wordy. I think we can get rid of "It looks like you might be using an e-reader" given the title says an E-ink display was detected.

e-dialog

Also, is "E-ink" the correct term? The website shows "E Ink" without the hyphen.

Like @adalpari I don't see the app immediately switch to grayscale but I do see Compose screens like the new post list graying out. XML screens do not show grayscale - given this PR adds a Compose theme, this makes sense but I'd think we'd want to handle XML screens

Even when grayscale appears to be applied it doesn't affect images (like featured images in the experimental post list). I'm not sure we can do anything about that but wanted to point it out. One possibility is to create a custom image components which automatically handle grayscale, but that would require changes to Coil, Glide, and FluxCImageLoader

gray

Since this is a beta feature, should it be moved from App Settings to Experimental Features?

settings

@jkmassel jkmassel changed the title Add e-ink mode with device detection and grayscale theme Add e-ink mode with device detection and optimized theme Mar 9, 2026
@jkmassel jkmassel changed the title Add e-ink mode with device detection and optimized theme Add e-ink mode with device detection Mar 9, 2026
jkmassel and others added 5 commits March 9, 2026 12:45
Adds e-ink support for Android e-readers (Onyx Boox, Kobo, etc.):

- Device detection using known manufacturer, brand, and model lists
- Grayscale Compose color scheme with forced light mode
- Animation disabling across all AniUtils methods and activity
  transitions
- Settings toggle in App Settings (marked Beta)
- Auto-detect prompt shown on first launch for detected e-ink devices
- Analytics tracking for prompt and settings interactions
- Preferences stored via AppPrefs (EINK_MODE_ENABLED,
  EINK_AUTO_DETECT_DONE)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a dedicated Device Info screen accessible from Help & Support
showing manufacturer, brand, model, Android version, SDK level, app
version, and e-ink detection status. Includes a copy-to-clipboard
button for sharing device details with support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add @nonnull to AniUtils.noopAnimator parameter
- Add @nullable to AppSettingsFragment.mEinkModePref field
- Hoist stringResource() before onClick lambda in DeviceInfoActivity
  to satisfy LocalContextGetResourceValueCall lint rule

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove empty line before closing brace in WPSwitchPreference
- Suppress ReturnCount for EinkDeviceDetector.isEinkDevice (early
  returns are clearer than alternatives for this detection logic)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jkmassel jkmassel force-pushed the jkmassel/ereader-support branch from df99684 to 1f464f6 Compare March 9, 2026 18:50
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Mar 9, 2026

Project manifest changes for WordPress

The following changes in the WordPress's merged AndroidManifest.xml file were detected (build variant: wordpressRelease):

--- ./build/reports/diff_manifest/WordPress/wordpressRelease/base_manifest.txt	2026-03-09 20:26:02.675949472 +0000
+++ ./build/reports/diff_manifest/WordPress/wordpressRelease/head_manifest.txt	2026-03-09 20:26:04.695954453 +0000
@@ -284,6 +284,10 @@
             android:label="@string/help_buttons_screen_title"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
+            android:name="org.wordpress.android.ui.accounts.DeviceInfoActivity"
+            android:label="@string/device_info_title"
+            android:theme="@style/WordPress.NoActionBar" />
+        <activity
             android:name="org.wordpress.android.ui.main.feedbackform.FeedbackFormActivity"
             android:label="@string/feedback_form_title"
             android:theme="@style/WordPress.NoActionBar" />

Go to https://buildkite.com/automattic/wordpress-android/builds/25379/canvas?sid=019cd43e-f8fa-4b0b-a832-28b4752351fa, click on the Artifacts tab and audit the files.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Mar 9, 2026

Project manifest changes for WordPress

The following changes in the WordPress's merged AndroidManifest.xml file were detected (build variant: jetpackRelease):

--- ./build/reports/diff_manifest/WordPress/jetpackRelease/base_manifest.txt	2026-03-09 20:26:16.030332513 +0000
+++ ./build/reports/diff_manifest/WordPress/jetpackRelease/head_manifest.txt	2026-03-09 20:26:17.970317834 +0000
@@ -476,6 +476,10 @@
             android:label="@string/help_buttons_screen_title"
             android:theme="@style/WordPress.NoActionBar" />
         <activity
+            android:name="org.wordpress.android.ui.accounts.DeviceInfoActivity"
+            android:label="@string/device_info_title"
+            android:theme="@style/WordPress.NoActionBar" />
+        <activity
             android:name="org.wordpress.android.ui.main.feedbackform.FeedbackFormActivity"
             android:label="@string/feedback_form_title"
             android:theme="@style/WordPress.NoActionBar" />

Go to https://buildkite.com/automattic/wordpress-android/builds/25379/canvas?sid=019cd43e-f8fb-45a6-8b4a-776d1a036a0b, click on the Artifacts tab and audit the files.

@jkmassel
Copy link
Contributor Author

jkmassel commented Mar 9, 2026

Even when grayscale appears to be applied it doesn't affect images (like featured images in the experimental post list). I'm not sure we can do anything about that but wanted to point it out. One possibility is to create a custom image components which automatically handle grayscale, but that would require changes to Coil, Glide, and FluxCImageLoader

This would certainly be a future thing – right now we're trying to keep this feature small. The devices themselves will do grayscale conversion for images so I'm not sure this needs to be our issue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jkmassel
Copy link
Contributor Author

jkmassel commented Mar 9, 2026

@adalpari and @nbradbury, I've reduced the scope of the PR – we'll just test the animation disabling (which is a huge issue on E Ink because the screens refresh very slowly). The theme won't really be useful until we're entirely on Jetpack Compose.

@jkmassel
Copy link
Contributor Author

jkmassel commented Mar 9, 2026

@nbradbury I've moved it under experimental features – it feels a bit odd to have an experimental feature prompt you like that, but it's ok for now.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants