Merge "Dump the system UI components config, so we can check if OEM redefines them." into qt-qpr1-dev

This commit is contained in:
TreeHugger Robot
2019-10-18 22:19:10 +00:00
committed by Android (Google) Code Review

View File

@@ -16,6 +16,7 @@
package com.android.systemui;
import android.annotation.NonNull;
import android.app.Service;
import android.content.Intent;
import android.os.Build;
@@ -66,7 +67,13 @@ public class SystemUIService extends Service {
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (args != null && args.length > 0 && args[0].equals("--config")) {
dumpConfig(pw);
return;
}
dumpServices(((SystemUIApplication) getApplication()).getServices(), fd, pw, args);
dumpConfig(pw);
}
static void dumpServices(
@@ -95,5 +102,29 @@ public class SystemUIService extends Service {
}
}
}
private void dumpConfig(@NonNull PrintWriter pw) {
pw.println("SystemUiServiceComponents configuration:");
pw.print("vendor component: ");
pw.println(getResources().getString(R.string.config_systemUIVendorServiceComponent));
dumpConfig(pw, "global", R.array.config_systemUIServiceComponents);
dumpConfig(pw, "per-user", R.array.config_systemUIServiceComponentsPerUser);
}
private void dumpConfig(@NonNull PrintWriter pw, @NonNull String type, int resId) {
final String[] services = getResources().getStringArray(resId);
pw.print(type); pw.print(": ");
if (services == null) {
pw.println("N/A");
return;
}
pw.print(services.length);
pw.println(" services");
for (int i = 0; i < services.length; i++) {
pw.print(" "); pw.print(i); pw.print(": "); pw.println(services[i]);
}
}
}