Merge "Log transferring and fix verbose system logs" into rvc-dev am: 6edbf48c2b am: ee897cb490
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11862403 Change-Id: Ib51292338fa465782d9cc85c88edf99331cd74e5
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user