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

Commit 0f2dc8d0 authored by Tor Norbye's avatar Tor Norbye
Browse files

118395019: Hide constants and methods in StatsLogInternal

This CL updates the code generator which creates the
hidden StatsLogInternal class to explicitly hide
the generated constants and write methods as well.

The intent of this class was for everything to be hidden,
but it turns out that public methods and fields in
hidden classes which are extended by a public class also
ends up in the SDK, even though they don't appear in the
signature file. StringBuilder#setLength(int) is an
example of this.

Bug: 118395019
Test: make sdk
Change-Id: I97e510e8155ee50ade653f6abeb5479c7ca9029d
parent 9ebc299b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -705,6 +705,7 @@ static void write_java_method(
    const AtomDecl &attributionDecl) {
    for (set<vector<java_type_t>>::const_iterator signature = signatures.begin();
        signature != signatures.end(); signature++) {
        fprintf(out, "    /** @hide */\n");
        fprintf(out, "    public static native int %s(int code", method_name.c_str());
        int argIndex = 1;
        for (vector<java_type_t>::const_iterator arg = signature->begin();
@@ -748,6 +749,7 @@ static void write_java_work_source_method(FILE* out, const set<vector<java_type_
        }

        // Method header (signature)
        fprintf(out, "    /** @hide */\n");
        fprintf(out, "    public static void write(int code");
        int argIndex = 1;
        for (vector<java_type_t>::const_iterator arg = signature->begin();
@@ -827,6 +829,7 @@ write_stats_log_java(FILE* out, const Atoms& atoms, const AtomDecl &attributionD
        if (non_chained_decl != atom_code_to_non_chained_decl_map.end()) {
            write_java_usage(out, "write_non_chained", constant, *non_chained_decl->second);
        }
        fprintf(out, "     * @hide\n");
        fprintf(out, "     */\n");
        fprintf(out, "    public static final int %s = %d;\n", constant.c_str(), atom->code);
    }
@@ -843,6 +846,7 @@ write_stats_log_java(FILE* out, const Atoms& atoms, const AtomDecl &attributionD
                    field->name.c_str());
                for (map<int, string>::const_iterator value = field->enumValues.begin();
                    value != field->enumValues.end(); value++) {
                    fprintf(out, "    /** @hide */\n");
                    fprintf(out, "    public static final int %s__%s__%s = %d;\n",
                        make_constant_name(atom->message).c_str(),
                        make_constant_name(field->name).c_str(),