Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added changes for multisim, added tests #1080

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Cyber1000
Copy link

@Cyber1000 Cyber1000 commented May 28, 2022

Added support for multisim (see #598):

  • if multisim you now have multiple entries at some places (see screenshots)
  • at this places the phone-number will be displayed (43...) in the screenshot (therefore sms-backup+ needs more rights)
    • if you have only one sim, your phone number won't be displayed (everything stays the same)
  • you can takeover imapsettings from sim 1 (see screenshot)
  • I had one problem how callog is assigned to the phonenumber:
    • some phones use a continuous number like 1, 2 - like my old honor
    • some phones use the IccId (kind of sim-card-number) like my current Samsung
    • this is no problem with backup (I just search for both), but maybe a problem for restore, thus the setting (see screenshot). This needs to be set by the user depending on his phone
  • There were some places in code with XOAuth2, I didn't take that into account (at least not everywhere), since it is no longer supported
  • New texts are English and German (no other translations)
  • added tests
  • tried it on my Samsung (currently Android 10, but will update to Android 11 soon)

@Cyber1000
Copy link
Author

Cyber1000 commented May 28, 2022

Mulitisim

Multisim

Settings for second SIM

Settings_Sim2

Settings for SMS

SMS

Settings for Callog

Calllog

Special Restore setting

IccId

@Vaentus
Copy link

Vaentus commented Jul 31, 2022

Could you please explain how I can get my version of smsbackup+ to look like and work like that? On my dual sim phone the app looks the same as before, no options as you show above

@Cyber1000
Copy link
Author

@Vaentus Sorry to come back so late. This is an (unmerged) PR, and it seems that no one is reviewing here.

You would need to do this: https://github.com/jberkel/sms-backup-plus#installation-from-source, instead of "git clone https://github.com/jberkel/sms-backup-plus.git" you would do: "git clone -b Cyber1000-multisim https://github.com/Cyber1000/sms-backup-plus.git", thats's this branch.

The resulting apk may be in another subdir and doesn't need to be installed via adb (can also be transferred somewhere on your mobile device and installed manually, if "unknown sources" are allowed). Don't know how deep (or if) you are in development.

@kurahaupo
Copy link
Collaborator

@Cyber1000 It turns out I can make some code changes, but I can't push builds to Google Play or f-Droid, or make administrative changes.

I've squash-merged two white-space fix-ups (one overdue and one in your branch), and rebased the multisim branch onto the adjusted master branch; please fetch+reset before adding more commits.

@kurahaupo
Copy link
Collaborator

@Vaentus you can pull the "multisim" branch from this repo.

@kurahaupo
Copy link
Collaborator

@Cyber1000

Firstly thank-you very much for making a start on this.

I've been reviewing this code, and I'm a bit confused by the ICCID stuff.

As a user, I would naïvely expect that backing up would label each record with either the SIM's ICCID or its MSISDN, so that records are tied to a specific SIM regardless of which slot it's installed in, and that upon restoration, look to see if that SIM or MSISDN is currently present, and if so, write it into the connected call log or SMS database.

However it appears, looking at getUseIccIdForRestore, that it's taking the ICCID from the SIM that's currently in a given slot, and putting that as the PHONE_ACCOUNT_ID.

Is that how it's supposed to work?

(It occurs to me that there are broadly two ways to label the call logs and messages with the relevant ICCID or MSISDN: write it as an extra RFC-822 header; and/or include it in the IMAP label. For preference I would do both.)

@Cyber1000
Copy link
Author

@Cyber1000 It turns out I can make some code changes, but I can't push builds to Google Play or f-Droid, or make administrative changes.

I've squash-merged two white-space fix-ups (one overdue and one in your branch), and rebased the multisim branch onto the adjusted master branch; please fetch+reset before adding more commits.

Sorry for the very late reply, had a lot todo last year and no time for this, but now (new mobile with android 14) I got back to this.

Thanks for rebasing, I've fetched my branch again and done 2 commits:

  • merge commit to get the current master

  • I've found out that for my specific information I still need READ_PHONE_STATE on sdk>29 instead of READ_PHONE_NUMBERS, that was a bug I found out with android 11 - so I fixed this

  • For now I'm having the problem, that for iccID, I would need READ_PRIVILEGED_PHONE_STATE rights, which I don't get ( https://developer.android.com/reference/android/telephony/SubscriptionInfo#getIccId() ) - think I would need device-admin, so this works again with android 14.

@Cyber1000
Copy link
Author

Cyber1000 commented Dec 25, 2023

@Cyber1000

Firstly thank-you very much for making a start on this.

I've been reviewing this code, and I'm a bit confused by the ICCID stuff.

As a user, I would naïvely expect that backing up would label each record with either the SIM's ICCID or its MSISDN, so that records are tied to a specific SIM regardless of which slot it's installed in, and that upon restoration, look to see if that SIM or MSISDN is currently present, and if so, write it into the connected call log or SMS database.

However it appears, looking at getUseIccIdForRestore, that it's taking the ICCID from the SIM that's currently in a given slot, and putting that as the PHONE_ACCOUNT_ID.

Is that how it's supposed to work?

(It occurs to me that there are broadly two ways to label the call logs and messages with the relevant ICCID or MSISDN: write it as an extra RFC-822 header; and/or include it in the IMAP label. For preference I would do both.)

Well you are correct, how it works for now:

  • in your old mobile you have two simcards SIM1, SIM2
  • in your new mobile you have to put them in the same order (the order of the two imap-settings in sms-backup+ should be the same on both devices)
  • so getSimCardNumberOrIccId for settingsId 0 (the first SIM) would return the same ICCID as in the old mobile (with App.SimCards[settingsId].IccId) and this would work this way

Things to keep in mind:

subscription_id always seems to be 1-based number of the simcard (1 or 2), at least on all of my devices so far. PHONE_ACCOUNT_ID seems to be different:

  • on my honor 8 some years ago it was 1 or 2 (like subscription_id)
  • on my samsung galaxy A70 it was the iccID (Android 10, then 11)
  • on my new samsung galaxy A54 it is again 1 or 2, which makes sense: subscriptionInfo.getIccId() returns only an empty string on android 14 (see my last post), callog shouldn't expose the iccID, so "%s > ? AND (%s = ? OR %s = ?)" in getQueryForCallLog works again with the simCardNumber.

That said on newer devices I may not get an iccID. After thinking about it I tend to stay with the current implementation, since on newer devices this new iccID-header may work or not. So it's better to just keep the order of SIMS. Don't know why getIccId worked with my samsung galaxy A70, since this more-secure-behaviour should be there since android10, maybe it's OEM-specific behaviour of A70.

@Cyber1000
Copy link
Author

Cyber1000 commented Dec 26, 2023

added a commit, which makes singleSIM safer (actually queries for singlesim now use "1 OR subscription_id = ? OR subscription_id = ?", which leads to always true, for multisims it's " subscription_id = ? OR subscription_id = ?")

Any thoughs? For me and android 14 (multisim) backup works so far.

@kurahaupo
Copy link
Collaborator

@Cyber1000 I'd like to clone your build & test process, and discuss project succession, but that discussion isn't really appropriate here.
Could you please contact me privately at [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants