diff options
6 files changed, 82 insertions, 1 deletions
diff --git a/core/java/android/hardware/hdmi/HdmiPortInfo.java b/core/java/android/hardware/hdmi/HdmiPortInfo.java index 85e7531..2ec6126 100644 --- a/core/java/android/hardware/hdmi/HdmiPortInfo.java +++ b/core/java/android/hardware/hdmi/HdmiPortInfo.java @@ -166,7 +166,7 @@ public final class HdmiPortInfo implements Parcelable { public String toString() { StringBuffer s = new StringBuffer(); s.append("port_id: ").append(mId).append(", "); - s.append("address: ").append(mAddress).append(", "); + s.append("address: ").append(String.format("0x%04x", mAddress)).append(", "); s.append("cec: ").append(mCecSupported).append(", "); s.append("arc: ").append(mArcSupported).append(", "); s.append("mhl: ").append(mMhlSupported); diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java index 827b3ed..584ba6a 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecController.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java @@ -23,6 +23,7 @@ import android.os.MessageQueue; import android.util.Slog; import android.util.SparseArray; +import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Predicate; import com.android.server.hdmi.HdmiAnnotations.IoThreadOnly; import com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly; @@ -30,6 +31,8 @@ import com.android.server.hdmi.HdmiControlService.DevicePollingCallback; import libcore.util.EmptyArray; +import java.io.FileDescriptor; +import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; @@ -598,6 +601,15 @@ final class HdmiCecController { mService.onHotplug(port, connected); } + void dump(final IndentingPrintWriter pw) { + for (int i = 0; i < mLocalDevices.size(); ++i) { + pw.println("HdmiCecLocalDevice #" + i + ":"); + pw.increaseIndent(); + mLocalDevices.valueAt(i).dump(pw); + pw.decreaseIndent(); + } + } + private static native long nativeInit(HdmiCecController handler, MessageQueue messageQueue); private static native int nativeSendCecCommand(long controllerPtr, int srcAddress, int dstAddress, byte[] body); diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java index a12e4fc..38addba 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java @@ -28,6 +28,7 @@ import android.view.KeyCharacterMap; import android.view.KeyEvent; import com.android.internal.annotations.GuardedBy; +import com.android.internal.util.IndentingPrintWriter; import com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly; import java.util.ArrayList; @@ -97,6 +98,17 @@ abstract class HdmiCecLocalDevice { public int hashCode() { return logicalAddress * 29 + physicalAddress; } + @Override + public String toString() { + StringBuffer s = new StringBuffer(); + String logicalAddressString = (logicalAddress == Constants.ADDR_INVALID) + ? "invalid" : String.format("0x%02x", logicalAddress); + s.append("logical_address: ").append(logicalAddressString); + String physicalAddressString = (physicalAddress == Constants.INVALID_PHYSICAL_ADDRESS) + ? "invalid" : String.format("0x%04x", physicalAddress); + s.append(", physical_address: ").append(physicalAddressString); + return s.toString(); + } } // Logical address of the active source. @GuardedBy("mLock") @@ -793,4 +805,16 @@ abstract class HdmiCecLocalDevice { protected void sendKeyEvent(int keyCode, boolean isPressed) { Slog.w(TAG, "sendKeyEvent not implemented"); } + + /** + * Dump internal status of HdmiCecLocalDevice object. + */ + protected void dump(final IndentingPrintWriter pw) { + pw.println("mDeviceType: " + mDeviceType); + pw.println("mAddress: " + mAddress); + pw.println("mPreferredAddress: " + mPreferredAddress); + pw.println("mDeviceInfo: " + mDeviceInfo); + pw.println("mActiveSource: " + mActiveSource); + pw.println(String.format("mActiveRoutingPath: 0x%04x", mActiveRoutingPath)); + } } diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java index 5a2fa9c..6603a71 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java @@ -23,6 +23,7 @@ import android.os.RemoteException; import android.os.SystemProperties; import android.util.Slog; +import com.android.internal.util.IndentingPrintWriter; import com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly; /** @@ -219,4 +220,10 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice { mIsActiveSource = false; checkIfPendingActionsCleared(); } + + @Override + protected void dump(final IndentingPrintWriter pw) { + super.dump(pw); + pw.println("mIsActiveSource: " + mIsActiveSource); + } }
\ No newline at end of file diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java index cd56cfc..1ab8069 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java @@ -45,6 +45,7 @@ import android.util.Slog; import android.util.SparseArray; import com.android.internal.annotations.GuardedBy; +import com.android.internal.util.IndentingPrintWriter; import com.android.server.hdmi.DeviceDiscoveryAction.DeviceDiscoveryCallback; import com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly; import com.android.server.hdmi.HdmiControlService.SendMessageCallback; @@ -1610,4 +1611,16 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { invokeDeviceEventListener(newInfo, HdmiControlManager.DEVICE_EVENT_UPDATE_DEVICE); } + + @Override + protected void dump(final IndentingPrintWriter pw) { + super.dump(pw); + pw.println("mArcEstablished: " + mArcEstablished); + pw.println("mArcFeatureEnabled: " + mArcFeatureEnabled); + pw.println("mSystemAudioActivated: " + mSystemAudioActivated); + pw.println("mSystemAudioMute: " + mSystemAudioMute); + pw.println("mAutoDeviceOff: " + mAutoDeviceOff); + pw.println("mAutoWakeup: " + mAutoWakeup); + pw.println("mSkipRoutingControl: " + mSkipRoutingControl); + } } diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index e7b920a..d13e1de 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -67,6 +67,7 @@ import android.util.SparseArray; import android.util.SparseIntArray; import com.android.internal.annotations.GuardedBy; +import com.android.internal.util.IndentingPrintWriter; import com.android.server.SystemService; import com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly; import com.android.server.hdmi.HdmiCecController.AllocateAddressCallback; @@ -75,6 +76,8 @@ import com.android.server.hdmi.HdmiCecLocalDevice.PendingActionClearedCallback; import libcore.util.EmptyArray; +import java.io.FileDescriptor; +import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -1395,6 +1398,28 @@ public final class HdmiControlService extends SystemService { enforceAccessPermission(); HdmiControlService.this.addHdmiMhlScratchpadCommandListener(listener); } + + @Override + protected void dump(FileDescriptor fd, final PrintWriter writer, String[] args) { + getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG); + final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " "); + + pw.println("mHdmiControlEnabled: " + mHdmiControlEnabled); + pw.println("mProhibitMode: " + mProhibitMode); + if (mCecController != null) { + pw.println("mCecController: "); + pw.increaseIndent(); + mCecController.dump(pw); + pw.decreaseIndent(); + } + pw.println("mPortInfo: "); + pw.increaseIndent(); + for (HdmiPortInfo hdmiPortInfo : mPortInfo) { + pw.println("- " + hdmiPortInfo); + } + pw.decreaseIndent(); + pw.println("mPowerStatus: " + mPowerStatus); + } } @ServiceThreadOnly |
