jberkel / sms-backup-plus

Backup Android SMS, MMS and call log to Gmail / Gcal / IMAP
https://play.google.com/store/apps/details?id=com.zegoggles.smssync
Apache License 2.0
1.8k stars 499 forks source link

added changes for multisim, added tests #1080

Open Cyber1000 opened 2 years ago

Cyber1000 commented 2 years ago

Added support for multisim (see #598):

Cyber1000 commented 2 years ago

Mulitisim

Multisim

Settings for second SIM

Settings_Sim2

Settings for SMS

SMS

Settings for Callog

Calllog

Special Restore setting

IccId

hieu76 commented 2 years ago

Vào 4:16, CN, 29 thg 5, 2022 Cyber1000 @.***> đã viết:

[image: IccId] https://user-images.githubusercontent.com/1142765/170843074-5c4fbe24-ef7c-4617-b484-3b632a5210a3.jpg [image: Multisim] https://user-images.githubusercontent.com/1142765/170843076-5c49748a-fa63-48a4-b8ef-394183ca9886.jpg [image: Settings_Sim2] https://user-images.githubusercontent.com/1142765/170843077-117c8118-1bec-44cc-a4a0-a7fae27fa6cd.jpg [image: SMS] https://user-images.githubusercontent.com/1142765/170843078-2762d778-1872-407e-9934-db97de483d08.jpg [image: Calllog] https://user-images.githubusercontent.com/1142765/170843079-9f2bc590-2d4e-444d-ac71-595c3eee590a.jpg

— Reply to this email directly, view it on GitHub https://github.com/jberkel/sms-backup-plus/pull/1080#issuecomment-1140330648, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHG3HMBOSBPIOP6ZLQC2OEDVMKEKBANCNFSM5XHE7SHQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Vaentus commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

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

kurahaupo commented 2 years ago

@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 commented 9 months ago

@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:

Cyber1000 commented 9 months ago

@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:

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:

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 commented 9 months ago

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 commented 8 months ago

@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 martin@kurahaupo.gen.nz