Merge changes I5a36dac7,Ie88dc61d

* changes:
  Move EventLogger.dump call to MR2ServiceImpl.dump
  Add logging for route provider service proxies
This commit is contained in:
Santiago Seifert
2022-10-18 15:46:20 +00:00
committed by Android (Google) Code Review
3 changed files with 22 additions and 14 deletions

View File

@@ -84,12 +84,7 @@ final class MediaRoute2ProviderServiceProxy extends MediaRoute2Provider
}
public void dump(PrintWriter pw, String prefix) {
pw.println(prefix + "Proxy");
pw.println(prefix + " mUserId=" + mUserId);
pw.println(prefix + " mRunning=" + mRunning);
pw.println(prefix + " mBound=" + mBound);
pw.println(prefix + " mActiveConnection=" + mActiveConnection);
pw.println(prefix + " mConnectionReady=" + mConnectionReady);
pw.println(prefix + getDebugString());
}
public void setManagerScanning(boolean managerScanning) {
@@ -494,7 +489,16 @@ final class MediaRoute2ProviderServiceProxy extends MediaRoute2Provider
@Override
public String toString() {
return "Service connection " + mComponentName.flattenToShortString();
return getDebugString();
}
private String getDebugString() {
return TextUtils.formatSimple(
"ProviderServiceProxy - package: %s, bound: %b, connection (active:%b, ready:%b)",
mComponentName.getPackageName(),
mBound,
mActiveConnection != null,
mConnectionReady);
}
private final class Connection implements DeathRecipient {

View File

@@ -63,10 +63,15 @@ final class MediaRoute2ProviderWatcher {
}
public void dump(PrintWriter pw, String prefix) {
pw.println(prefix + "Watcher");
pw.println(prefix + " mUserId=" + mUserId);
pw.println(prefix + " mRunning=" + mRunning);
pw.println(prefix + " mProxies.size()=" + mProxies.size());
pw.println(prefix + "MediaRoute2ProviderWatcher");
prefix += " ";
if (mProxies.isEmpty()) {
pw.println(prefix + "<no provider service proxies>");
} else {
for (MediaRoute2ProviderServiceProxy proxy : mProxies) {
proxy.dump(pw, prefix);
}
}
}
public void start() {

View File

@@ -628,8 +628,9 @@ class MediaRouter2ServiceImpl {
mUserRecords.valueAt(i).dump(pw, indent + " ");
}
} else {
pw.println(indent + "<no user records>");
pw.println(indent + " <no user records>");
}
mEventLogger.dump(pw, indent);
}
}
@@ -1382,8 +1383,6 @@ class MediaRouter2ServiceImpl {
if (!mHandler.runWithScissors(() -> mHandler.dump(pw, indent), 1000)) {
pw.println(indent + "<could not dump handler state>");
}
mEventLogger.dump(pw, indent);
}
}