Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / communicate-dev / src / test / java / com / vayunmathur / communicate / rcs / RcsSlice3Pass2ProvisioningShadow.kt
RcsSlice3Pass2ProvisioningShadow.kt49 lines · 1.8 KiBRaw
| 1 | package com.vayunmathur.communicate.rcs |
| 2 | |
| 3 | import android.telephony.ims.ProvisioningManager |
| 4 | import org.robolectric.annotation.Implementation |
| 5 | import org.robolectric.annotation.Implements |
| 6 | |
| 7 | /** |
| 8 | * Framework ProvisioningManager stand-in reporting single-registration |
| 9 | * capable and no provisioning required, so the provisioning probe's |
| 10 | * "available" path can run on the JVM. |
| 11 | */ |
| 12 | @Implements(ProvisioningManager::class) |
| 13 | class RcsSlice3Pass2ProvisioningShadow { |
| 14 | @Implementation |
| 15 | fun isRcsVolteSingleRegistrationCapable(): Boolean = capable |
| 16 | |
| 17 | // The capability/tech arguments mirror the framework signature; the shadow ignores them. |
| 18 | @Implementation |
| 19 | fun isRcsProvisioningRequiredForCapability( |
| 20 | @Suppress("UnusedParameter") capability: Int, |
| 21 | @Suppress("UnusedParameter") tech: Int, |
| 22 | ): Boolean = provisioningRequired |
| 23 | |
| 24 | // The app queries call-composer (an MmTel capability) through the |
| 25 | // non-RCS provisioning pair, so the shadow reports the flag there too. |
| 26 | @Implementation |
| 27 | fun isProvisioningRequiredForCapability( |
| 28 | @Suppress("UnusedParameter") capability: Int, |
| 29 | @Suppress("UnusedParameter") tech: Int, |
| 30 | ): Boolean = provisioningRequired |
| 31 | |
| 32 | @Implementation |
| 33 | fun getProvisioningStatusForCapability( |
| 34 | @Suppress("UnusedParameter") capability: Int, |
| 35 | @Suppress("UnusedParameter") tech: Int, |
| 36 | ): Boolean = !provisioningRequired |
| 37 | |
| 38 | @Implementation |
| 39 | fun getRcsProvisioningStatusForCapability( |
| 40 | @Suppress("UnusedParameter") capability: Int, |
| 41 | @Suppress("UnusedParameter") tech: Int, |
| 42 | ): Boolean = !provisioningRequired |
| 43 | |
| 44 | companion object { |
| 45 | @Volatile var capable = true |
| 46 | @Volatile var provisioningRequired = false |
| 47 | fun reset() { capable = true; provisioningRequired = false } |
| 48 | } |
| 49 | } |