Merge "Initial implementation of bug report dump" into main
This commit is contained in:
@@ -75,6 +75,15 @@ public final class DeviceConfigService extends Binder {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
final IContentProvider iprovider = mProvider.getIContentProvider();
|
||||
pw.println("device config properties:");
|
||||
for (String line : MyShellCommand.listAll(iprovider)) {
|
||||
pw.println(line);
|
||||
}
|
||||
}
|
||||
|
||||
private void callUpdableDeviceConfigShellCommandHandler(FileDescriptor in, FileDescriptor out,
|
||||
FileDescriptor err, String[] args, ResultReceiver resultReceiver) {
|
||||
int result = -1;
|
||||
@@ -111,6 +120,31 @@ public final class DeviceConfigService extends Binder {
|
||||
mProvider = provider;
|
||||
}
|
||||
|
||||
public static List<String> listAll(IContentProvider provider) {
|
||||
final ArrayList<String> lines = new ArrayList<>();
|
||||
|
||||
try {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(Settings.CALL_METHOD_USER_KEY,
|
||||
ActivityManager.getService().getCurrentUser().id);
|
||||
Bundle b = provider.call(new AttributionSource(Process.myUid(),
|
||||
resolveCallingPackage(), null), Settings.AUTHORITY,
|
||||
Settings.CALL_METHOD_LIST_CONFIG, null, args);
|
||||
if (b != null) {
|
||||
Map<String, String> flagsToValues =
|
||||
(HashMap) b.getSerializable(Settings.NameValueTable.VALUE);
|
||||
for (String key : flagsToValues.keySet()) {
|
||||
lines.add(key + "=" + flagsToValues.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(lines);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException("Failed in IPC", e);
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
@SuppressLint("AndroidFrameworkRequiresPermission")
|
||||
@Override
|
||||
public int onCommand(String cmd) {
|
||||
@@ -391,31 +425,6 @@ public final class DeviceConfigService extends Binder {
|
||||
return success;
|
||||
}
|
||||
|
||||
private List<String> listAll(IContentProvider provider) {
|
||||
final ArrayList<String> lines = new ArrayList<>();
|
||||
|
||||
try {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(Settings.CALL_METHOD_USER_KEY,
|
||||
ActivityManager.getService().getCurrentUser().id);
|
||||
Bundle b = provider.call(new AttributionSource(Process.myUid(),
|
||||
resolveCallingPackage(), null), Settings.AUTHORITY,
|
||||
Settings.CALL_METHOD_LIST_CONFIG, null, args);
|
||||
if (b != null) {
|
||||
Map<String, String> flagsToValues =
|
||||
(HashMap) b.getSerializable(Settings.NameValueTable.VALUE);
|
||||
for (String key : flagsToValues.keySet()) {
|
||||
lines.add(key + "=" + flagsToValues.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(lines);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException("Failed in IPC", e);
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
private static String resolveCallingPackage() {
|
||||
switch (Binder.getCallingUid()) {
|
||||
case Process.ROOT_UID: {
|
||||
|
||||
Reference in New Issue
Block a user