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

Commit 45a84c33 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make ConnectionRecord reference ServiceState" into main

parents 28e5ce80 685cc6f9
Loading
Loading
Loading
Loading
+13 −12
Original line number Original line Diff line number Diff line
@@ -111,7 +111,7 @@ public abstract class MediaBrowserService extends Service {
     * All the info about a connection.
     * All the info about a connection.
     */
     */
    private static class ConnectionRecord implements IBinder.DeathRecipient {
    private static class ConnectionRecord implements IBinder.DeathRecipient {
        public final MediaBrowserService service;
        public final ServiceState serviceState;
        public final String pkg;
        public final String pkg;
        public final int pid;
        public final int pid;
        public final int uid;
        public final int uid;
@@ -121,9 +121,14 @@ public abstract class MediaBrowserService extends Service {
        public final HashMap<String, List<Pair<IBinder, Bundle>>> subscriptions = new HashMap<>();
        public final HashMap<String, List<Pair<IBinder, Bundle>>> subscriptions = new HashMap<>();


        ConnectionRecord(
        ConnectionRecord(
                MediaBrowserService service, String pkg, int pid, int uid, Bundle rootHints,
                ServiceState serviceState,
                IMediaBrowserServiceCallbacks callbacks, BrowserRoot root) {
                String pkg,
            this.service = service;
                int pid,
                int uid,
                Bundle rootHints,
                IMediaBrowserServiceCallbacks callbacks,
                BrowserRoot root) {
            this.serviceState = serviceState;
            this.pkg = pkg;
            this.pkg = pkg;
            this.pid = pid;
            this.pid = pid;
            this.uid = uid;
            this.uid = uid;
@@ -134,12 +139,8 @@ public abstract class MediaBrowserService extends Service {


        @Override
        @Override
        public void binderDied() {
        public void binderDied() {
            service.mHandler.post(new Runnable() {
            serviceState.postOnHandler(
                @Override
                    () -> serviceState.mConnections.remove(callbacks.asBinder()));
                public void run() {
                    service.mServiceState.mConnections.remove(callbacks.asBinder());
                }
            });
        }
        }
    }
    }


@@ -706,7 +707,7 @@ public abstract class MediaBrowserService extends Service {
            // in onGetRoot().
            // in onGetRoot().
            mCurConnection =
            mCurConnection =
                    new ConnectionRecord(
                    new ConnectionRecord(
                            /* service= */ MediaBrowserService.this,
                            /* serviceState= */ this,
                            pkg,
                            pkg,
                            pid,
                            pid,
                            uid,
                            uid,
@@ -728,7 +729,7 @@ public abstract class MediaBrowserService extends Service {
                try {
                try {
                    ConnectionRecord connection =
                    ConnectionRecord connection =
                            new ConnectionRecord(
                            new ConnectionRecord(
                                    /* service= */ MediaBrowserService.this,
                                    /* serviceState= */ this,
                                    pkg,
                                    pkg,
                                    pid,
                                    pid,
                                    uid,
                                    uid,