File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
android/src/main/java/com/reactnativecommunity/webview Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 3838import java .util .ArrayList ;
3939import java .util .Arrays ;
4040import java .util .HashMap ;
41- import java .util .Random ;
4241import java .util .concurrent .atomic .AtomicReference ;
4342
4443import static android .app .Activity .RESULT_OK ;
@@ -62,14 +61,14 @@ protected enum ShouldOverrideCallbackState {
6261 DO_NOT_OVERRIDE ,
6362 }
6463
65- private final Random randomGenerator = new Random () ;
64+ private int nextLockIdentifier = 0 ;
6665 private final HashMap <Integer , AtomicReference <ShouldOverrideCallbackState >> shouldOverrideLocks = new HashMap <>();
6766
6867 public synchronized Pair <Integer , AtomicReference <ShouldOverrideCallbackState >> getNewLock () {
69- Integer nextRand = randomGenerator . nextInt () ;
68+ final int lockIdentifier = nextLockIdentifier ++ ;
7069 AtomicReference <ShouldOverrideCallbackState > shouldOverride = new AtomicReference <>(ShouldOverrideCallbackState .UNDECIDED );
71- shouldOverrideLocks .put (nextRand , shouldOverride );
72- return new Pair <>(nextRand , shouldOverride );
70+ shouldOverrideLocks .put (lockIdentifier , shouldOverride );
71+ return new Pair <>(lockIdentifier , shouldOverride );
7372 }
7473
7574 @ Nullable
You can’t perform that action at this time.
0 commit comments