Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.0+19

* Android: Fix memory leak due not unregistering ActivityLifecycleCallbacks.

## 0.6.0+18

* Fix video play in example and update video_player plugin dependency.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
}

@Override
public void onActivityDestroyed(Activity activity) {}
public void onActivityDestroyed(Activity activity) {
if (activity == registrar.activity()) {
((Application) registrar.context()).unregisterActivityLifecycleCallbacks(this);
}
}

@Override
public void onActivityStopped(Activity activity) {}
};

if (this.registrar != null
&& this.registrar.activity() != null
&& this.registrar.activity().getApplication() != null) {
this.registrar
.activity()
.getApplication()
if (this.registrar != null) {
((Application) this.registrar.context())
.registerActivityLifecycleCallbacks(this.activityLifecycleCallbacks);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.mockito.Mockito.when;

import android.app.Activity;
import android.app.Application;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.PluginRegistry;
Expand All @@ -28,6 +29,7 @@ public class ImagePickerPluginTest {

@Mock PluginRegistry.Registrar mockRegistrar;
@Mock Activity mockActivity;
@Mock Application mockApplication;
@Mock ImagePickerDelegate mockImagePickerDelegate;
@Mock MethodChannel.Result mockResult;

Expand All @@ -36,6 +38,7 @@ public class ImagePickerPluginTest {
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mockRegistrar.context()).thenReturn(mockApplication);

plugin = new ImagePickerPlugin(mockRegistrar, mockImagePickerDelegate);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/image_picker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors:
- Rhodes Davis Jr. <rody.davis.jr@gmail.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker

version: 0.6.0+18
version: 0.6.0+19

flutter:
plugin:
Expand Down