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

Commit 305a6bd1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Dump the system UI components config, so we can check if OEM redefines...

Merge "Dump the system UI components config, so we can check if OEM redefines them." into qt-qpr1-dev
parents 5284336d 98e81188
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -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]);
        }
    }
}