diff --git a/ModemConfig/AndroidManifest.xml b/ModemConfig/AndroidManifest.xml index 975d789..9bd8a27 100644 --- a/ModemConfig/AndroidManifest.xml +++ b/ModemConfig/AndroidManifest.xml @@ -7,6 +7,7 @@ Konfigurationsinfo Modem-Konfiguration - Benutze Modem-Konfiguration: %1$s\nFirmware-Datei: %2$s + Steckplatz %1$s + Modem-Konfiguration: %1$s\nFirmware-Datei: %2$s Keine passende Modem-Konfiguration gefunden - \ No newline at end of file + diff --git a/ModemConfig/res/values-fr/strings.xml b/ModemConfig/res/values-fr/strings.xml index 9659340..e1eb6f9 100644 --- a/ModemConfig/res/values-fr/strings.xml +++ b/ModemConfig/res/values-fr/strings.xml @@ -3,6 +3,7 @@ Informations de configuration Configuration du modem - Configuration du modem utilisée : %1$s\nFirmware utilisé: %2$s - Aucune configuration de modem trouvée - \ No newline at end of file + Port SIM %1$s + Configuration du modem utilisée : %1$s\n Chemin d\'accès du firmware : %2$s + Aucune configuration modem Trouvée + diff --git a/ModemConfig/res/values-it/strings.xml b/ModemConfig/res/values-it/strings.xml index da58586..cf20daf 100644 --- a/ModemConfig/res/values-it/strings.xml +++ b/ModemConfig/res/values-it/strings.xml @@ -3,6 +3,7 @@ Informazioni configurazione Configurazione Modem - Uso configurazione modem %1$s\nFile firmware: %2$s + Slot %1$s + Configurazione modem: %1$s\nFile firmware: %2$s Nessuna configurazione modem trovata - \ No newline at end of file + diff --git a/ModemConfig/res/values/strings.xml b/ModemConfig/res/values/strings.xml index b0b93bb..fce9f74 100644 --- a/ModemConfig/res/values/strings.xml +++ b/ModemConfig/res/values/strings.xml @@ -1,6 +1,6 @@ - ModemConfig + Open Devices ModemConfig /oem/modem-config modem.conf @@ -8,6 +8,7 @@ Configuration info Modem configuration - Using modem configuration: %1$s\nFirmware file: %2$s - Found no modem configuration - \ No newline at end of file + Slot %1$s + Modem configuration: %1$s\nFirmware file: %2$s + No modem configuration found + diff --git a/ModemConfig/src/com/sony/opentelephony/modemconfig/ModemConfigService.kt b/ModemConfig/src/com/sony/opentelephony/modemconfig/ModemConfigService.kt index 94860e3..e9bf5cd 100644 --- a/ModemConfig/src/com/sony/opentelephony/modemconfig/ModemConfigService.kt +++ b/ModemConfig/src/com/sony/opentelephony/modemconfig/ModemConfigService.kt @@ -36,7 +36,9 @@ import java.nio.file.Paths private const val TAG = "ModemConfigReceiver" private const val VERBOSE = false private const val NOTIFICATION_CHANNEL_ID = "Configuration" +private const val NOTIFICATION_GROUP_KEY_SLOTS = "com.sony.opentelephony.modemconfig.slot_result" private const val NOTIFICATION_ID = 1 +private const val NOTIFICATION_ID_SLOT_BASE = 1000 private val newlineMatch = Regex("[\n\r]") @@ -209,15 +211,22 @@ context.resources.getXml(R.xml.service_provider_sim_configs).use { resources.getString(R.string.notification_text_modem_configuration_no_match) } - val notification = Notification.Builder(this, NOTIFICATION_CHANNEL_ID).run { - setSmallIcon(R.drawable.ic_sim_card) - setContentTitle(resources.getString(R.string.notification_title_modem_configuration)) - setContentText(notificationText.substringBefore('\n')) - style = Notification.BigTextStyle().bigText(notificationText) - build() - } + val notification = Notification.Builder(this@ModemConfigService, + NOTIFICATION_CHANNEL_ID) + .run { + setSmallIcon(R.drawable.ic_sim_card) + setContentTitle(resources.getString( + R.string.notification_title_slot_index, + sub.simSlotIndex)) + setContentText(notificationText.substringBefore('\n')) + setGroup(NOTIFICATION_GROUP_KEY_SLOTS) + setSortKey(sub.simSlotIndex.toString()) + style = Notification.BigTextStyle() + .bigText(notificationText) + build() + } - notificationManager.notify(NOTIFICATION_ID, notification) + notificationManager.notify(NOTIFICATION_ID_SLOT_BASE + sub.simSlotIndex, notification) } override fun onCreate() { @@ -238,7 +247,27 @@ context.resources.getXml(R.xml.service_provider_sim_configs).use { // caching at all. The modem-switcher itself makes sure to not needlessly flash // firmware - let it handle the validation. override fun onSubscriptionsChanged() { - sm.activeSubscriptionInfoList?.forEach(::handleSubscription) + sm.activeSubscriptionInfoList?.run { + if (any()) { + val summaryNotification = Notification.Builder( + this@ModemConfigService, + NOTIFICATION_CHANNEL_ID) + .run { + setSmallIcon(R.drawable.ic_sim_card) + setContentTitle(resources.getString( + R.string.notification_title_modem_configuration + )) + setGroup(NOTIFICATION_GROUP_KEY_SLOTS) + setGroupSummary(true) + build() + } + + notificationManager.notify(NOTIFICATION_ID, summaryNotification) + } + + forEach(::handleSubscription) + } + } }) }