Loading remote-droid-guard-lib/src/main/java/org/microg/gms/droidguard/RemoteDroidGuardConnector.java +21 −2 Original line number Diff line number Diff line Loading @@ -87,14 +87,33 @@ public class RemoteDroidGuardConnector { private boolean connectForTask(Task todo) { CountDownLatch countDownLatch = new CountDownLatch(1); Intent intent = new Intent("org.microg.gms.droidguard.REMOTE"); intent.setPackage("org.microg.gms.droidguard"); boolean b = context.bindService(intent, new Connection(countDownLatch, todo), Context.BIND_AUTO_CREATE); if (!b) return false; Connection c = new Connection(countDownLatch, todo); boolean b = context.bindService(intent, c, Context.BIND_AUTO_CREATE); if (!b) { return false; } try { countDownLatch.await(30, TimeUnit.SECONDS); // When calling DroidguardHelper.guard(), process com.google.android.gms.unstable dies often // thanks to com.google.ccc.abuse.droidguard.DroidGuard // However, because of the above bindService, the process persists for a while in zombie state, // and only next SafetyNetClientService calls that touch RemoteDroidGuardService make the process // really go away (onDestroy gets called on RemoteDroidGuardService), with logcat getting the // "Service org.microg.gms.snet.SafetyNetClientService has leaked ServiceConnection // org.microg.gms.droidguard.RemoteDroidGuardConnector$Connection" message // By unbinding here, the process is terminated immediately, and no more leaks are happening context.unbindService(c); } catch (InterruptedException e) { } return true; } Loading Loading
remote-droid-guard-lib/src/main/java/org/microg/gms/droidguard/RemoteDroidGuardConnector.java +21 −2 Original line number Diff line number Diff line Loading @@ -87,14 +87,33 @@ public class RemoteDroidGuardConnector { private boolean connectForTask(Task todo) { CountDownLatch countDownLatch = new CountDownLatch(1); Intent intent = new Intent("org.microg.gms.droidguard.REMOTE"); intent.setPackage("org.microg.gms.droidguard"); boolean b = context.bindService(intent, new Connection(countDownLatch, todo), Context.BIND_AUTO_CREATE); if (!b) return false; Connection c = new Connection(countDownLatch, todo); boolean b = context.bindService(intent, c, Context.BIND_AUTO_CREATE); if (!b) { return false; } try { countDownLatch.await(30, TimeUnit.SECONDS); // When calling DroidguardHelper.guard(), process com.google.android.gms.unstable dies often // thanks to com.google.ccc.abuse.droidguard.DroidGuard // However, because of the above bindService, the process persists for a while in zombie state, // and only next SafetyNetClientService calls that touch RemoteDroidGuardService make the process // really go away (onDestroy gets called on RemoteDroidGuardService), with logcat getting the // "Service org.microg.gms.snet.SafetyNetClientService has leaked ServiceConnection // org.microg.gms.droidguard.RemoteDroidGuardConnector$Connection" message // By unbinding here, the process is terminated immediately, and no more leaks are happening context.unbindService(c); } catch (InterruptedException e) { } return true; } Loading