[PR #4756] [MERGED] [PM-14435] Accessibility enabled settings changes to address older and custom Android phone versions #5185

Closed
opened 2025-11-26 23:55:13 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/4756
Author: @aj-rosado
Created: 2/20/2025
Status: Merged
Merged: 2/28/2025
Merged by: @aj-rosado

Base: mainHead: PM-14435/improve-accessibility-enabled-validation


📝 Commits (10+)

  • ca92b84 Added methods on accessibility service to update the IsAccessibilityEnabledState
  • 56b8579 Merge branch 'main' into PM-14435/improve-accessibility-enabled-validation
  • e61b911 Merge branch 'main' into PM-14435/improve-accessibility-enabled-validation
  • 889ec6f suppressing CyclomaticComplexMethod
  • 8303422 simplified accessibility update logic
  • e060457 fixed accessibility enabled manager test imports
  • 886d5b4 Merge branch 'main' into PM-14435/improve-accessibility-enabled-validation
  • 0ae54cb addressed PR comments
  • 53e4ede undo change on SettingsRepositoryImpl
  • d3da66d Simplified AccessibilityEnabledManagerTests

📊 Changes

7 files changed (+67 additions, -38 deletions)

View changed files

📝 app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/BitwardenAccessibilityService.kt (+16 -0)
📝 app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/di/AccessibilityModule.kt (+2 -2)
📝 app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityEnabledManager.kt (+5 -0)
📝 app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityEnabledManagerImpl.kt (+9 -8)
📝 app/src/test/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityEnabledManagerTest.kt (+31 -27)
📝 app/src/test/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/FakeAccessibilityEnabledManager.kt (+4 -0)
📝 app/src/test/java/com/x8bit/bitwarden/data/platform/manager/ReviewPromptManagerTest.kt (+0 -1)

📄 Description

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-14435

📔 Objective

Testing on a Xiaomi phone with Android 10 showed some discrepancies to android 15 and emulator versions.

The AccessibilityManager.isEnabled was returning true if any Accessibility app was turned on.

Reading from Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES and checking is this service exists there addresses this behaviour.

AccessibilityStateChangeListener also only was called when any of the accessibility apps was turned on or all turned off

Updating the mutableIsAccessibilityEnabledStateFlow when AccessibilityService's onServiceConnected and onUnbind keeps the value correctly updated.

In some scenarios, shortcuts get inconsistent and stopped updating correctly the accessibility switch, MAUI app showed a similar behaviour although it always had the correct value when entering the view.
Checking the Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES when onResume method is called to ensure it has the most recent setting is always displayed

Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/4756 **Author:** [@aj-rosado](https://github.com/aj-rosado) **Created:** 2/20/2025 **Status:** ✅ Merged **Merged:** 2/28/2025 **Merged by:** [@aj-rosado](https://github.com/aj-rosado) **Base:** `main` ← **Head:** `PM-14435/improve-accessibility-enabled-validation` --- ### 📝 Commits (10+) - [`ca92b84`](https://github.com/bitwarden/android/commit/ca92b84165b822a376e5d28e95ea3bdcbad6631c) Added methods on accessibility service to update the IsAccessibilityEnabledState - [`56b8579`](https://github.com/bitwarden/android/commit/56b8579a9056841772bc2be9b137ab88e5eb04d7) Merge branch 'main' into PM-14435/improve-accessibility-enabled-validation - [`e61b911`](https://github.com/bitwarden/android/commit/e61b911dbf087a5ecac7bf4ebf1eed88d2231318) Merge branch 'main' into PM-14435/improve-accessibility-enabled-validation - [`889ec6f`](https://github.com/bitwarden/android/commit/889ec6f8f887d2384446f9c8689d3e2e442dcc56) suppressing CyclomaticComplexMethod - [`8303422`](https://github.com/bitwarden/android/commit/83034221cc0dc27ed1be66a60154a132a6406551) simplified accessibility update logic - [`e060457`](https://github.com/bitwarden/android/commit/e060457eee6784554cff0b4410af9ebedd33601c) fixed accessibility enabled manager test imports - [`886d5b4`](https://github.com/bitwarden/android/commit/886d5b4846ddb853cbc9d7e7a9fb44587bf3528f) Merge branch 'main' into PM-14435/improve-accessibility-enabled-validation - [`0ae54cb`](https://github.com/bitwarden/android/commit/0ae54cbe62491fafc1615847388d08f16b9fc470) addressed PR comments - [`53e4ede`](https://github.com/bitwarden/android/commit/53e4eded5ca3cf267f0781aded0eda188b6394ea) undo change on SettingsRepositoryImpl - [`d3da66d`](https://github.com/bitwarden/android/commit/d3da66dcdf5626d854c06338daa9f5ec0019fed8) Simplified AccessibilityEnabledManagerTests ### 📊 Changes **7 files changed** (+67 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/BitwardenAccessibilityService.kt` (+16 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/di/AccessibilityModule.kt` (+2 -2) 📝 `app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityEnabledManager.kt` (+5 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityEnabledManagerImpl.kt` (+9 -8) 📝 `app/src/test/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityEnabledManagerTest.kt` (+31 -27) 📝 `app/src/test/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/FakeAccessibilityEnabledManager.kt` (+4 -0) 📝 `app/src/test/java/com/x8bit/bitwarden/data/platform/manager/ReviewPromptManagerTest.kt` (+0 -1) </details> ### 📄 Description ## 🎟️ Tracking https://bitwarden.atlassian.net/browse/PM-14435 ## 📔 Objective Testing on a Xiaomi phone with Android 10 showed some discrepancies to android 15 and emulator versions. The `AccessibilityManager.isEnabled` was returning `true` if any Accessibility app was turned on. Reading from `Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES` and checking is this service exists there addresses this behaviour. `AccessibilityStateChangeListener` also only was called when any of the accessibility apps was turned on or all turned off Updating the `mutableIsAccessibilityEnabledStateFlow` when `AccessibilityService`'s `onServiceConnected` and `onUnbind` keeps the value correctly updated. In some scenarios, shortcuts get inconsistent and stopped updating correctly the accessibility switch, MAUI app showed a similar behaviour although it always had the correct value when entering the view. Checking the `Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES` when `onResume` method is called to ensure it has the most recent setting is always displayed ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-26 23:55:13 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#5185