Set and get clipboard content #55

Open
opened 2025-11-07 13:42:17 +01:00 by Benjamin_Loison · 4 comments

DuckDuckGo and Google search adb set clipboard and "adb" "service" "clipboard".

service call clipboard 2 i32 1 i32 0 s16 "Hi there"
Output:
service: unknown option there
Result: Parcel(	
0x00000000: fffffffd 00000008 006f004e 00690020 '........N.o. .i.'
0x00000010: 00650074 0073006d 00000000 000003a4 't.e.m.s.........'
0x00000020: 000001cc 00610009 00200074 006f0063 '......a.t. .c.o.'
0x00000030: 002e006d 006e0061 00720064 0069006f 'm...a.n.d.r.o.i.'
0x00000040: 002e0064 00650073 00760072 00720065 'd...s.e.r.v.e.r.'
0x00000050: 0063002e 0069006c 00620070 0061006f '..c.l.i.p.b.o.a.'
0x00000060: 00640072 0043002e 0069006c 00620070 'r.d...C.l.i.p.b.'
0x00000070: 0061006f 00640072 00650053 00760072 'o.a.r.d.S.e.r.v.'
0x00000080: 00630069 00240065 006c0043 00700069 'i.c.e.$.C.l.i.p.'
0x00000090: 006f0062 00720061 00490064 0070006d 'b.o.a.r.d.I.m.p.'
0x000000a0: 002e006c 00680063 00630065 0041006b 'l...c.h.e.c.k.A.'
0x000000b0: 0064006e 00650053 00500074 00690072 'n.d.S.e.t.P.r.i.'
0x000000c0: 0061006d 00790072 006c0043 00700069 'm.a.r.y.C.l.i.p.'
0x000000d0: 00430028 0069006c 00620070 0061006f '(.C.l.i.p.b.o.a.'
0x000000e0: 00640072 00650053 00760072 00630069 'r.d.S.e.r.v.i.c.'
0x000000f0: 002e0065 0061006a 00610076 0035003a 'e...j.a.v.a.:.5.'
0x00000100: 00340038 000a0029 00610009 00200074 '8.4.).....a.t. .'
0x00000110: 006f0063 002e006d 006e0061 00720064 'c.o.m...a.n.d.r.'
0x00000120: 0069006f 002e0064 00650073 00760072 'o.i.d...s.e.r.v.'
0x00000130: 00720065 0063002e 0069006c 00620070 'e.r...c.l.i.p.b.'
0x00000140: 0061006f 00640072 0043002e 0069006c 'o.a.r.d...C.l.i.'
0x00000150: 00620070 0061006f 00640072 00650053 'p.b.o.a.r.d.S.e.'
0x00000160: 00760072 00630069 00240065 006c0043 'r.v.i.c.e.$.C.l.'
0x00000170: 00700069 006f0062 00720061 00490064 'i.p.b.o.a.r.d.I.'
0x00000180: 0070006d 002e006c 00650073 00500074 'm.p.l...s.e.t.P.'
0x00000190: 00690072 0061006d 00790072 006c0043 'r.i.m.a.r.y.C.l.'
0x000001a0: 00700069 00730041 00610050 006b0063 'i.p.A.s.P.a.c.k.'
0x000001b0: 00670061 00280065 006c0043 00700069 'a.g.e.(.C.l.i.p.'
0x000001c0: 006f0062 00720061 00530064 00720065 'b.o.a.r.d.S.e.r.'
0x000001d0: 00690076 00650063 006a002e 00760061 'v.i.c.e...j.a.v.'
0x000001e0: 003a0061 00320035 00290037 0009000a 'a.:.5.2.7.).....'
0x000001f0: 00740061 00610020 0064006e 006f0072 'a.t. .a.n.d.r.o.'
0x00000200: 00640069 0063002e 006e006f 00650074 'i.d...c.o.n.t.e.'
0x00000210: 0074006e 0049002e 006c0043 00700069 'n.t...I.C.l.i.p.'
0x00000220: 006f0062 00720061 00240064 00740053 'b.o.a.r.d.$.S.t.'
0x00000230: 00620075 006f002e 0054006e 00610072 'u.b...o.n.T.r.a.'
0x00000240: 0073006e 00630061 00280074 00430049 'n.s.a.c.t.(.I.C.'
0x00000250: 0069006c 00620070 0061006f 00640072 'l.i.p.b.o.a.r.d.'
0x00000260: 006a002e 00760061 003a0061 00310032 '..j.a.v.a.:.2.1.'
0x00000270: 00290034 0009000a 00740061 00630020 '4.).....a.t. .c.'
0x00000280: 006d006f 0061002e 0064006e 006f0072 'o.m...a.n.d.r.o.'
0x00000290: 00640069 0073002e 00720065 00650076 'i.d...s.e.r.v.e.'
0x000002a0: 002e0072 006c0063 00700069 006f0062 'r...c.l.i.p.b.o.'
0x000002b0: 00720061 002e0064 006c0043 00700069 'a.r.d...C.l.i.p.'
0x000002c0: 006f0062 00720061 00530064 00720065 'b.o.a.r.d.S.e.r.'
0x000002d0: 00690076 00650063 00430024 0069006c 'v.i.c.e.$.C.l.i.'
0x000002e0: 00620070 0061006f 00640072 006d0049 'p.b.o.a.r.d.I.m.'
0x000002f0: 006c0070 006f002e 0054006e 00610072 'p.l...o.n.T.r.a.'
0x00000300: 0073006e 00630061 00280074 006c0043 'n.s.a.c.t.(.C.l.'
0x00000310: 00700069 006f0062 00720061 00530064 'i.p.b.o.a.r.d.S.'
0x00000320: 00720065 00690076 00650063 006a002e 'e.r.v.i.c.e...j.'
0x00000330: 00760061 003a0061 00390034 00290036 'a.v.a.:.4.9.6.).'
0x00000340: 0009000a 00740061 00610020 0064006e '....a.t. .a.n.d.'
0x00000350: 006f0072 00640069 006f002e 002e0073 'r.o.i.d...o.s...'
0x00000360: 00690042 0064006e 00720065 0065002e 'B.i.n.d.e.r...e.'
0x00000370: 00650078 00540063 00610072 0073006e 'x.e.c.T.r.a.n.s.'
0x00000380: 00630061 00490074 0074006e 00720065 'a.c.t.I.n.t.e.r.'
0x00000390: 0061006e 0028006c 00690042 0064006e 'n.a.l.(.B.i.n.d.'
0x000003a0: 00720065 006a002e 00760061 003a0061 'e.r...j.a.v.a.:.'
0x000003b0: 00340031 00310031 000a0029 00000000 '1.4.1.1.).......')
Usage: service [-h|-?]
       service list
       service check SERVICE
       service call SERVICE CODE [i32 N | i64 N | f N | d N | s16 STR | null | fd f | nfd n | afd f ] ...
Options:
   i32: Write the 32-bit integer N into the send parcel.
   i64: Write the 64-bit integer N into the send parcel.
     f: Write the 32-bit single-precision number N into the send parcel.
     d: Write the 64-bit double-precision number N into the send parcel.
   s16: Write the UTF-16 string STR into the send parcel.
  null: Write a null binder into the send parcel.
    fd: Write a file descriptor for the file f into the send parcel.
   nfd: Write the file descriptor n into the send parcel.
   afd: Write an ashmem file descriptor for a region containing the data from
          file f into the send parcel.

does not work on LineageOS 22.2 Virtual Machine Manager virtual machine on my Debian 13 GNOME laptop.

I suspect setting being easier.

See #41.

DuckDuckGo and Google search *adb set clipboard* and `"adb" "service" "clipboard"`. ```bash service call clipboard 2 i32 1 i32 0 s16 "Hi there" ``` <details> <summary>Output:</summary> ``` service: unknown option there Result: Parcel( 0x00000000: fffffffd 00000008 006f004e 00690020 '........N.o. .i.' 0x00000010: 00650074 0073006d 00000000 000003a4 't.e.m.s.........' 0x00000020: 000001cc 00610009 00200074 006f0063 '......a.t. .c.o.' 0x00000030: 002e006d 006e0061 00720064 0069006f 'm...a.n.d.r.o.i.' 0x00000040: 002e0064 00650073 00760072 00720065 'd...s.e.r.v.e.r.' 0x00000050: 0063002e 0069006c 00620070 0061006f '..c.l.i.p.b.o.a.' 0x00000060: 00640072 0043002e 0069006c 00620070 'r.d...C.l.i.p.b.' 0x00000070: 0061006f 00640072 00650053 00760072 'o.a.r.d.S.e.r.v.' 0x00000080: 00630069 00240065 006c0043 00700069 'i.c.e.$.C.l.i.p.' 0x00000090: 006f0062 00720061 00490064 0070006d 'b.o.a.r.d.I.m.p.' 0x000000a0: 002e006c 00680063 00630065 0041006b 'l...c.h.e.c.k.A.' 0x000000b0: 0064006e 00650053 00500074 00690072 'n.d.S.e.t.P.r.i.' 0x000000c0: 0061006d 00790072 006c0043 00700069 'm.a.r.y.C.l.i.p.' 0x000000d0: 00430028 0069006c 00620070 0061006f '(.C.l.i.p.b.o.a.' 0x000000e0: 00640072 00650053 00760072 00630069 'r.d.S.e.r.v.i.c.' 0x000000f0: 002e0065 0061006a 00610076 0035003a 'e...j.a.v.a.:.5.' 0x00000100: 00340038 000a0029 00610009 00200074 '8.4.).....a.t. .' 0x00000110: 006f0063 002e006d 006e0061 00720064 'c.o.m...a.n.d.r.' 0x00000120: 0069006f 002e0064 00650073 00760072 'o.i.d...s.e.r.v.' 0x00000130: 00720065 0063002e 0069006c 00620070 'e.r...c.l.i.p.b.' 0x00000140: 0061006f 00640072 0043002e 0069006c 'o.a.r.d...C.l.i.' 0x00000150: 00620070 0061006f 00640072 00650053 'p.b.o.a.r.d.S.e.' 0x00000160: 00760072 00630069 00240065 006c0043 'r.v.i.c.e.$.C.l.' 0x00000170: 00700069 006f0062 00720061 00490064 'i.p.b.o.a.r.d.I.' 0x00000180: 0070006d 002e006c 00650073 00500074 'm.p.l...s.e.t.P.' 0x00000190: 00690072 0061006d 00790072 006c0043 'r.i.m.a.r.y.C.l.' 0x000001a0: 00700069 00730041 00610050 006b0063 'i.p.A.s.P.a.c.k.' 0x000001b0: 00670061 00280065 006c0043 00700069 'a.g.e.(.C.l.i.p.' 0x000001c0: 006f0062 00720061 00530064 00720065 'b.o.a.r.d.S.e.r.' 0x000001d0: 00690076 00650063 006a002e 00760061 'v.i.c.e...j.a.v.' 0x000001e0: 003a0061 00320035 00290037 0009000a 'a.:.5.2.7.).....' 0x000001f0: 00740061 00610020 0064006e 006f0072 'a.t. .a.n.d.r.o.' 0x00000200: 00640069 0063002e 006e006f 00650074 'i.d...c.o.n.t.e.' 0x00000210: 0074006e 0049002e 006c0043 00700069 'n.t...I.C.l.i.p.' 0x00000220: 006f0062 00720061 00240064 00740053 'b.o.a.r.d.$.S.t.' 0x00000230: 00620075 006f002e 0054006e 00610072 'u.b...o.n.T.r.a.' 0x00000240: 0073006e 00630061 00280074 00430049 'n.s.a.c.t.(.I.C.' 0x00000250: 0069006c 00620070 0061006f 00640072 'l.i.p.b.o.a.r.d.' 0x00000260: 006a002e 00760061 003a0061 00310032 '..j.a.v.a.:.2.1.' 0x00000270: 00290034 0009000a 00740061 00630020 '4.).....a.t. .c.' 0x00000280: 006d006f 0061002e 0064006e 006f0072 'o.m...a.n.d.r.o.' 0x00000290: 00640069 0073002e 00720065 00650076 'i.d...s.e.r.v.e.' 0x000002a0: 002e0072 006c0063 00700069 006f0062 'r...c.l.i.p.b.o.' 0x000002b0: 00720061 002e0064 006c0043 00700069 'a.r.d...C.l.i.p.' 0x000002c0: 006f0062 00720061 00530064 00720065 'b.o.a.r.d.S.e.r.' 0x000002d0: 00690076 00650063 00430024 0069006c 'v.i.c.e.$.C.l.i.' 0x000002e0: 00620070 0061006f 00640072 006d0049 'p.b.o.a.r.d.I.m.' 0x000002f0: 006c0070 006f002e 0054006e 00610072 'p.l...o.n.T.r.a.' 0x00000300: 0073006e 00630061 00280074 006c0043 'n.s.a.c.t.(.C.l.' 0x00000310: 00700069 006f0062 00720061 00530064 'i.p.b.o.a.r.d.S.' 0x00000320: 00720065 00690076 00650063 006a002e 'e.r.v.i.c.e...j.' 0x00000330: 00760061 003a0061 00390034 00290036 'a.v.a.:.4.9.6.).' 0x00000340: 0009000a 00740061 00610020 0064006e '....a.t. .a.n.d.' 0x00000350: 006f0072 00640069 006f002e 002e0073 'r.o.i.d...o.s...' 0x00000360: 00690042 0064006e 00720065 0065002e 'B.i.n.d.e.r...e.' 0x00000370: 00650078 00540063 00610072 0073006e 'x.e.c.T.r.a.n.s.' 0x00000380: 00630061 00490074 0074006e 00720065 'a.c.t.I.n.t.e.r.' 0x00000390: 0061006e 0028006c 00690042 0064006e 'n.a.l.(.B.i.n.d.' 0x000003a0: 00720065 006a002e 00760061 003a0061 'e.r...j.a.v.a.:.' 0x000003b0: 00340031 00310031 000a0029 00000000 '1.4.1.1.).......') Usage: service [-h|-?] service list service check SERVICE service call SERVICE CODE [i32 N | i64 N | f N | d N | s16 STR | null | fd f | nfd n | afd f ] ... Options: i32: Write the 32-bit integer N into the send parcel. i64: Write the 64-bit integer N into the send parcel. f: Write the 32-bit single-precision number N into the send parcel. d: Write the 64-bit double-precision number N into the send parcel. s16: Write the UTF-16 string STR into the send parcel. null: Write a null binder into the send parcel. fd: Write a file descriptor for the file f into the send parcel. nfd: Write the file descriptor n into the send parcel. afd: Write an ashmem file descriptor for a region containing the data from file f into the send parcel. ``` </details> does not work on LineageOS 22.2 Virtual Machine Manager virtual machine on my Debian 13 GNOME laptop. I suspect setting being easier. See #41.
Author
Owner

I don't want to install an app for this purpose.

I don't want to install an app for this purpose.
Author
Owner

Termux is a workaround to some extent, see Benjamin-Loison/termux-api/issues/32.

Termux is a workaround to some extent, see [Benjamin-Loison/termux-api/issues/32](https://github.com/Benjamin-Loison/termux-api/issues/32).
Author
Owner
Related to [Benjamin-Loison/scrcpy/issues/2](https://github.com/Benjamin-Loison/scrcpy/issues/2).
Author
Owner
Related to [Benjamin-Loison/scrcpy/issues/9](https://github.com/Benjamin-Loison/scrcpy/issues/9).
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/adb#55