From: Alessandro Astone Date: Wed, 6 Sep 2023 21:29:56 +0000 (+0200) Subject: interfaces: Return binder error when receiving an unknown transaction X-Git-Tag: 1.4.2~17 X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/commitdiff_plain/21b94635e7c2501c1ce4727c0c38533c03c996d2?ds=sidebyside interfaces: Return binder error when receiving an unknown transaction Requires gbinder-python 1.1.2 to work. It is a noop otherwise. --- diff --git a/tools/interfaces/IClipboard.py b/tools/interfaces/IClipboard.py index 5bd00b6..c8538e7 100644 --- a/tools/interfaces/IClipboard.py +++ b/tools/interfaces/IClipboard.py @@ -26,10 +26,12 @@ def add_service(args, sendClipboardData, getClipboardData): arg1 = reader.read_string16() sendClipboardData(arg1) local_response.append_int32(0) - if code == TRANSACTION_getClipboardData: + elif code == TRANSACTION_getClipboardData: ret = getClipboardData() local_response.append_int32(0) local_response.append_string16(ret) + else: + return local_response, -99999 # Some error unknown to binder to force a RemoteException return local_response, 0 diff --git a/tools/interfaces/IHardware.py b/tools/interfaces/IHardware.py index 0338c3f..69539f1 100644 --- a/tools/interfaces/IHardware.py +++ b/tools/interfaces/IHardware.py @@ -31,31 +31,33 @@ def add_service(args, enableNFC, enableBluetooth, suspend, reboot, upgrade): ret = enableNFC(arg1 != 0) local_response.append_int32(0) local_response.append_int32(ret) - if code == TRANSACTION_enableBluetooth: + elif code == TRANSACTION_enableBluetooth: status, arg1 = reader.read_int32() ret = enableBluetooth(arg1 != 0) local_response.append_int32(0) local_response.append_int32(ret) - if code == TRANSACTION_suspend: + elif code == TRANSACTION_suspend: suspend() local_response.append_int32(0) - if code == TRANSACTION_reboot: + elif code == TRANSACTION_reboot: reboot() local_response.append_int32(0) - if code == TRANSACTION_upgrade: + elif code == TRANSACTION_upgrade: arg1 = reader.read_string16() status, arg2 = reader.read_int32() arg3 = reader.read_string16() status, arg4 = reader.read_int32() upgrade(arg1, arg2, arg3, arg4) local_response.append_int32(0) - if code == TRANSACTION_upgrade2: + elif code == TRANSACTION_upgrade2: arg1 = reader.read_string16() status, arg2 = reader.read_int64() arg3 = reader.read_string16() status, arg4 = reader.read_int64() upgrade(arg1, arg2, arg3, arg4) local_response.append_int32(0) + else: + return local_response, -99999 # Some error unknown to binder to force a RemoteException return local_response, 0 diff --git a/tools/interfaces/IUserMonitor.py b/tools/interfaces/IUserMonitor.py index 664fac6..04f5a3f 100644 --- a/tools/interfaces/IUserMonitor.py +++ b/tools/interfaces/IUserMonitor.py @@ -26,12 +26,14 @@ def add_service(args, userUnlocked, packageStateChanged): status, arg1 = reader.read_int32() userUnlocked(arg1) local_response.append_int32(0) - if code == TRANSACTION_packageStateChanged: + elif code == TRANSACTION_packageStateChanged: status, arg1 = reader.read_int32() arg2 = reader.read_string16() status, arg3 = reader.read_int32() packageStateChanged(arg1, arg2, arg3) local_response.append_int32(0) + else: + return local_response, -99999 # Some error unknown to binder to force a RemoteException return local_response, 0