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

Commit beb94220 authored by Santiago Seifert's avatar Santiago Seifert
Browse files

Make MR2ProviderServiceProxy take looper by param

The functionality doesn't change, because the calling function is
already running on the looper that the constructor gets. But this may
save someone from being bitten by the call to myLooper in the future.

Note that we avoid sharing the handler instance. Otherwise, one class
could inadvertently remove a message posted by the other class. And
sharing it would mean this change is no longer non-functional.

Bug: b/205124386
Test: Added logs to verify that myLooper was already the MediaRouterService looper thread.
Flag: EXEMPT refactor
Change-Id: Ia7f8dd472caa97162e61c28f56ef7e5fa8659309
parent 26724a4c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ final class MediaRoute2ProviderServiceProxy extends MediaRoute2Provider

    MediaRoute2ProviderServiceProxy(
            @NonNull Context context,
            @NonNull Looper looper,
            @NonNull ComponentName componentName,
            boolean isSelfScanOnlyProvider,
            int userId) {
@@ -88,7 +89,7 @@ final class MediaRoute2ProviderServiceProxy extends MediaRoute2Provider
        mContext = Objects.requireNonNull(context, "Context must not be null.");
        mIsSelfScanOnlyProvider = isSelfScanOnlyProvider;
        mUserId = userId;
        mHandler = new Handler(Looper.myLooper());
        mHandler = new Handler(looper);
    }

    public void setManagerScanning(boolean managerScanning) {
+1 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ final class MediaRoute2ProviderWatcher {
                    MediaRoute2ProviderServiceProxy proxy =
                            new MediaRoute2ProviderServiceProxy(
                                    mContext,
                                    mHandler.getLooper(),
                                    new ComponentName(serviceInfo.packageName, serviceInfo.name),
                                    isSelfScanOnlyProvider,
                                    mUserId);