Ignore ACTION_PRIMARY_SUBSCRIPTION_LIST_CHANGED event if satellite session is started

When satellite session is started, we need to suppress the 'Choose SIM for mobile data' and 'Update preferred SIM' dialogs to prevent user turn on SIM.

Bug: 334139957
Test: atest, manual
Change-Id: Id56a98f3d1cfd38875173a643c992393d3dbeec8
This commit is contained in:
Samuel Huang
2024-04-23 15:18:36 +00:00
parent 1ece0152d2
commit faa640e8fc
7 changed files with 253 additions and 21 deletions

View File

@@ -82,6 +82,8 @@ class SatelliteRepository(
* `false` otherwise.
*/
fun requestIsSessionStarted(executor: Executor): ListenableFuture<Boolean> {
isSessionStarted?.let { return immediateFuture(it) }
val satelliteManager: SatelliteManager? =
context.getSystemService(SatelliteManager::class.java)
if (satelliteManager == null) {
@@ -166,10 +168,6 @@ class SatelliteRepository(
}
}
companion object {
private const val TAG: String = "SatelliteRepository"
}
/**
* Check if the modem is in a satellite session.
*
@@ -184,5 +182,16 @@ class SatelliteRepository(
else -> true
}
}
companion object {
private const val TAG: String = "SatelliteRepository"
private var isSessionStarted: Boolean? = null
@VisibleForTesting
fun setIsSessionStartedForTesting(isEnabled: Boolean) {
this.isSessionStarted = isEnabled
}
}
}