Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64171fe1 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

implement Dumpable for some keyguard classes

Test: adb shell dumpsys activity service com.android.systemui
Change-Id: I0f241ce6d26c36cc5b64d060ff21ce1986910dd0
parent 6de32457
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -359,6 +359,7 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
                notifLog,
                dozeParameters,
                scrimController,
                null /* keyguardLiftController */,
                lockscreenWallpaperLazy,
                biometricUnlockControllerLazy,
                dozeServiceHost,
+7 −2
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@ import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.widget.LockPatternUtils;
import com.android.settingslib.WirelessUtils;
import com.android.systemui.DejankUtils;
import com.android.systemui.DumpController;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.dagger.qualifiers.MainLooper;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -126,7 +128,7 @@ import javax.inject.Singleton;
 * to be updated.
 */
@Singleton
public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpable {

    private static final String TAG = "KeyguardUpdateMonitor";
    private static final boolean DEBUG = KeyguardConstants.DEBUG;
@@ -1499,11 +1501,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {

    @VisibleForTesting
    @Inject
    protected KeyguardUpdateMonitor(Context context, @MainLooper Looper mainLooper) {
    protected KeyguardUpdateMonitor(Context context, @MainLooper Looper mainLooper,
            DumpController dumpController) {
        mContext = context;
        mSubscriptionManager = SubscriptionManager.from(context);
        mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
        mStrongAuthTracker = new StrongAuthTracker(context, this::notifyStrongAuthStateChanged);
        dumpController.registerDumpable(this);

        mHandler = new Handler(mainLooper) {
            @Override
@@ -2787,6 +2791,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        }
    }

    @Override
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("KeyguardUpdateMonitor state:");
        pw.println("  SIM States:");
+13 −3
Original line number Diff line number Diff line
@@ -44,6 +44,16 @@ class DumpController @Inject constructor() : Dumpable {
    val numListeners: Int
        get() = listeners.size

    /**
     * Adds a [Dumpable] dumpable to be dumped.
     *
     * @param dumpable the [Dumpable] to be added
     */
    fun registerDumpable(dumpable: Dumpable) {
        Preconditions.checkNotNull(dumpable, "The dumpable to be added cannot be null")
        registerDumpable(dumpable.javaClass.simpleName, dumpable)
    }

    /**
     * Adds a [Dumpable] dumpable to be dumped.
     *
@@ -79,11 +89,11 @@ class DumpController @Inject constructor() : Dumpable {
    /**
     * Dump all the [Dumpable] registered with the controller
     */
    override fun dump(fd: FileDescriptor?, pw: PrintWriter, args: Array<String>?) {
    override fun dump(fd: FileDescriptor, pw: PrintWriter, args: Array<String>) {
        pw.println("DumpController state:")

        val filter = if (args != null && args.size >= 3 &&
                args[0] == "dependency" && args[1] == "DumpController") {
        val filter = if (args.size >= 3 && args[0].toLowerCase() == "dependency" &&
                args[1] == "DumpController") {
            ArraySet(args[2].split(',').map { it.toLowerCase() })
        } else {
            null
+16 −1
Original line number Diff line number Diff line
@@ -14,9 +14,24 @@

package com.android.systemui;

import androidx.annotation.NonNull;

import java.io.FileDescriptor;
import java.io.PrintWriter;

/**
 * Implemented by classes who want to be in:
 *   {@code adb shell dumpsys activity service com.android.systemui}
 *
 * @see DumpController
 */
public interface Dumpable {
    void dump(FileDescriptor fd, PrintWriter pw, String[] args);

    /**
     * Called when it's time to dump the internal state
     * @param fd A file descriptor.
     * @param pw Where to write your dump to.
     * @param args Arguments.
     */
    void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args);
}
+3 −3
Original line number Diff line number Diff line
@@ -133,10 +133,10 @@ open class BroadcastDispatcher @Inject constructor (
    protected open fun createUBRForUser(userId: Int) =
            UserBroadcastDispatcher(context, userId, mainHandler, bgLooper)

    override fun dump(fd: FileDescriptor?, pw: PrintWriter?, args: Array<out String>?) {
        pw?.println("Broadcast dispatcher:")
    override fun dump(fd: FileDescriptor, pw: PrintWriter, args: Array<out String>) {
        pw.println("Broadcast dispatcher:")
        for (index in 0 until receiversByUser.size()) {
            pw?.println("  User ${receiversByUser.keyAt(index)}")
            pw.println("  User ${receiversByUser.keyAt(index)}")
            receiversByUser.valueAt(index).dump(fd, pw, args)
        }
    }
Loading