s1341 / binder-rust

An android binder library for rust
Apache License 2.0
18 stars 3 forks source link

examples panic Err` value: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" } #1

Open hua250623 opened 1 year ago

hua250623 commented 1 year ago

when i run examples , it will panic like this " data: BinderTransactionData { target: 0, cookie: 0, code: 0, flags: 8, sender_pid: 0, sender_euid: 1000, data_size: 4, offset_size: 0, data: 0x7c451c6028, offsets: 0x7c451c6030 } Parcel { data: [1, 0, 0, 128], offsets: [] } status: 2147483649 thread 'main' panicked at 'called Result::unwrap() on an Err value: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }', lib/src/parcel.rs:139:48 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace before write_read 4, 0 after write_read 4, 0 response: []

"

s1341 commented 1 year ago

What version of android are you working on?

hua250623 commented 1 year ago

What version of android are you working on?

my device working on android 12;

when I run examples , we new a Binder. code like this: "unsafe { binder_read_version(fd, &mut binder_version).expect("Failed to read binder version"); }" println!("Binder version is {}", binder_version.protocol_version);

at last, We get result print "Binder version is 8"

s1341 commented 1 year ago

The current code should work on android 11. I have not updated it for android 12 but would accept a pr.

hua250623 commented 1 year ago

The current code should work on android 11. I have not updated it for android 12 but would accept a pr.

OK, expect for your new version. Thx

hua250623 commented 1 year ago

Is it because of the new mechanism of Android 12 binder libbinder and AIDL, this reason conflicts the current code?

s1341 commented 1 year ago

There are subtle differences between the implementation on various version of android. At the moment I don't have an android device to test on... So if you want fixes, you're going to have to make a PR yourself.