Revert "Add logic to update the notification whenever the satellite availaibility changes."

This reverts commit 739b7d27ee08dc0403d8eeb1ba926eb2d1618c19.

Reason for revert: bug: b/380782318
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:30e3e06f3e18201a1ca097b9bad8d5c860d2a1b7)
Merged-In: I2e551a50fee929fbc63b3120f2735b64ecd711f3
Change-Id: I2e551a50fee929fbc63b3120f2735b64ecd711f3
diff --git a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
index f17377c..251ba65 100644
--- a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
+++ b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
@@ -184,8 +184,7 @@
     private static final String KEY_AVAILABLE_NOTIFICATION_SHOWN = "available_notification_shown";
     private static final String KEY_UNAVAILABLE_NOTIFICATION_SHOWN =
             "unavailable_notification_shown";
-    private static final String AVAILABLE_NOTIFICATION_TAG = "available_notification_tag";
-    private static final String UNAVAILABLE_NOTIFICATION_TAG = "unavailable_notification_tag";
+    private static final String NOTIFICATION_TAG = "SatelliteAccessController";
     private static final int NOTIFICATION_ID = 1;
     private static final String NOTIFICATION_CHANNEL = "satelliteChannel";
     private static final String NOTIFICATION_CHANNEL_ID = "satellite";
@@ -1454,41 +1453,44 @@
         }
 
         if (mSatelliteDisallowedReasons.isEmpty()) {
-            mNotificationManager.cancel(UNAVAILABLE_NOTIFICATION_TAG, NOTIFICATION_ID);
-            if (!hasAlreadyNotified(KEY_AVAILABLE_NOTIFICATION_SHOWN)) {
+            if (!hasAlreadyNotified(KEY_AVAILABLE_NOTIFICATION_SHOWN, 0)) {
                 mNotificationManager.notifyAsUser(
-                        AVAILABLE_NOTIFICATION_TAG,
+                        NOTIFICATION_TAG,
                         NOTIFICATION_ID,
                         mSatelliteAvailableNotification,
                         UserHandle.ALL
                 );
-                markAsNotified(KEY_AVAILABLE_NOTIFICATION_SHOWN, true);
-                markAsNotified(KEY_UNAVAILABLE_NOTIFICATION_SHOWN, false);
+                markAsNotified(KEY_AVAILABLE_NOTIFICATION_SHOWN, 0);
             }
         } else {
-            mNotificationManager.cancel(AVAILABLE_NOTIFICATION_TAG, NOTIFICATION_ID);
             for (Integer reason : mSatelliteDisallowedReasons) {
-                if (!hasAlreadyNotified(KEY_UNAVAILABLE_NOTIFICATION_SHOWN)) {
+                if (!hasAlreadyNotified(KEY_UNAVAILABLE_NOTIFICATION_SHOWN, reason)) {
                     mNotificationManager.notifyAsUser(
-                            UNAVAILABLE_NOTIFICATION_TAG,
+                            NOTIFICATION_TAG,
                             NOTIFICATION_ID,
                             mSatelliteUnAvailableNotifications.get(reason),
                             UserHandle.ALL
                     );
-                    markAsNotified(KEY_UNAVAILABLE_NOTIFICATION_SHOWN, true);
-                    markAsNotified(KEY_AVAILABLE_NOTIFICATION_SHOWN, false);
+                    markAsNotified(KEY_UNAVAILABLE_NOTIFICATION_SHOWN, reason);
                     break;
                 }
             }
         }
     }
 
-    private boolean hasAlreadyNotified(String key) {
-        return mSharedPreferences.getBoolean(key, false);
+    private boolean hasAlreadyNotified(String key, int reason) {
+        Set<String> reasons = mSharedPreferences.getStringSet(key, new HashSet<>());
+        return reasons.contains(String.valueOf(reason));
     }
 
-    private void markAsNotified(String key, boolean notified) {
-        mSharedPreferences.edit().putBoolean(key, notified).apply();
+    private void markAsNotified(String key, int reason) {
+        Set<String> reasons = mSharedPreferences.getStringSet(key, new HashSet<>());
+        if (!reasons.contains(String.valueOf(reason))) {
+            reasons.add(String.valueOf(reason));
+            SharedPreferences.Editor editor = mSharedPreferences.edit();
+            editor.putStringSet(key, reasons);
+            editor.apply();
+        }
     }
 
     /**