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

Commit 98e81188 authored by Felipe Leme's avatar Felipe Leme
Browse files

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

Test: adb shell dumpsys activity service com.android.systemui/.SystemUIService --config
Test: adb shell dumpsys activity service com.android.systemui/.SystemUIService
Bug: 141631055

Change-Id: I157824b69e57ea133be666194b2f11c0e1ba36e8
(cherry picked from commit adff0b052d032cd779383a7e518b96acb16f3e44)
parent c60e0323
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]);
        }
    }
}