Fixed UserManagerService / UserSystemPackageInstaller dump() methods
The latter was creating a IndentingPrintWriter, which in turn would close the underlying PrintWriter used by the former; hence, nothing else could be dumped() afterwards. Test: manual verification Fixes: 163423525 Change-Id: Ie310f0dac2db9ba0af85ae484fcb30511b5a44b4
This commit is contained in:
@@ -87,6 +87,7 @@ import android.stats.devicepolicy.DevicePolicyEnums;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
import android.util.AtomicFile;
|
||||
import android.util.IndentingPrintWriter;
|
||||
import android.util.IntArray;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
@@ -103,7 +104,6 @@ import com.android.internal.os.BackgroundThread;
|
||||
import com.android.internal.util.DumpUtils;
|
||||
import com.android.internal.util.FastXmlSerializer;
|
||||
import com.android.internal.util.FrameworkStatsLog;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.internal.util.XmlUtils;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
@@ -4828,9 +4828,17 @@ public class UserManagerService extends IUserManager.Stub {
|
||||
mUserTypes.valueAt(i).dump(pw, " ");
|
||||
}
|
||||
|
||||
// Dump package whitelist
|
||||
pw.println();
|
||||
mSystemPackageInstaller.dump(pw);
|
||||
// TODO: create IndentingPrintWriter at the beginning of dump() and use the proper
|
||||
// indentation methods instead of explicit printing " "
|
||||
try (IndentingPrintWriter ipw = new IndentingPrintWriter(pw)) {
|
||||
|
||||
// Dump SystemPackageInstaller info
|
||||
ipw.println();
|
||||
mSystemPackageInstaller.dump(ipw);
|
||||
|
||||
// NOTE: pw's not available after this point as it's auto-closed by ipw, so new dump
|
||||
// statements should use ipw below
|
||||
}
|
||||
}
|
||||
|
||||
private static void dumpTimeAgo(PrintWriter pw, StringBuilder sb, long nowTime, long time) {
|
||||
|
||||
@@ -28,15 +28,14 @@ import android.os.UserHandle;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
import android.util.DebugUtils;
|
||||
import android.util.IndentingPrintWriter;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
import com.android.server.LocalServices;
|
||||
import com.android.server.SystemConfig;
|
||||
import com.android.server.pm.parsing.pkg.AndroidPackage;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
@@ -723,13 +722,7 @@ class UserSystemPackageInstaller {
|
||||
return userTypeList;
|
||||
}
|
||||
|
||||
void dump(PrintWriter pw) {
|
||||
try (IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ")) {
|
||||
dumpIndented(ipw);
|
||||
}
|
||||
}
|
||||
|
||||
private void dumpIndented(IndentingPrintWriter pw) {
|
||||
void dump(IndentingPrintWriter pw) {
|
||||
final int mode = getWhitelistMode();
|
||||
pw.println("Whitelisted packages per user type");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user