RebootEscrow: add bugreport dump

To make it a little easier to understand the current state
in a bugreport, log some of the internal state when a dump
is requested.

(cherry picked from commit cdd8467a34)

Bug: 151512506
Test: adb shell dumpsys lock_settings
Merged-In: If6889737a5be452833f587db5400dc5fde27cd47
Change-Id: If6889737a5be452833f587db5400dc5fde27cd47
This commit is contained in:
Kenny Root
2020-03-13 12:12:58 -07:00
parent 4f9ab82c08
commit 618887858e
2 changed files with 27 additions and 0 deletions

View File

@@ -3193,6 +3193,12 @@ public class LockSettingsService extends ILockSettings.Stub {
mStrongAuth.dump(pw);
pw.println();
pw.decreaseIndent();
pw.println("RebootEscrow:");
pw.increaseIndent();
mRebootEscrowManager.dump(pw);
pw.println();
pw.decreaseIndent();
}
/**

View File

@@ -18,6 +18,7 @@ package com.android.server.locksettings;
import static android.os.UserHandle.USER_SYSTEM;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.content.Context;
@@ -35,6 +36,7 @@ import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.widget.RebootEscrowListener;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
@@ -390,4 +392,23 @@ class RebootEscrowManager {
void setRebootEscrowListener(RebootEscrowListener listener) {
mRebootEscrowListener = listener;
}
void dump(@NonNull PrintWriter pw) {
pw.print("mRebootEscrowWanted=");
pw.println(mRebootEscrowWanted);
pw.print("mRebootEscrowReady=");
pw.println(mRebootEscrowReady);
pw.print("mRebootEscrowListener=");
pw.println(mRebootEscrowListener);
boolean keySet;
synchronized (mKeyGenerationLock) {
keySet = mPendingRebootEscrowKey != null;
}
pw.print("mPendingRebootEscrowKey is ");
pw.println(keySet ? "set" : "not set");
}
}