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

Commit 623122cd authored by Christofer Åkersten's avatar Christofer Åkersten
Browse files

Ensure members are non-null in callback

Bug: 74570008
Test: runtest-cts-MediaComponents -r 100
Change-Id: I59590afae4e67fa8a90f8a7b4a6be58ce54e2806
parent 660a7639
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -775,8 +775,7 @@ public final class MediaSessionManager {
                        public void run() {
                            final Context context = mContext;
                            if (context != null) {
                                ArrayList<MediaController> controllers
                                        = new ArrayList<MediaController>();
                                ArrayList<MediaController> controllers = new ArrayList<>();
                                int size = tokens.size();
                                for (int i = 0; i < size; i++) {
                                    controllers.add(new MediaController(context, tokens.get(i)));
@@ -814,11 +813,17 @@ public final class MediaSessionManager {
        private final ISessionTokensListener.Stub mStub = new ISessionTokensListener.Stub() {
            @Override
            public void onSessionTokensChanged(final List<Bundle> bundles) {
                mExecutor.execute(() -> {
                    List<SessionToken2> tokens = toTokenList(mContext, bundles);
                    mListener.onSessionTokensChanged(tokens);
                final Executor executor = mExecutor;
                if (executor != null) {
                    executor.execute(() -> {
                        final Context context = mContext;
                        final OnSessionTokensChangedListener listener = mListener;
                        if (context != null && listener != null) {
                            listener.onSessionTokensChanged(toTokenList(context, bundles));
                        }
                    });
                }
            }
        };

        private void release() {