Closed eblis closed 2 months ago
Can you attach a screenshot of the problem and specify which version of the app you are using?
Version 5.2.8.
I see a number 2 with yellow, I'm guessing it's SIM2. Also, not all calls are marked as HD, whereas in Google Phone they are marked HD, but I guess that's a separate issue.
This is my SIM configuration
And if I look in Google Phone it shows the call as coming from orange.
Are sim card numbers displayed correctly in the Recent tab?
You mean on the main Recents page, where all contacts are listed? No, it's showing 2 there as well for all calls from SIM1 (my main SIM).
And I just tried to make a call from SIM 2 and it's shown as 3 in the Recents page
What kind of device do you have?
Realme GT neo 2
So it looks like SIM id is 1, 2, 3, etc, but SIM.handle.id is "2", "3", "4", ...
Instead of checking if the manufacturer is Huawei (and Realme) could you maybe look for the minimum slot index and use that as an offset?
Something like this: val simOffset = 1 - (accountIdToSimIDMap.keys.map { it.toInt() }.min())
And then simID = if (it >= 0) it + simOffset else -1
Manufacturer | Minimum SIM slot | offset |
---|---|---|
Realme | "2" | -1 |
Huawei | "0" | 1 |
Honor | "0" | 1 |
others | "1" | 0 |
This way it should work for any manufacturer without having to check each one separately.
Alternatively, if you reverse the 2 ways to fetch the SIMs it would work for Realme, as the map is correct, "2" -> 1, "3" -> 2, but it never executes as it thinks it got the correct SIM via the offsetting.
simID = accountIdToSimIDMap[accountId] ?: -1
if ((simID == -1) && (accountId != null)) {
if (accountId.length == 1) {
accountId.toIntOrNull()?.let {
val index = if (isHuawei) 1 else 0 //Huawei's sim card index returns (0,1...)
simID = if (it >= 0) it + index else -1
}
}
}
The problem is the sim card value in Recent android calls: val accountId = cursor.getStringValue(Calls.PHONE_ACCOUNT_ID) Can contain PhoneAccountHandle, sim card number (1,2...) or sim card index (0,1...). Earlier we considered that only PhoneAccountHandle is stored there and it worked correctly for most devices, most likely we will return this principle and only for Huawei devices we will try to calculate as if the sim card index is stored there.
Instead of checking if the manufacturer is Huawei (and Realme) could you maybe look for the minimum slot index and use that as an offset?
Something like this:
val simOffset = 1 - (accountIdToSimIDMap.keys.map { it.toInt() }.min())
And then
simID = if (it >= 0) it + simOffset else -1
Manufacturer Minimum SIM slot offset Realme "2" -1 Huawei "0" 1 Honor "0" 1 others "1" 0 This way it should work for any manufacturer without having to check each one separately.
To do this, we need to go through all the records with the cursor and see what SIM card values exist. In some cases it will give incorrect result, for example, when the list contains only calls on one of SIM cards.
I thought it was iterating over all SIMs in the system, not just the SIMs used for that contact
getAvailableSIMCardLabels() - looks for all available SIM cards on the device and there are no problems with it. The problem is with information about SIM card that is recorded in Android's call history.
But then calculating the minimum from getAvailableSIMCardLabels()
and using that as the offset should work.
I'll create a quick PR and you can have a look.
In getAvailableSIMCardLabels() we assign the SIM card index ourselves, it will not match the data from the call list.
I saw that, but the keys in getAvailableSIMCardLabels
are the keys used in the call list, no ?
I would expect the keys for Huawei devices to be something like "0", "1", are they something else ?
For example, on my Xiaomi device the key is the PhoneAccountHandle object, which consists of a bunch of letters and numbers, on one of the user's Huawei devices it was the SIM card slot index (0,1...), on some other Xiaomi devices it was the SIM card number (1,2...).
Check after the 5.2.9 update, Google Play is still checking, but on GitHub it's already available.
Correct SIM (1 and 2) is now shown for recent calls with 5.2.9
I have 2 SIMs active on my Phone, SIM 1 is green, SIM2 is yellow. In the recents page, when I click on information for a contact it shows that all calls have been made from SIM2, even though most (if not all of the calls) were actually made from SIM1.
There seems to be a problem with showing which SIM was used to make the call(s), it always lists SIM2.