Android 10 Clipboard Issue For Scrcpy
android
clipboard
sync
system manage
tweaks
This article explains how to resolve the Android 10 clipboard issue in scrcpy by utilizing Riru’s Clipboard Whitelist module and incorporating the ‘-K’ flag with Python’s reader.py script, allowing compatibility with specific clipboard manager apps.
com.github.kr328.clipboard.ClipboardProxy.getPrimaryClip
Magisk Module:
Riru - Clipboard Whitelist
will white list clipboard manager app.
https://github.com/Kr328/Riru-ClipboardWhitelist
https://t.me/kr328_riru_modules
script.sh:
scrcpy -K -S 2>&1 | python3 reader.py
reader.py:
import os
import subprocess
import re
class Response(object):
= None
status = None
data def parseResponse(resultString):
= re.findall(r"^Broadcasting: Intent { flg=0x400000 cmp=ch.pete.adbclipboard/.ReadReceiver }\nBroadcast completed: result=-1, data=\"((.*\n?)+)\"$",resultString)[0][0]
response return response
def readFromDevice():
= subprocess.Popen(
adbProcess 'adb',
['shell', 'am',
'broadcast',
'-n', 'ch.pete.adbclipboard/.ReadReceiver'],
=subprocess.PIPE)
stdout= adbProcess.communicate()[0]
resultString print("read device response:\n{}"
format(resultString))
.try:
= parseResponse(resultString.decode("utf-8"))
result print("raw:\n",resultString)
print("result:\n",result)
return result
except:
traceback.print_exc()return
def setClipboard(data):
with open("target.out","w+",encoding="utf-8") as f:
f.write(data)= "cat target.out | xclip -selection c"
fetch_clipboard
os.system(fetch_clipboard)while True:
= input()
content print("CONTENT:",content)
if "Calling uid 0 does not own package com.android.shell" in content:
print("!!!!!!!!!!ERROR FETCHING CLIPBOARD!!!!!!!!!!")
= readFromDevice()
data if data is not None:
setClipboard(data)# with open("target.out","wb"
# os.system(fetch_clipboard)