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

Commit f4e19347 authored by Kyunglyul Hyun's avatar Kyunglyul Hyun Committed by Automerger Merge Worker
Browse files

Merge "Log transferring and fix verbose system logs" into rvc-dev am: 6edbf48c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11862403

Change-Id: I2eec7ffe20aee4a68cf1eb30da33f778dba88ef2
parents b531c05a 6edbf48c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 */
public abstract class MediaRoute2ProviderService extends Service {
    private static final String TAG = "MR2ProviderService";
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);

    /**
     * The {@link Intent} action that must be declared as handled by the service.
@@ -238,6 +239,11 @@ public abstract class MediaRoute2ProviderService extends Service {
            @NonNull RoutingSessionInfo sessionInfo) {
        Objects.requireNonNull(sessionInfo, "sessionInfo must not be null");

        if (DEBUG) {
            Log.d(TAG, "notifySessionCreated: Creating a session. requestId=" + requestId
                    + ", sessionInfo=" + sessionInfo);
        }

        if (requestId != REQUEST_ID_NONE && !removeRequestId(requestId)) {
            Log.w(TAG, "notifySessionCreated: The requestId doesn't exist. requestId=" + requestId);
            return;
@@ -269,6 +275,10 @@ public abstract class MediaRoute2ProviderService extends Service {
    public final void notifySessionUpdated(@NonNull RoutingSessionInfo sessionInfo) {
        Objects.requireNonNull(sessionInfo, "sessionInfo must not be null");

        if (DEBUG) {
            Log.d(TAG, "notifySessionUpdated: Updating session id=" + sessionInfo);
        }

        String sessionId = sessionInfo.getId();
        synchronized (mSessionLock) {
            if (mSessionInfo.containsKey(sessionId)) {
@@ -299,6 +309,10 @@ public abstract class MediaRoute2ProviderService extends Service {
        if (TextUtils.isEmpty(sessionId)) {
            throw new IllegalArgumentException("sessionId must not be empty");
        }
        if (DEBUG) {
            Log.d(TAG, "notifySessionReleased: Releasing session id=" + sessionId);
        }

        RoutingSessionInfo sessionInfo;
        synchronized (mSessionLock) {
            sessionInfo = mSessionInfo.remove(sessionId);
+1 −0
Original line number Diff line number Diff line
@@ -378,6 +378,7 @@ public final class MediaRouter2 {
     */
    public void transferTo(@NonNull MediaRoute2Info route) {
        Objects.requireNonNull(route, "route must not be null");
        Log.v(TAG, "Transferring to route: " + route);
        transfer(getCurrentController(), route);
    }

+2 −0
Original line number Diff line number Diff line
@@ -321,6 +321,8 @@ public final class MediaRouter2Manager {
        Objects.requireNonNull(packageName, "packageName must not be null");
        Objects.requireNonNull(route, "route must not be null");

        Log.v(TAG, "Selecting route. packageName= " + packageName + ", route=" + route);

        List<RoutingSessionInfo> sessionInfos = getRoutingSessions(packageName);
        RoutingSessionInfo targetSession = sessionInfos.get(sessionInfos.size() - 1);
        transfer(targetSession, route);
+2 −2
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.os.Looper;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.text.TextUtils;
import android.util.Log;
import android.util.Slog;

import com.android.internal.R;
@@ -58,8 +59,7 @@ import java.util.Objects;
// TODO: check thread safety. We may need to use lock to protect variables.
class SystemMediaRoute2Provider extends MediaRoute2Provider {
    private static final String TAG = "MR2SystemProvider";
    // TODO(b/156996903): Revert it when releasing the framework.
    private static final boolean DEBUG = true;
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);

    static final String DEFAULT_ROUTE_ID = "DEFAULT_ROUTE";
    static final String DEVICE_ROUTE_ID = "DEVICE_ROUTE";