This report and bug 1404179 are examples of why "should" or "need" in a bug summary is a warning sign. :-) When a report assumes a particular solution, multiple possible solutions may be reported separately, fragmenting discussion. And if a particular solution is rejected, its bug report may be closed without solving the underlying problem.
The problem here is "SIM selection for mobile data is non-deterministic". When we make it deterministic, what rules should we follow to make the right choice most often? Here's a straw-man proposal:
(1) If exactly one SIM is locked, choose the other one (bug 1409694). Otherwise:
(2) If exactly one SIM is roaming, and "Auto switch to avoid roaming" (once implemented) is on, choose the other one. Otherwise:
(3) If one SIM has a 4G connection right now and the other doesn't, choose the one that does. Otherwise:
(4) If one SIM has a 3G connection right now and the other doesn't, choose the one that does. Otherwise:
(5) Choose the one that has strongest signal right now. (It doesn't matter so much if the other one becomes stronger later on.)
Even if these steps need a little tweaking, one obvious consequence is that the algorithm should re-run whenever the result is likely to have changed: whenever (a) you turn on the phone, (b) you lock/unlock a SIM, (c) you toggle "Auto switch to avoid roaming", (d) you change the data technology setting for any SIM, (e) you turn on cellular data or exit Flight Mode, or (f) whenever a SIM switches to a different carrier, e.g. as you drive into another country. The last one is the only non-interactive case, which may result in a surprising break in data connection for a few seconds, but that will be both infrequent and important.
The variety of conditions that need testing might also help you decide what piece of code to implement the solution in.
This report and bug 1404179 are examples of why "should" or "need" in a bug summary is a warning sign. :-) When a report assumes a particular solution, multiple possible solutions may be reported separately, fragmenting discussion. And if a particular solution is rejected, its bug report may be closed without solving the underlying problem.
The problem here is "SIM selection for mobile data is non-deterministic". When we make it deterministic, what rules should we follow to make the right choice most often? Here's a straw-man proposal:
(1) If exactly one SIM is locked, choose the other one (bug 1409694). Otherwise:
(2) If exactly one SIM is roaming, and "Auto switch to avoid roaming" (once implemented) is on, choose the other one. Otherwise:
(3) If one SIM has a 4G connection right now and the other doesn't, choose the one that does. Otherwise:
(4) If one SIM has a 3G connection right now and the other doesn't, choose the one that does. Otherwise:
(5) Choose the one that has strongest signal right now. (It doesn't matter so much if the other one becomes stronger later on.)
Even if these steps need a little tweaking, one obvious consequence is that the algorithm should re-run whenever the result is likely to have changed: whenever (a) you turn on the phone, (b) you lock/unlock a SIM, (c) you toggle "Auto switch to avoid roaming", (d) you change the data technology setting for any SIM, (e) you turn on cellular data or exit Flight Mode, or (f) whenever a SIM switches to a different carrier, e.g. as you drive into another country. The last one is the only non-interactive case, which may result in a surprising break in data connection for a few seconds, but that will be both infrequent and important.
The variety of conditions that need testing might also help you decide what piece of code to implement the solution in.