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

Fix/Lower the API level requirement for DualSIM devices #205

Open
kamil-cy opened this issue Jan 5, 2023 · 6 comments
Open

Fix/Lower the API level requirement for DualSIM devices #205

kamil-cy opened this issue Jan 5, 2023 · 6 comments

Comments

@kamil-cy
Copy link

kamil-cy commented Jan 5, 2023

In the app/src/main/java/me/lucky/silence/fragment/SimFragment.kt I see this:

val enabled = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
                    Utils.getModemCount(ctx) >= 2

but in the app/src/main/java/me/lucky/silence/Utils.kt I see this:

        fun getModemCount(ctx: Context): Int {
            val telephonyManager = ctx.getSystemService(TelephonyManager::class.java)
            return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
                telephonyManager?.supportedModemCount
            } else {
                @Suppress("deprecation")
                telephonyManager?.phoneCount
            } ?: 0
        }

According to the https://developer.android.com/reference/android/os/Build.VERSION_CODES.html the S means API level >= 31 (Android 12), but in the Utils required version is R which means API level 30 (Android 11).

So if there is no special purpose for a higher API level please lower it to R or better just remove checking the API level an change the SimFragment.kt from

val enabled = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
                    Utils.getModemCount(ctx) >= 2

to just

val enabled = Utils.getModemCount(ctx) >= 2

because you already validating the API level in the fun getModemCount.

Thanks for considering my request.

@Efenstor
Copy link
Contributor

Efenstor commented Feb 1, 2023

It seems that the original developer has disappeared. I've implemented this fix in my fork: https://github.com/Efenstor/Silence. I've decided not to remove the version check from SimFragment.kt, just lowered the version to R. Many thanks for sorting this out, this may be helpful for people with older phones.

@kamil-cy
Copy link
Author

kamil-cy commented Feb 5, 2023

@Efenstor It looks like that the original developer is still here and the last activity was #206 (comment) which is 17 days past I've created this issue. So @x13a are you still here?

About your fork... do you have any plans to release it in the F-droid? For now the Get it on F-Droid button points to the original Silence from F-droid, so it would be grate to install your version of the Silence just from F-Droid app and not from GitHub releases.

If @x13a doesn't have time to maintain this project, maybe you @Efenstor could help? What do you think about taking over this simple project on F-Droid?

@Efenstor
Copy link
Contributor

Efenstor commented Feb 5, 2023

@Efenstor It looks like that the original developer is still here and the last activity was #206 (comment) which is 17 days past I've created this issue. So @x13a are you still here?

About your fork... do you have any plans to release it in the F-droid? For now the Get it on F-Droid button points to the original Silence from F-droid, so it would be grate to install your version of the Silence just from F-Droid app and not from GitHub releases.

If @x13a doesn't have time to maintain this project, maybe you @Efenstor could help? What do you think about taking over this simple project on F-Droid?

I've made my fork just because I desperately needed to make Silence work on LineageOS 19.1 and 20.0. I'm almost dependent on Silence now because my number is constantly bombarded by scam calls (I have a small business, so my number is publicly known). To release it on F-Droid I'd have to rename it, i.e. start a real fork project, but I won't be able to maintain it, that's for sure. I'm just not a programmer anymore, I didn't do any serious programming work for more than a decade.

@kamil-cy
Copy link
Author

kamil-cy commented Feb 6, 2023

I see. Using just F-droid app is very convenient and fast, but as they say beggars can't be choosers.

I still have a hope that the original developer will find some time for this project.

@Efenstor
Copy link
Contributor

Now digging deeper into the code I see that it's all not that simple, so for now I had to revert this change in my fork. The checkSimSlot function needs an alternative mechanism to detect CALL_STATE_RINGING to make it functional under Android 11 (and even earlier). Too bad I am just not a Kotlin programmer (I was a C programmer in the past), there are places in the code which are complete voodoo to me.

@kamil-cy
Copy link
Author

Me either. I've never made nothing useful in Java/Kotlin, so I'm afraid that I can't help you with the code even thought I would really like to.

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

No branches or pull requests

2 participants