[PR #1947] [MERGED] [PS-858] Clipboard handling adjustments for Android 13 #15996

Closed
opened 2026-04-15 02:01:03 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1947
Author: @mpbw2
Created: 6/9/2022
Status: Merged
Merged: 6/10/2022
Merged by: @mpbw2

Base: masterHead: enhancement-android13clipboard


📝 Commits (3)

📊 Changes

13 files changed (+84 additions, -43 deletions)

View changed files

📝 src/Android/MainApplication.cs (+5 -5)
📝 src/Android/Services/ClipboardService.cs (+31 -3)
📝 src/Android/Services/DeviceActionService.cs (+4 -9)
📝 src/App/Pages/Generator/GeneratorHistoryPageViewModel.cs (+1 -2)
📝 src/App/Pages/Generator/GeneratorPageViewModel.cs (+1 -3)
📝 src/App/Pages/Vault/PasswordHistoryPageViewModel.cs (+1 -2)
📝 src/App/Pages/Vault/ViewPageViewModel.cs (+1 -1)
📝 src/App/Services/MobilePlatformUtilsService.cs (+12 -0)
📝 src/App/Utilities/AppHelpers.cs (+7 -14)
📝 src/Core/Abstractions/IClipboardService.cs (+9 -1)
📝 src/Core/Abstractions/IPlatformUtilsService.cs (+1 -0)
📝 src/iOS.Core/Services/ClipboardService.cs (+9 -1)
📝 src/iOS.Core/Utilities/iOSCoreHelpers.cs (+2 -2)

📄 Description

Type of change

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

Objective

Android 13 introduces some changes to clipboard behavior when copying text:
https://developer.android.com/about/versions/13/features/copy-paste

This PR does the following:

  • Prevent toasts when copying text on Android 13+ so as to not conflict with the new indicator
  • Pass the IS_SENSITIVE flag to the ClipboardManager to prevent showing copied text in the new popup in Android 13+

Note 1: Currently this can't be tested in the emulator as the latest image (at least for ARM64) is still internally returning 32 for the API version (should be 33). I installed the June 8 beta on a Pixel 4a for testing.

Note 2: As of the latest beta released yesterday (June 8) the OS behavior doesn't line up with the documented behavior (Instead of obfuscated dots in the popup it shows "Tap to view" which then shows the copied text in a separate clipboard viewer). I'm unsure if the behavior is still in flux, or the documentation hasn't caught up, or my implementation isn't correct. Regardless these changes prevent copied content from appearing in the clear within the popup. I'll continue to observe each new release in case that changes before Android 13 goes live.

Code changes

Android:

  • ClipboardService.cs: Added isSensitive arg to CopyTextAsync method, defaults to true. Added CopyNotificationHandledByOs method to establish if the OS has built-in support for notifying the user when something is copied to the clipboard, used to prevent conflicting toasts
  • DeviceActionService.cs (Android): Added ClipboardService for TOTP copying with the new handler (removed private method)
  • MainApplication.cs: Adjustments to service initialization

iOS:

  • ClipboardService.cs: Added isSensitive arg to CopyTextAsync method (unused w/ comment) and CopyNotificationHandledByOs method (with comment about future use)

General:

  • All other files: Check if CopyNotificationHandledByOs before showing toasts when copying text to the clipboard

Screenshots

01

Before you submit

  • I have checked for formatting errors (dotnet tool run dotnet-format --check) (required)
  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • This change has particular deployment requirements (notify the DevOps team)

🔄 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/1947 **Author:** [@mpbw2](https://github.com/mpbw2) **Created:** 6/9/2022 **Status:** ✅ Merged **Merged:** 6/10/2022 **Merged by:** [@mpbw2](https://github.com/mpbw2) **Base:** `master` ← **Head:** `enhancement-android13clipboard` --- ### 📝 Commits (3) - [`f9145bb`](https://github.com/bitwarden/android/commit/f9145bb11f2a4710ea556a3b1ffc84ab642313fb) Android 13 clipboard tweaks - [`184a8ed`](https://github.com/bitwarden/android/commit/184a8ed108891942970e50e8e87c6d2c1aff663b) adjustments - [`5dd4289`](https://github.com/bitwarden/android/commit/5dd42892e8d5671ad78c70b58a2ada448073b797) adjustments round 2 ### 📊 Changes **13 files changed** (+84 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `src/Android/MainApplication.cs` (+5 -5) 📝 `src/Android/Services/ClipboardService.cs` (+31 -3) 📝 `src/Android/Services/DeviceActionService.cs` (+4 -9) 📝 `src/App/Pages/Generator/GeneratorHistoryPageViewModel.cs` (+1 -2) 📝 `src/App/Pages/Generator/GeneratorPageViewModel.cs` (+1 -3) 📝 `src/App/Pages/Vault/PasswordHistoryPageViewModel.cs` (+1 -2) 📝 `src/App/Pages/Vault/ViewPageViewModel.cs` (+1 -1) 📝 `src/App/Services/MobilePlatformUtilsService.cs` (+12 -0) 📝 `src/App/Utilities/AppHelpers.cs` (+7 -14) 📝 `src/Core/Abstractions/IClipboardService.cs` (+9 -1) 📝 `src/Core/Abstractions/IPlatformUtilsService.cs` (+1 -0) 📝 `src/iOS.Core/Services/ClipboardService.cs` (+9 -1) 📝 `src/iOS.Core/Utilities/iOSCoreHelpers.cs` (+2 -2) </details> ### 📄 Description ## Type of change - [ ] Bug fix - [X] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> Android 13 introduces some changes to clipboard behavior when copying text: https://developer.android.com/about/versions/13/features/copy-paste This PR does the following: * Prevent toasts when copying text on Android 13+ so as to not conflict with the new indicator * Pass the `IS_SENSITIVE` flag to the `ClipboardManager` to prevent showing copied text in the new popup in Android 13+ _**Note 1: Currently this can't be tested in the emulator as the latest image (at least for ARM64) is still internally returning `32` for the API version (should be `33`). I installed the June 8 beta on a Pixel 4a for testing.**_ _**Note 2: As of the latest beta released yesterday (June 8) the OS behavior doesn't line up with the documented behavior (Instead of obfuscated dots in the popup it shows "Tap to view" which then shows the copied text in a separate clipboard viewer). I'm unsure if the behavior is still in flux, or the documentation hasn't caught up, or my implementation isn't correct. Regardless these changes prevent copied content from appearing in the clear within the popup. I'll continue to observe each new release in case that changes before Android 13 goes live.**_ ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> Android: * **ClipboardService.cs:** Added `isSensitive` arg to `CopyTextAsync` method, defaults to `true`. Added `CopyNotificationHandledByOs` method to establish if the OS has built-in support for notifying the user when something is copied to the clipboard, used to prevent conflicting toasts * **DeviceActionService.cs (Android):** Added `ClipboardService` for TOTP copying with the new handler (removed private method) * **MainApplication.cs:** Adjustments to service initialization iOS: * **ClipboardService.cs:** Added `isSensitive` arg to `CopyTextAsync` method (unused w/ comment) and `CopyNotificationHandledByOs` method (with comment about future use) General: * **All other files:** Check if `CopyNotificationHandledByOs` before showing toasts when copying text to the clipboard ## Screenshots <!--Required for any UI changes. Delete if not applicable--> ![01](https://user-images.githubusercontent.com/59324545/172939449-a85297c0-0aed-4378-af12-47884de5eb2d.png) ## Before you submit - [X] I have checked for formatting errors (`dotnet tool run dotnet-format --check`) (required) - [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required) - [ ] This change requires a **documentation update** (notify the documentation team) - [ ] This change has particular **deployment requirements** (notify the DevOps team) --- <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-04-15 02:01:03 -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#15996