Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a25d17ff authored by Eugene Susla's avatar Eugene Susla
Browse files

Avoid running hasCompanionDevices on main thread

Fixes: 63348899, 63309685
Test: Ensure b/63348899 doesn't reproduce
Change-Id: I93717bf7c3fab2ca32ec7cedf1cbd64fe1b6bbf2
parent 77af2967
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -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,14 +5572,11 @@ public class NotificationManagerService extends SystemService {
                    continue;
                }

                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                BackgroundThread.getHandler().post(() -> {
                    if (hasCompanionDevice(serviceInfo)) {
                        notifyNotificationChannelChanged(
                                serviceInfo, pkg, user, channel, modificationType);
                    }
                    }
                });
            }
        }
@@ -5594,14 +5592,11 @@ public class NotificationManagerService extends SystemService {
                    continue;
                }

                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                BackgroundThread.getHandler().post(() -> {
                    if (hasCompanionDevice(serviceInfo)) {
                        notifyNotificationChannelGroupChanged(
                                serviceInfo, pkg, user, group, modificationType);
                    }
                    }
                });
            }
        }