OSDN Git Service

ServiceManager: Implement PING_TRANSACTION
authorArve Hjønnevåg <arve@android.com>
Wed, 29 Jan 2014 05:35:03 +0000 (21:35 -0800)
committerArve Hjønnevåg <arve@android.com>
Sat, 1 Feb 2014 01:22:30 +0000 (17:22 -0800)
Stop printing "invalid id " to stderr every time a process tries to
connect to the servicemanager.

Change-Id: Ib0e5a0375bfa2dec2c2f9cd668bd5dda46ed6588

cmds/servicemanager/binder.h
cmds/servicemanager/service_manager.c

index c207279..7915fc2 100644 (file)
@@ -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,
index f8212e8..79ce6ed 100644 (file)
@@ -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