]> gitweb.stoutner.com Git - PrivacyCell.git/commitdiff
Repopulate the realtime monitoring notification every 15 minutes. https://redmine...
authorSoren Stoutner <soren@stoutner.com>
Thu, 26 Oct 2023 22:27:44 +0000 (15:27 -0700)
committerSoren Stoutner <soren@stoutner.com>
Thu, 26 Oct 2023 22:27:44 +0000 (15:27 -0700)
app/src/main/assets/de/permissions.html
app/src/main/assets/it/permissions.html
app/src/main/assets/ru/permissions.html
app/src/main/java/com/stoutner/privacycell/services/RealtimeMonitoringService.kt
app/src/main/java/com/stoutner/privacycell/workers/RegisterRealtimeListenerWorker.kt

index ae2b5b0d41dc50ef8d94cf0d669cdbafd113ab01..b6895010dcda7d23b2358be4e5179dc1fbd2e54c 100644 (file)
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#READ_PHONE_STATE">android.permission.<wbr>READ_<wbr>PHONE_<wbr>STATE</a></p>
         <p>Benötigt, um die vom Mobilfunk-Netzwerk genutzten Protokolle zu ermitteln.</p>
 
-        <h3>Show Notifications</h3>
+        <h3>Zeige Benachrichtigungen</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#POST_NOTIFICATIONS">android.permission.<wbr>POST_<wbr>NOTIFICATIONS</a></p>
         <p>Erlaubt Privacy Cell, ein Benachrichtigungs-Icon für die Echtzeit-Überwachung in der Status-Zeile anzuzeigen.</p>
 
         <h3>Vordergrund-Service ausführen</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE">android.permission.<wbr>FOREGROUND_<wbr>SERVICE</a></p>
-        <p>Allows Privacy Cell to update the realtime monitoring notification icon when the app is not in the foreground.</p>
+        <p>Erlaubt Privacy Cell, das Benachrichtigungs-Icon für die Echtzeit-Überwachung in der Status-Zeile zu aktualisieren, auch wenn die App im Hintergrund läuft.</p>
 
+        <h3>Spezieller Vordergrund-Service</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE_SPECIAL_USE">android.permission.<wbr>FOREGROUND_<wbr>SERVICE_<wbr>SPECIAL_<wbr>USE</a></p>
-        <p>Specifies the type of foreground service.
-            Special Use is for services that don't fit into any of the <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">standard categories</a>.</p>
+        <p>Legt den Typ des verwendeten Vordergrund-Services fest. "Special Use" wird für Services verwendet, die nicht in die
+            <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">Standard-Kategorien</a> für Vordergrund-Services (z.B. Medienwiedergabe, Positionsbestimmung, etc.) fallen.</p>
 
         <h3>Ausführung bei Systemstart</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission#RECEIVE_BOOT_COMPLETED">android.permission.<wbr>RECEIVE_<wbr>BOOT_<wbr>COMPLETED</a></p>
index 226b5dc7d414e9259c961bfd6c5c64d9d430f5fe..bd71ddb04d14606b020aa4213146c0bfaf739024 100644 (file)
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#READ_PHONE_STATE">android.permission.<wbr>READ_<wbr>PHONE_<wbr>STATE</a></p>
         <p>Richiesta per determinare i protocolli utilizzati dalla rete.</p>
 
-        <h3>Show Notifications</h3>
+        <h3>Mostra notifiche</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#POST_NOTIFICATIONS">android.permission.<wbr>POST_<wbr>NOTIFICATIONS</a></p>
-        <p>Allows Privacy Cell to display a realtime monitoring notification icon in the status bar.</p>
+        <p>Permette a Privacy Cell di mostrare una icona di notifica di monitoraggio in tempo reale nella barra di stato.</p>
 
-        <h3>Run foreground service</h3>
+        <h3>Esegui il servizio in primo piano</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE">android.permission.<wbr>FOREGROUND_<wbr>SERVICE</a></p>
-        <p>Allows Privacy Cell to update the realtime monitoring notification icon when the app is not in the foreground.</p>
+        <p>Permette a Privacy Cell di aggiornare licona di notifica di monitoraggio in tempo reale anche quando la app non è in primo piano.</p>
 
         <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE_SPECIAL_USE">android.permission.<wbr>FOREGROUND_<wbr>SERVICE_<wbr>SPECIAL_<wbr>USE</a></p>
-        <p>Specifies the type of foreground service.
-            Special Use is for services that don't fit into any of the <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">standard categories</a>.</p>
+        <p>Specifica il tipo di servizio in primo piano.
+            L'utilizzo speciale è per i servizi che non ricadono in nessuna delle <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">categorie standard</a>.</p>
 
-        <h3>Run at startup</h3>
+        <h3>Esegui all'avvio</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission#RECEIVE_BOOT_COMPLETED">android.permission.<wbr>RECEIVE_<wbr>BOOT_<wbr>COMPLETED</a></p>
-        <p>Allows Privacy Cell to enable the realtime monitoring service when the phone boots.</p>
+        <p>Permette a Privacy Cell di abilitare il servizio di monitoraggio in tempo reale durante l'avvio del dispositivo.</p>
 
         <h3><a href="https://developer.android.com/about/versions/13/features#runtime-receivers">com.stoutner.privacycell.<wbr>DYNAMIC_<wbr>RECEIVER_<wbr>NOT_<wbr>EXPORTED_<wbr>PERMISSION</a></h3>
         <p>Aggiunta automaticamente a tutte le App che hanno come target API >= 33 (Android 13) per impedire ad altre App di connettersi ai ricevitori dinamici senza una autorizzazione esplicita.</p>
index 8e3b4ea41b86747fe82a3d973f893c1e5995c279..9f8b4897614adbac339bffe352b2be22de2415a2 100644 (file)
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#READ_PHONE_STATE">android.permission.<wbr>READ_<wbr>PHONE_<wbr>STATE</a></p>
         <p>Необходим для определения используемых протоколов в сети сотовой связи.</p>
 
-        <h3>Show Notifications</h3>
+        <h3>Отображение уведомлений</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission.html#POST_NOTIFICATIONS">android.permission.<wbr>POST_<wbr>NOTIFICATIONS</a></p>
         <p>Разрешает Privacy Cell отображать значок уведомления о мониторинге в реальном времени в строке состояния.</p>
 
         <h3>Запуск фоновой службы</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE">android.permission.<wbr>FOREGROUND_<wbr>SERVICE</a></p>
-        <p>Allows Privacy Cell to update the realtime monitoring notification icon when the app is not in the foreground.</p>
+        <p>Разрешает Privacy Cell обновлять значок уведомления о мониторинге в реальном времени при работе приложения в фоновом режиме.</p>
 
         <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE_SPECIAL_USE">android.permission.<wbr>FOREGROUND_<wbr>SERVICE_<wbr>SPECIAL_<wbr>USE</a></p>
-        <p>Specifies the type of foreground service.
-            Special Use is for services that don't fit into any of the <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">standard categories</a>.</p>
+        <p>Определяет тип сервиса фонового режима.
+            Специальное использование предназначено для сервисов, которые не соответствуют ни одной из
+            <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">стандартных категорий</a>.</p>
 
         <h3>Запуск при загрузке</h3>
         <p><a href="https://developer.android.com/reference/android/Manifest.permission#RECEIVE_BOOT_COMPLETED">android.permission.<wbr>RECEIVE_<wbr>BOOT_<wbr>COMPLETED</a></p>
index 9c1b05231ecac1a8ca1d9f2740ae6ecc6e3ec1cb..72ace814d742aac8de7f08c6e4540ba2205b302e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2021-2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2021-2023 Soren Stoutner <soren@stoutner.com>.
  *
  * This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>.
  *
@@ -204,9 +204,9 @@ class RealtimeMonitoringService : Service() {
 
             // Check to see if the read phone state permission has been granted.
             if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
-                // Create a register realtime listener work request that fires every hour.
-                // This periodic request will fire shortly after being created (it fires about every hour near the beginning of the hour) and will reregister the listener if it gets garbage collected.
-                val registerRealtimeListenerWorkRequest = PeriodicWorkRequestBuilder<RegisterRealtimeListenerWorker>(1, TimeUnit.HOURS).build()
+                // Create a register realtime listener work request that fires every fifteen minutes.
+                // This periodic request will fire shortly after being created and will reregister the listener if it gets garbage collected.
+                val registerRealtimeListenerWorkRequest = PeriodicWorkRequestBuilder<RegisterRealtimeListenerWorker>(15, TimeUnit.MINUTES).build()
 
                 // Register the realtime listener work request.
                 WorkManager.getInstance(this).enqueueUniquePeriodicWork(getString(R.string.register_listener_work_request), ExistingPeriodicWorkPolicy.REPLACE, registerRealtimeListenerWorkRequest)
@@ -235,10 +235,16 @@ class RealtimeMonitoringService : Service() {
     }
 
     fun populateNotification() {
+        // Get the list of current notifications.
+        val activeNotificationsArray = notificationManager.activeNotifications
+
+        // Check to see if there is a current notification.
+        val noCurrentNotification = activeNotificationsArray.isEmpty()
+
         // Populate the notification according to the security status.
         if ((voiceNetworkSecurityStatus == ProtocolHelper.ANTIQUATED) || (dataNetworkSecurityStatus == ProtocolHelper.ANTIQUATED)) {  // This is an antiquated network.
             // Only update the notification if the network status has changed.
-            if (currentStatus != ANTIQUATED_NETWORK) {
+            if ((currentStatus != ANTIQUATED_NETWORK) || noCurrentNotification) {
                 // Create an antiquated network notification builder.
                 val antiquatedNetworkNotificationBuilder = Notification.Builder(applicationContext, ANTIQUATED_NETWORK)
 
@@ -265,7 +271,7 @@ class RealtimeMonitoringService : Service() {
             }
         } else if ((voiceNetworkSecurityStatus == ProtocolHelper.INSECURE) || (dataNetworkSecurityStatus == ProtocolHelper.INSECURE)) {  // This is an insecure network.
             // Only update the notification if the network status has changed.
-            if (currentStatus != INSECURE_NETWORK) {
+            if ((currentStatus != INSECURE_NETWORK) || noCurrentNotification) {
                 // Create an insecure network notification builder.
                 val insecureNetworkNotificationBuilder = Notification.Builder(applicationContext, INSECURE_NETWORK)
 
@@ -292,7 +298,7 @@ class RealtimeMonitoringService : Service() {
             }
         } else {  // This is a secure network.
             // Only update the notification if the network status has changed.
-            if (currentStatus != SECURE_NETWORK) {
+            if ((currentStatus != SECURE_NETWORK) || noCurrentNotification) {
                 // Create a secure network notification builder.
                 val secureNetworkNotificationBuilder = Notification.Builder(applicationContext, SECURE_NETWORK)
 
index d899bf78252196c2d5583cf63be9e24851fa6398..7eeea89b2dfb22e54844605e361477a65995e682 100644 (file)
@@ -77,6 +77,9 @@ class RegisterRealtimeListenerWorker(appContext: Context, workerParameters: Work
                         // Register the telephony manager listener.
                         realtimeMonitoringService.registerTelephonyManagerListener()
 
+                        // Populate the notification, which might have been accidentally dismissed by the user beginning in Android 14.
+                        realtimeMonitoringService.populateNotification()
+
                         // Unbind the service.
                         applicationContext.unbindService(this)
                     }