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

Commit 2b22f9e2 authored by Jaewan Kim's avatar Jaewan Kim
Browse files

MediaSessionService: Leave log for any session creation failure

This would help to debug why MediaSessionService fails to create a new session
without leaving log from the app side.

Bug: 155993197
Test: Build
Change-Id: I8427467d5866a5611d539ec08425be6e948b5540
parent 15ab8e10
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1134,8 +1134,19 @@ public class MediaSessionService extends SystemService implements Monitor {
                if (cb == null) {
                    throw new IllegalArgumentException("Controller callback cannot be null");
                }
                return createSessionInternal(pid, uid, resolvedUserId, packageName, cb, tag,
                        sessionInfo).getSessionBinder();
                MediaSessionRecord session = createSessionInternal(
                        pid, uid, resolvedUserId, packageName, cb, tag, sessionInfo);
                if (session == null) {
                    throw new IllegalStateException("Failed to create a new session record");
                }
                ISession sessionBinder = session.getSessionBinder();
                if (sessionBinder == null) {
                    throw new IllegalStateException("Invalid session record");
                }
                return sessionBinder;
            } catch (Exception e) {
                Slog.w(TAG, "Exception in creating a new session", e);
                throw e;
            } finally {
                Binder.restoreCallingIdentity(token);
            }