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

Commit 2f6258bb authored by Santiago Seifert's avatar Santiago Seifert Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE in MR2ServiceImpl#checkArgumentsForSessionControl" into main

parents b82529c9 526804c7
Loading
Loading
Loading
Loading
+25 −5
Original line number Diff line number Diff line
@@ -2336,6 +2336,11 @@ class MediaRouter2ServiceImpl {
                    mSystemProvider.getDefaultRoute());
        }

        private static String getPackageNameFromNullableRecord(
                @Nullable RouterRecord routerRecord) {
            return routerRecord != null ? routerRecord.mPackageName : "<null router record>";
        }

        private static String toLoggingMessage(
                String source, String providerId, ArrayList<MediaRoute2Info> routes) {
            String routesString =
@@ -2573,8 +2578,17 @@ class MediaRouter2ServiceImpl {

            RouterRecord matchingRecord = mSessionToRouterMap.get(uniqueSessionId);
            if (matchingRecord != routerRecord) {
                Slog.w(TAG, "Ignoring " + description + " route from non-matching router. "
                        + "packageName=" + routerRecord.mPackageName + " route=" + route);
                Slog.w(
                        TAG,
                        "Ignoring "
                                + description
                                + " route from non-matching router."
                                + " routerRecordPackageName="
                                + getPackageNameFromNullableRecord(routerRecord)
                                + " matchingRecordPackageName="
                                + getPackageNameFromNullableRecord(matchingRecord)
                                + " route="
                                + route);
                return false;
            }

@@ -2613,9 +2627,15 @@ class MediaRouter2ServiceImpl {
                @Nullable RouterRecord routerRecord, @NonNull String uniqueSessionId) {
            final RouterRecord matchingRecord = mSessionToRouterMap.get(uniqueSessionId);
            if (matchingRecord != routerRecord) {
                Slog.w(TAG, "Ignoring releasing session from non-matching router. packageName="
                        + (routerRecord == null ? null : routerRecord.mPackageName)
                        + " uniqueSessionId=" + uniqueSessionId);
                Slog.w(
                        TAG,
                        "Ignoring releasing session from non-matching router."
                                + " routerRecordPackageName="
                                + getPackageNameFromNullableRecord(routerRecord)
                                + " matchingRecordPackageName="
                                + getPackageNameFromNullableRecord(matchingRecord)
                                + " uniqueSessionId="
                                + uniqueSessionId);
                return;
            }