TIF: Add information of TvInputHardwareManager to dumpsys
Add function dump() to TvInputHardwareManager.
Bug: 22774343
Change-Id: I22e923b95724e4db42824743026c050412a3d28c
diff --git a/services/core/java/com/android/server/tv/TvInputHardwareManager.java b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
index 4e96d71..bf281d6 100644
--- a/services/core/java/com/android/server/tv/TvInputHardwareManager.java
+++ b/services/core/java/com/android/server/tv/TvInputHardwareManager.java
@@ -24,6 +24,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.PackageManager;
import android.hardware.hdmi.HdmiControlManager;
import android.hardware.hdmi.HdmiDeviceInfo;
import android.hardware.hdmi.HdmiHotplugEvent;
@@ -45,6 +46,7 @@
import android.media.tv.TvInputHardwareInfo;
import android.media.tv.TvInputInfo;
import android.media.tv.TvStreamConfig;
+import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
@@ -57,9 +59,13 @@
import android.view.KeyEvent;
import android.view.Surface;
+import com.android.internal.util.IndentingPrintWriter;
import com.android.server.SystemService;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
@@ -549,6 +555,70 @@
return (float) mCurrentIndex / (float) mCurrentMaxIndex;
}
+ public void dump(FileDescriptor fd, final PrintWriter writer, String[] args) {
+ final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
+ if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
+ != PackageManager.PERMISSION_GRANTED) {
+ pw.println("Permission Denial: can't dump TvInputHardwareManager from pid="
+ + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
+ return;
+ }
+
+ synchronized (mLock) {
+ pw.println("TvInputHardwareManager Info:");
+ pw.increaseIndent();
+ pw.println("mConnections: deviceId -> Connection");
+ pw.increaseIndent();
+ for (int i = 0; i < mConnections.size(); i++) {
+ int deviceId = mConnections.keyAt(i);
+ Connection mConnection = mConnections.valueAt(i);
+ pw.println(deviceId + ": " + mConnection);
+
+ }
+ pw.decreaseIndent();
+
+ pw.println("mHardwareList:");
+ pw.increaseIndent();
+ for (TvInputHardwareInfo tvInputHardwareInfo : mHardwareList) {
+ pw.println(tvInputHardwareInfo);
+ }
+ pw.decreaseIndent();
+
+ pw.println("mHdmiDeviceList:");
+ pw.increaseIndent();
+ for (HdmiDeviceInfo hdmiDeviceInfo : mHdmiDeviceList) {
+ pw.println(hdmiDeviceInfo);
+ }
+ pw.decreaseIndent();
+
+ pw.println("mHardwareInputIdMap: deviceId -> inputId");
+ pw.increaseIndent();
+ for (int i = 0 ; i < mHardwareInputIdMap.size(); i++) {
+ int deviceId = mHardwareInputIdMap.keyAt(i);
+ String inputId = mHardwareInputIdMap.valueAt(i);
+ pw.println(deviceId + ": " + inputId);
+ }
+ pw.decreaseIndent();
+
+ pw.println("mHdmiInputIdMap: id -> inputId");
+ pw.increaseIndent();
+ for (int i = 0; i < mHdmiInputIdMap.size(); i++) {
+ int id = mHdmiInputIdMap.keyAt(i);
+ String inputId = mHdmiInputIdMap.valueAt(i);
+ pw.println(id + ": " + inputId);
+ }
+ pw.decreaseIndent();
+
+ pw.println("mInputMap: inputId -> inputInfo");
+ pw.increaseIndent();
+ for(Map.Entry<String, TvInputInfo> entry : mInputMap.entrySet()) {
+ pw.println(entry.getKey() + ": " + entry.getValue());
+ }
+ pw.decreaseIndent();
+ pw.decreaseIndent();
+ }
+ }
+
private class Connection implements IBinder.DeathRecipient {
private final TvInputHardwareInfo mHardwareInfo;
private TvInputInfo mInfo;
@@ -641,6 +711,17 @@
resetLocked(null, null, null, null, null);
}
}
+
+ public String toString() {
+ return "Connection{"
+ + " mHardwareInfo: " + mHardwareInfo
+ + ", mInfo: " + mInfo
+ + ", mCallback: " + mCallback
+ + ", mConfigs: " + Arrays.toString(mConfigs)
+ + ", mCallingUid: " + mCallingUid
+ + ", mResolvedUserId: " + mResolvedUserId
+ + " }";
+ }
}
private class TvInputHardwareImpl extends ITvInputHardware.Stub {