From e5245cbf5d4e830cf605ef07f5d284d7c5d2867e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= Date: Tue, 28 Jan 2014 21:35:03 -0800 Subject: [PATCH] ServiceManager: Implement PING_TRANSACTION Stop printing "invalid id " to stderr every time a process tries to connect to the servicemanager. Change-Id: Ib0e5a0375bfa2dec2c2f9cd668bd5dda46ed6588 --- cmds/servicemanager/binder.h | 2 ++ cmds/servicemanager/service_manager.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/cmds/servicemanager/binder.h b/cmds/servicemanager/binder.h index c20727972..7915fc268 100644 --- a/cmds/servicemanager/binder.h +++ b/cmds/servicemanager/binder.h @@ -33,6 +33,8 @@ struct binder_death { #define SVC_MGR_NAME "android.os.IServiceManager" enum { + /* Must match definitions in IBinder.h and IServiceManager.h */ + PING_TRANSACTION = B_PACK_CHARS('_','P','N','G'), SVC_MGR_GET_SERVICE = 1, SVC_MGR_CHECK_SERVICE, SVC_MGR_ADD_SERVICE, diff --git a/cmds/servicemanager/service_manager.c b/cmds/servicemanager/service_manager.c index f8212e8ba..79ce6eda5 100644 --- a/cmds/servicemanager/service_manager.c +++ b/cmds/servicemanager/service_manager.c @@ -220,6 +220,9 @@ int svcmgr_handler(struct binder_state *bs, if (txn->target.handle != svcmgr_handle) return -1; + if (txn->code == PING_TRANSACTION) + return 0; + // Equivalent to Parcel::enforceInterface(), reading the RPC // header with the strict mode policy mask and the interface name. // Note that we ignore the strict_policy and don't propagate it