Merge "Add dumpsys for HIDL broadcastradio service" into tm-qpr-dev am: efca0d29f1

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

Change-Id: Iad15c3c33a634712abcac8ef6736e263a3cd43c4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Weilin Xu
2022-08-18 01:12:23 +00:00
committed by Automerger Merge Worker
4 changed files with 88 additions and 1 deletions

View File

@@ -26,11 +26,14 @@ import android.hardware.radio.ITuner;
import android.hardware.radio.ITunerCallback;
import android.hardware.radio.RadioManager;
import android.os.RemoteException;
import android.util.IndentingPrintWriter;
import android.util.Slog;
import com.android.server.SystemService;
import com.android.server.broadcastradio.hal2.AnnouncementAggregator;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -46,7 +49,7 @@ public class BroadcastRadioService extends SystemService {
private final com.android.server.broadcastradio.hal2.BroadcastRadioService mHal2;
private final Object mLock = new Object();
private List<RadioManager.ModuleProperties> mV1Modules = null;
private final List<RadioManager.ModuleProperties> mV1Modules;
public BroadcastRadioService(Context context) {
super(context);
@@ -115,5 +118,21 @@ public class BroadcastRadioService extends SystemService {
return mHal2.addAnnouncementListener(enabledTypes, listener);
}
}
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
IndentingPrintWriter radioPw = new IndentingPrintWriter(pw);
radioPw.printf("BroadcastRadioService\n");
radioPw.increaseIndent();
radioPw.printf("HAL1: %s\n", mHal1);
radioPw.increaseIndent();
radioPw.printf("Modules of HAL1: %s\n", mV1Modules);
radioPw.decreaseIndent();
radioPw.printf("HAL2:\n");
radioPw.increaseIndent();
mHal2.dumpInfo(radioPw);
radioPw.decreaseIndent();
radioPw.decreaseIndent();
}
}
}

View File

@@ -29,6 +29,7 @@ import android.hidl.manager.V1_0.IServiceManager;
import android.hidl.manager.V1_0.IServiceNotification;
import android.os.IHwBinder.DeathRecipient;
import android.os.RemoteException;
import android.util.IndentingPrintWriter;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
@@ -195,4 +196,30 @@ public class BroadcastRadioService {
}
return aggregator;
}
/**
* Dump state of broadcastradio service for HIDL HAL 2.0.
*
* @param pw The file to which BroadcastRadioService state is dumped.
*/
public void dumpInfo(IndentingPrintWriter pw) {
synchronized (mLock) {
pw.printf("Next module id available: %d\n", mNextModuleId);
pw.printf("ServiceName to module id map:\n");
pw.increaseIndent();
for (Map.Entry<String, Integer> entry : mServiceNameToModuleIdMap.entrySet()) {
pw.printf("Service name: %s, module id: %d\n", entry.getKey(), entry.getValue());
}
pw.decreaseIndent();
pw.printf("Radio modules:\n");
pw.increaseIndent();
for (Map.Entry<Integer, RadioModule> moduleEntry : mModules.entrySet()) {
pw.printf("Module id=%d:\n", moduleEntry.getKey());
pw.increaseIndent();
moduleEntry.getValue().dumpInfo(pw);
pw.decreaseIndent();
}
pw.decreaseIndent();
}
}
}

View File

@@ -38,6 +38,7 @@ import android.os.DeadObjectException;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.util.IndentingPrintWriter;
import android.util.MutableInt;
import android.util.Slog;
@@ -424,4 +425,30 @@ class RadioModule {
return BitmapFactory.decodeByteArray(rawImage, 0, rawImage.length);
}
void dumpInfo(IndentingPrintWriter pw) {
pw.printf("RadioModule\n");
pw.increaseIndent();
synchronized (mLock) {
pw.printf("BroadcastRadioService: %s\n", mService);
pw.printf("Properties: %s\n", mProperties);
pw.printf("HIDL2.0 HAL TunerSession: %s\n", mHalTunerSession);
pw.printf("Is antenna connected? ");
if (mAntennaConnected == null) {
pw.printf("null\n");
} else {
pw.printf("%s\n", mAntennaConnected ? "Yes" : "No");
}
pw.printf("current ProgramInfo: %s\n", mCurrentProgramInfo);
pw.printf("ProgramInfoCache: %s\n", mProgramInfoCache);
pw.printf("Union of AIDL ProgramFilters: %s\n", mUnionOfAidlProgramFilters);
pw.printf("AIDL TunerSessions:\n");
pw.increaseIndent();
for (TunerSession aidlTunerSession : mAidlTunerSessions) {
aidlTunerSession.dumpInfo(pw);
}
pw.decreaseIndent();
}
pw.decreaseIndent();
}
}

View File

@@ -27,6 +27,7 @@ import android.hardware.radio.ProgramList;
import android.hardware.radio.ProgramSelector;
import android.hardware.radio.RadioManager;
import android.os.RemoteException;
import android.util.IndentingPrintWriter;
import android.util.Log;
import android.util.MutableBoolean;
import android.util.MutableInt;
@@ -339,4 +340,17 @@ class TunerSession extends ITuner.Stub {
() -> mHwSession.getParameters(Convert.listToArrayList(keys))));
}
}
void dumpInfo(IndentingPrintWriter pw) {
pw.printf("TunerSession\n");
pw.increaseIndent();
synchronized (mLock) {
pw.printf("HIDL HAL Session: %s\n", mHwSession);
pw.printf("Is session closed? %s\n", mIsClosed ? "Yes" : "No");
pw.printf("Is muted? %s\n", mIsMuted ? "Yes" : "No");
pw.printf("ProgramInfoCache: %s\n", mProgramInfoCache);
pw.printf("Config: %s\n", mDummyConfig);
}
pw.decreaseIndent();
}
}