Avoid running hasCompanionDevices on main thread

Fixes: 63348899, 63309685
Test: Ensure b/63348899 doesn't reproduce
Change-Id: I93717bf7c3fab2ca32ec7cedf1cbd64fe1b6bbf2
This commit is contained in:
Eugene Susla
2017-08-24 11:28:08 -07:00
parent 77af296764
commit a25d17ff10

View File

@@ -158,6 +158,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.os.BackgroundThread;
import com.android.internal.statusbar.NotificationVisibility;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.DumpUtils;
@@ -5571,13 +5572,10 @@ public class NotificationManagerService extends SystemService {
continue;
}
mHandler.post(new Runnable() {
@Override
public void run() {
if (hasCompanionDevice(serviceInfo)) {
notifyNotificationChannelChanged(
serviceInfo, pkg, user, channel, modificationType);
}
BackgroundThread.getHandler().post(() -> {
if (hasCompanionDevice(serviceInfo)) {
notifyNotificationChannelChanged(
serviceInfo, pkg, user, channel, modificationType);
}
});
}
@@ -5594,13 +5592,10 @@ public class NotificationManagerService extends SystemService {
continue;
}
mHandler.post(new Runnable() {
@Override
public void run() {
if (hasCompanionDevice(serviceInfo)) {
notifyNotificationChannelGroupChanged(
serviceInfo, pkg, user, group, modificationType);
}
BackgroundThread.getHandler().post(() -> {
if (hasCompanionDevice(serviceInfo)) {
notifyNotificationChannelGroupChanged(
serviceInfo, pkg, user, group, modificationType);
}
});
}