[PR #1591] [MERGED] Fix for crash when checking for running accessibility service without activity #51202

Closed
opened 2026-05-01 14:50:56 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1591
Author: @mpbw2
Created: 10/18/2021
Status: Merged
Merged: 10/18/2021
Merged by: @mpbw2

Base: masterHead: bugfix-appcontext


📝 Commits (1)

  • 676f675 fix for crash when checking for running accessibility service without activity

📊 Changes

1 file changed (+1 additions, -2 deletions)

View changed files

📝 src/Android/Services/DeviceActionService.cs (+1 -2)

📄 Description

When checking if our accessibility service is running while outside of the app (Use of the autofill quick-tile) the app can crash if MainActivity's context can't be obtained. Using application context is a safer approach here.

This code was recently updated to work within additional restrictions in recent versions of Android. The original code was wrapped in a try/catch, so if there were any issues obtaining context it would just fail without crashing, resulting in the "Bitwarden needs attention" toast showing when attempting to use the autofill quick tile even if accessibility is already enabled. I don't believe restoring the try/catch is necessary now that we're using application context.


🔄 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/1591 **Author:** [@mpbw2](https://github.com/mpbw2) **Created:** 10/18/2021 **Status:** ✅ Merged **Merged:** 10/18/2021 **Merged by:** [@mpbw2](https://github.com/mpbw2) **Base:** `master` ← **Head:** `bugfix-appcontext` --- ### 📝 Commits (1) - [`676f675`](https://github.com/bitwarden/android/commit/676f675071a462bd05b15e59e4205a8e7c111e15) fix for crash when checking for running accessibility service without activity ### 📊 Changes **1 file changed** (+1 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/Android/Services/DeviceActionService.cs` (+1 -2) </details> ### 📄 Description When checking if our accessibility service is running while outside of the app (Use of the autofill quick-tile) the app can crash if `MainActivity`'s context can't be obtained. Using application context is a safer approach here. This code was [recently updated](https://github.com/bitwarden/mobile/pull/1556/files#diff-baae9aac90018239aa3d5e2d0404727c3c15613ef10fb5f917bb01281bc5fa5bR643) to work within additional restrictions in recent versions of Android. The original code was wrapped in a try/catch, so if there were any issues obtaining context it would just fail without crashing, resulting in the "Bitwarden needs attention" toast showing when attempting to use the autofill quick tile even if accessibility is already enabled. I don't believe restoring the try/catch is necessary now that we're using application context. --- <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 2026-05-01 14:50:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#51202