Repository navigation
[Android] TextInput crashes with SecurityException when READ_CLIPBOARD is denied #59689
Description
Description
When the READ_CLIPBOARD app op is set to deny (MODE_ERRORED) for an app, any TextInput crashes the app on Android. Some OEM clipboard privacy settings put apps in this state; we see it in production on a realme RMX3830 (Android 15), and it reproduces on a stock emulator with appops.
TextView reads the clipboard from several places (canPaste() → ClipboardManager.hasPrimaryClip(), paste() → getPrimaryClip()), and in this mode ClipboardService calls AppOpsManager.noteOp/checkOp, which throw SecurityException (AppOpsManager.java, ClipboardService.java). ReactEditText lets it propagate, so the app crashes on:
- a tap or long-press on the field (floating text menu →
canPaste()) - Ctrl+V (
onKeyShortcut→canPaste()) - an accessibility service querying the focused field (
ReactAccessibilityDelegate→canPaste()) - Paste, on devices where
hasPrimaryClipis allowed butgetPrimaryClipis not (the production case:ReactEditText.onTextContextMenuItem→TextView.paste)
A fix is proposed in #59687.
Steps to reproduce
- Clone https://github.com/olivier-bouillet/rn-read-clipboard-crash-repro,
npm install,npx react-native run-android --mode release adb shell appops set com.clipboardrepro READ_CLIPBOARD deny- Tap or long-press the TextInput → the app crashes
- Restore with
adb shell appops set com.clipboardrepro READ_CLIPBOARD allow
React Native Version
0.88.1
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: macOS 27.2
CPU: (12) arm64 Apple M4 Pro
Memory: 65.33 MB / 48.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 23.11.1
path: ~/.nvm/versions/node/v23.11.1/bin/node
Yarn:
version: 1.22.22
path: /opt/homebrew/bin/yarn
npm:
version: 10.9.2
path: ~/.nvm/versions/node/v23.11.1/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 27.0
- iOS 27.1
- macOS 27.0
- tvOS 27.0
- visionOS 27.0
- watchOS 27.0
Android SDK: Not Found
IDEs:
Android Studio: 2025.3 AI-253.32098.37.2534.15232325
Xcode:
version: 27.1/27A9275
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.17
path: /opt/homebrew/opt/openjdk@17/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.2.0
wanted: 20.2.0
react:
installed: 19.3.0
wanted: 19.3.0
react-native:
installed: 0.88.1
wanted: 0.88.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
FATAL EXCEPTION: main
Process: com.clipboardrepro
java.lang.SecurityException: com.clipboardrepro from uid 10214 not allowed to perform READ_CLIPBOARD
at android.os.Parcel.readException(Parcel.java:3249)
at android.content.IClipboard$Stub$Proxy.hasPrimaryClip(IClipboard.java:501)
at android.content.ClipboardManager.hasPrimaryClip(ClipboardManager.java:292)
at android.widget.TextView.canPaste(TextView.java:15693)
at android.widget.Editor$TextActionModeCallback.populateMenuWithItems(Editor.java:4766)
at android.widget.Editor$TextActionModeCallback.onCreateActionMode(Editor.java:4723)
at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:1045)
at android.view.View.startActionMode(View.java:8288)
at android.widget.Editor.startInsertionActionMode(Editor.java:2501)
at android.widget.TextView.onTouchEvent(TextView.java:13238)
at com.facebook.react.views.textinput.ReactEditText.onTouchEvent(ReactEditText.kt:339)
Caused by: android.os.RemoteException: Remote stack trace:
at android.app.AppOpsManager.checkOp(AppOpsManager.java:9954)
at com.android.server.clipboard.ClipboardService.clipboardAccessAllowed(ClipboardService.java:1396)
at com.android.server.clipboard.ClipboardService$ClipboardImpl.hasPrimaryClip(ClipboardService.java:722)
Production (realme RMX3830, Android 15, React Native 0.86.3), user tapped Paste:
java.lang.SecurityException: <app> from uid 10240 not allowed to perform READ_CLIPBOARD
at android.content.ClipboardManager.getPrimaryClip(ClipboardManager.java:253)
at android.widget.TextView.paste(TextView.java:15514)
at android.widget.TextView.onTextContextMenuItem(TextView.java:15029)
at com.facebook.react.views.textinput.ReactEditText.onTextContextMenuItem(ReactEditText.kt:367)
Caused by: android.os.RemoteException: Remote stack trace:
at android.app.AppOpsManager.noteOp(AppOpsManager.java:9375)
at com.android.server.clipboard.ClipboardService.clipboardAccessAllowed(ClipboardService.java:1397)
MANDATORY Reproducer
https://github.com/olivier-bouillet/rn-read-clipboard-crash-repro
Screenshots and Videos
No response
Activity
olivier-bouillet commentedon Oct 30, 2026
Honestly, reproducer is useless :)
Just disable READ_CLIPBOARD and it is very easy to reproduce !
adb shell appops set com.clipboardrepro READ_CLIPBOARD deny