ECM notification is not displayed when the user is NOT the primary one
EmergencyCallbackModeService only runs under the primary user
and its notification is only sent to the primary user.
Now use NotificationManager.notifyAsUser with UserHandle.All
to display this important notification to all users.
Test: Manual test
Fix: 144979126
Merged-In: I20247d83646d0f7952951c15e1a6b4c3a6fee3db
Change-Id: I20247d83646d0f7952951c15e1a6b4c3a6fee3db
(cherry picked from commit 34b1b6464eb7ce67c49bbe747a3c8683c5655b14)
diff --git a/src/com/android/phone/EmergencyCallbackModeService.java b/src/com/android/phone/EmergencyCallbackModeService.java
index c7e4cc7..6b247bd 100644
--- a/src/com/android/phone/EmergencyCallbackModeService.java
+++ b/src/com/android/phone/EmergencyCallbackModeService.java
@@ -30,6 +30,7 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
+import android.os.UserHandle;
import android.sysprop.TelephonyProperties;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -106,7 +107,8 @@
mPhone.unregisterForEcmTimerReset(mHandler);
// Cancel the notification and timer
- mNotificationManager.cancel(R.string.phone_in_ecm_notification_title);
+ mNotificationManager.cancelAsUser(null, R.string.phone_in_ecm_notification_title,
+ UserHandle.ALL);
mTimer.cancel();
}
}
@@ -221,7 +223,8 @@
builder.setChannelId(NotificationChannelController.CHANNEL_ID_ALERT);
// Show notification
- mNotificationManager.notify(R.string.phone_in_ecm_notification_title, builder.build());
+ mNotificationManager.notifyAsUser(null, R.string.phone_in_ecm_notification_title,
+ builder.build(), UserHandle.ALL);
}
/**