OSDN Git Service

Launch NetD in a different thread
authorNathan Harold <nharold@google.com>
Mon, 17 Jul 2017 21:01:53 +0000 (14:01 -0700)
committerNathan Harold <nharold@google.com>
Tue, 18 Jul 2017 03:22:35 +0000 (20:22 -0700)
Calling run() launches in the current thread;
we want to call start() to launch in a separate
thread to unblock system initialization.

Bug: none
Test: compilation
Change-Id: Ia85059100add6a44a5e3262500b00ba8ca21e125

services/core/java/com/android/server/IpSecService.java

index ec275cc..bd3a850 100644 (file)
@@ -402,17 +402,14 @@ public class IpSecService extends IIpSecService.Stub {
 
     private void connectNativeNetdService() {
         // Avoid blocking the system server to do this
-        Thread t =
-                new Thread(
-                        new Runnable() {
-                            @Override
-                            public void run() {
-                                synchronized (IpSecService.this) {
-                                    NetdService.get(NETD_FETCH_TIMEOUT);
-                                }
-                            }
-                        });
-        t.run();
+        new Thread() {
+            @Override
+            public void run() {
+                synchronized (IpSecService.this) {
+                    NetdService.get(NETD_FETCH_TIMEOUT);
+                }
+            }
+        }.start();
     }
 
     INetd getNetdInstance() throws RemoteException {