Skip to content
Merged
Prev Previous commit
make constant private again
  • Loading branch information
bparrishMines committed Apr 14, 2023
commit c55933870b8a499cfb522fe1b2f845f85b64d537
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.HashMap;
Expand Down Expand Up @@ -37,7 +36,7 @@ public class InstanceManager {
// Host uses identifiers >= 2^16 and Dart is expected to use values n where,
// 0 <= n < 2^16.
private static final long MIN_HOST_CREATED_IDENTIFIER = 65536;
@VisibleForTesting public static final long CLEAR_FINALIZED_WEAK_REFERENCES_INTERVAL = 30000;
private static final long CLEAR_FINALIZED_WEAK_REFERENCES_INTERVAL = 30000;
private static final String TAG = "InstanceManager";

/** Interface for listening when a weak reference of an instance is removed from the manager. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

package io.flutter.plugins.cameraexample;

import static io.flutter.plugins.camerax.InstanceManager.CLEAR_FINALIZED_WEAK_REFERENCES_INTERVAL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
Expand Down Expand Up @@ -34,7 +33,9 @@ public void managerDoesNotTriggerFinalizationListenerWhenStopped() throws Interr

Runtime.getRuntime().gc();

Thread.sleep(CLEAR_FINALIZED_WEAK_REFERENCES_INTERVAL);
// Wait for the interval after finalized callbacks are made for garbage collected objects.
// See InstanceManager.CLEAR_FINALIZED_WEAK_REFERENCES_INTERVAL.
Thread.sleep(30000);

assertNull(instanceManager.getInstance(0));
assertFalse(callbackTriggered[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.HashMap;
Expand Down Expand Up @@ -37,7 +36,7 @@ public class InstanceManager {
// Host uses identifiers >= 2^16 and Dart is expected to use values n where,
// 0 <= n < 2^16.
private static final long MIN_HOST_CREATED_IDENTIFIER = 65536;
@VisibleForTesting public static final long CLEAR_FINALIZED_WEAK_REFERENCES_INTERVAL = 3000;
private static final long CLEAR_FINALIZED_WEAK_REFERENCES_INTERVAL = 3000;
private static final String TAG = "InstanceManager";

/** Interface for listening when a weak reference of an instance is removed from the manager. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

package io.flutter.plugins.webviewflutterexample;

import static io.flutter.plugins.webviewflutter.InstanceManager.CLEAR_FINALIZED_WEAK_REFERENCES_INTERVAL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
Expand Down Expand Up @@ -34,7 +33,9 @@ public void managerDoesNotTriggerFinalizationListenerWhenStopped() throws Interr

Runtime.getRuntime().gc();

Thread.sleep(CLEAR_FINALIZED_WEAK_REFERENCES_INTERVAL);
// Wait for the interval after finalized callbacks are made for garbage collected objects.
// See InstanceManager.CLEAR_FINALIZED_WEAK_REFERENCES_INTERVAL.
Thread.sleep(30000);

assertNull(instanceManager.getInstance(0));
assertFalse(callbackTriggered[0]);
Expand Down