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

Commit 68b0e884 authored by arunvoddu's avatar arunvoddu
Browse files

Add Telephony flag configs to the dumpsys

Adds the telephony flag configurations to the dumpsys
so that we have the flag states available in the bugreport for
debugging.

Bug: 309156871
Test: Verified in bugreport
Change-Id: Ic8fd871d8df61b97ebef7cc0af2add83296b6350
parent c465b6d1
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import com.android.telephony.Rlog;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

@@ -521,6 +522,27 @@ public class PhoneFactory {
        return sMetricsCollector;
    }

    /**
     * Print all feature flag configurations that Telephony is using for debugging purposes.
     */
    private static void reflectAndPrintFlagConfigs(IndentingPrintWriter pw) {

        try {
            // Look away, a forbidden technique (reflection) is being used to allow us to get
            // all flag configs without having to add them manually to this method.
            Method[] methods = FeatureFlags.class.getMethods();
            if (methods.length == 0) {
                pw.println("NONE");
                return;
            }
            for (Method m : methods) {
                pw.println(m.getName() + "-> " + m.invoke(sFeatureFlags));
            }
        } catch (Exception e) {
            pw.println("[ERROR]");
        }
    }

    public static void dump(FileDescriptor fd, PrintWriter printwriter, String[] args) {
        IndentingPrintWriter pw = new IndentingPrintWriter(printwriter, "  ");
        pw.println("PhoneFactory:");
@@ -613,8 +635,15 @@ public class PhoneFactory {
        } catch (Exception e) {
            e.printStackTrace();
        }
        pw.flush();
        pw.decreaseIndent();

        pw.println("++++++++++++++++++++++++++++++++");
        pw.println("Flag Configurations:");
        pw.increaseIndent();
        reflectAndPrintFlagConfigs(pw);
        pw.flush();
        pw.decreaseIndent();
        pw.println("++++++++++++++++++++++++++++++++");
    }
}