Merge pull request #1201 from emakar/fix-android-leak
[Android] fix leaking `MethodChannel` through anonymous class
This commit is contained in:
commit
f573f8afe5
|
@ -168,13 +168,7 @@ public class ServiceWorkerManager implements MethodChannel.MethodCallHandler {
|
|||
}
|
||||
|
||||
private ServiceWorkerClientCompat dummyServiceWorkerClientCompat() {
|
||||
return new ServiceWorkerClientCompat() {
|
||||
@Nullable
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(@NonNull WebResourceRequest request) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
return DummyServiceWorkerClientCompat.INSTANCE;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
@ -185,4 +179,14 @@ public class ServiceWorkerManager implements MethodChannel.MethodCallHandler {
|
|||
}
|
||||
plugin = null;
|
||||
}
|
||||
|
||||
private static final class DummyServiceWorkerClientCompat extends ServiceWorkerClientCompat {
|
||||
static final ServiceWorkerClientCompat INSTANCE = new DummyServiceWorkerClientCompat();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(@NonNull WebResourceRequest request) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue