[android] Cherry picks to agua (#10442)
* [android] fix map snapshotter marker example The reference to the MapSnapshotter needs to be held for the duration of the snapshot, otherwise it might be GC'd * [android] MapRendererRunnable - avoid weak reference table overflow Apparently on some devices the weak reference table is limited (numbers around 52000). Even though we don't use that many weak references, when GC is not called for a while they can stack up and a crash will occur before the GC has had the time to clear the references. The C++ peer now holds on to a global ref (strong) which can be obtained to queue the java peer and then release automatically so that the GC can take over after the runnable has been executed.
This commit is contained in:
@@ -25,6 +25,8 @@ import timber.log.Timber;
|
||||
*/
|
||||
public class MapSnapshotterMarkerActivity extends AppCompatActivity implements MapSnapshotter.SnapshotReadyCallback {
|
||||
|
||||
private MapSnapshotter mapSnapshotter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -40,7 +42,7 @@ public class MapSnapshotterMarkerActivity extends AppCompatActivity implements M
|
||||
|
||||
Timber.i("Starting snapshot");
|
||||
|
||||
MapSnapshotter mapSnapshotter = new MapSnapshotter(
|
||||
mapSnapshotter = new MapSnapshotter(
|
||||
getApplicationContext(),
|
||||
new MapSnapshotter
|
||||
.Options(Math.min(container.getMeasuredWidth(), 1024), Math.min(container.getMeasuredHeight(), 1024))
|
||||
|
||||
Reference in New Issue
Block a user