Skip to content

Added accessibility service disclosure prompt for Android#2102

Merged
mpbw2 merged 3 commits intomasterfrom
feature-a11y-disclosure
Sep 27, 2022
Merged

Added accessibility service disclosure prompt for Android#2102
mpbw2 merged 3 commits intomasterfrom
feature-a11y-disclosure

Conversation

@mpbw2
Copy link
Contributor

@mpbw2 mpbw2 commented Sep 27, 2022

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Now that we're targeting API 32 we're required to comply with this policy regarding non-accessibility apps using accessibility services. This PR adds the disclosure and consent prompt as described on the help page.

Code changes

  • AutofillServicesPage.xaml/xaml.cs/ViewModel.cs: Added support for showing disclosure dialog when the user enables the accessibility switch, and requires acceptance before continuing to the Android accessibility settings screen to enable the service.
  • accessibilityservice.xml: Added isAccessibilityTool="false" per documentation (already defaults to false but added for completeness)

Screenshots

01

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

@mpbw2 mpbw2 requested a review from a team September 27, 2022 03:08
@mpbw2 mpbw2 enabled auto-merge (squash) September 27, 2022 03:09
HorizontalOptions="End" />
<Button
Clicked="ToggleAccessibility"
Clicked="ToggleAccessibilityAsync"
Copy link
Member

Choose a reason for hiding this comment

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

Can we move this to a command?

Comment on lines 58 to 64
private async void ToggleAccessibilityAsync(object sender, EventArgs e)
{
if (DoOnce())
{
_vm.ToggleAccessibility();
await _vm.ToggleAccessibilityAsync();
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This can be removed if we take the command approach. Furthermore, if we keep it like this it will crash the app if an exception is thrown.

Comment on lines +188 to +192
if (accept)
{
_deviceActionService.OpenAccessibilitySettings();
}
return;
Copy link
Member

Choose a reason for hiding this comment

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

You can simplify it by:

if (!accept)
{
    return;
}

and if it's accepted it will just use the call outside the if to open the a11y settings

Comment on lines +2452 to +2463
<data name="AccessibilityDisclosureTitle" xml:space="preserve">
<value>Accessibility Service Disclosure</value>
</data>
<data name="AccessibilityDisclosureText" xml:space="preserve">
<value>Bitwarden uses the Accessibility Service to search for login fields in apps and websites, then establish the appropriate field IDs for entering a username &amp; password when a match for the app or site is found. We do not store any of the information presented to us by the service, nor do we make any attempt to control any on-screen elements beyond text entry of credentials.</value>
</data>
<data name="AcceptAccessibilityDisclosure" xml:space="preserve">
<value>Accept</value>
</data>
<data name="DeclineAccessibilityDisclosure" xml:space="preserve">
<value>Decline</value>
</data>
Copy link
Member

Choose a reason for hiding this comment

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

Except for AccessibilityDisclosureText I think the other ones should have the key alike to the value:

<data name="AccessibilityServiceDisclosure" xml:space="preserve">
    <value>Accessibility Service Disclosure</value>
</data>
<data name="Accept" xml:space="preserve">
    <value>Accept</value>
</data>
<data name="Decline" xml:space="preserve">
    <value>Decline</value>
</data>

@mpbw2 mpbw2 requested a review from fedemkr September 27, 2022 17:26
@mpbw2 mpbw2 merged commit 425be32 into master Sep 27, 2022
@mpbw2 mpbw2 deleted the feature-a11y-disclosure branch September 27, 2022 18:03
mpbw2 added a commit that referenced this pull request Sep 28, 2022
Ldoppea referenced this pull request in cozy/cozy-pass-mobile Jun 5, 2023
Now that we're targeting API 32 we're required to comply with Google
new policy regarding non-accessibility apps using accessibility
services. This PR adds the disclosure and consent prompt as described
on the help page.

https://support.google.com/googleplay/android-developer/answer/10964491

This PR is a partial cherry pick from Bitwarden's changes

Related PR: bitwarden/mobile#2102
Related PR: bitwarden/mobile#2104
Ldoppea referenced this pull request in cozy/cozy-pass-mobile Jun 5, 2023
Now that we're targeting API 32 we're required to comply with Google
new policy regarding non-accessibility apps using accessibility
services. This PR adds the disclosure and consent prompt as described
on the help page.

https://support.google.com/googleplay/android-developer/answer/10964491

This PR is a partial cherry pick from Bitwarden's changes

Related PR: bitwarden/mobile#2102
Related PR: bitwarden/mobile#2104
Ldoppea referenced this pull request in cozy/cozy-pass-mobile Jun 27, 2023
Now that we're targeting API 32 we're required to comply with Google
new policy regarding non-accessibility apps using accessibility
services. This PR adds the disclosure and consent prompt as described
on the help page.

https://support.google.com/googleplay/android-developer/answer/10964491

This PR is a partial cherry pick from Bitwarden's changes

Related PR: bitwarden/mobile#2102
Related PR: bitwarden/mobile#2104
Ldoppea referenced this pull request in cozy/cozy-pass-mobile Jun 27, 2023
Now that we're targeting API 32 we're required to comply with Google
new policy regarding non-accessibility apps using accessibility
services. This PR adds the disclosure and consent prompt as described
on the help page.

https://support.google.com/googleplay/android-developer/answer/10964491

This PR is a partial cherry pick from Bitwarden's changes

Related PR: bitwarden/mobile#2102
Related PR: bitwarden/mobile#2104
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