Merge "[NMS] Call isServiceTokenValidLocked with lock." am: e672a9336d

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2128209

Change-Id: I2b7fe5e7de3dcbb107207e282070ecae8c0f3012
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Julia Reynolds
2022-07-26 11:17:51 +00:00
committed by Automerger Merge Worker

View File

@@ -9909,10 +9909,16 @@ public class NotificationManagerService extends SystemService {
* given NAS is bound in. * given NAS is bound in.
*/ */
private boolean isInteractionVisibleToListener(ManagedServiceInfo info, int userId) { private boolean isInteractionVisibleToListener(ManagedServiceInfo info, int userId) {
boolean isAssistantService = mAssistants.isServiceTokenValidLocked(info.service); boolean isAssistantService = isServiceTokenValid(info.service);
return !isAssistantService || info.isSameUser(userId); return !isAssistantService || info.isSameUser(userId);
} }
private boolean isServiceTokenValid(IInterface service) {
synchronized (mNotificationLock) {
return mAssistants.isServiceTokenValidLocked(service);
}
}
private boolean isPackageSuspendedForUser(String pkg, int uid) { private boolean isPackageSuspendedForUser(String pkg, int uid) {
final long identity = Binder.clearCallingIdentity(); final long identity = Binder.clearCallingIdentity();
int userId = UserHandle.getUserId(uid); int userId = UserHandle.getUserId(uid);
@@ -11169,7 +11175,7 @@ public class NotificationManagerService extends SystemService {
BackgroundThread.getHandler().post(() -> { BackgroundThread.getHandler().post(() -> {
if (info.isSystem if (info.isSystem
|| hasCompanionDevice(info) || hasCompanionDevice(info)
|| mAssistants.isServiceTokenValidLocked(info.service)) { || isServiceTokenValid(info.service)) {
notifyNotificationChannelChanged( notifyNotificationChannelChanged(
info, pkg, user, channel, modificationType); info, pkg, user, channel, modificationType);
} }