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

Commit 0e4b4152 authored by Hugo Benichi's avatar Hugo Benichi
Browse files

Wakeup packet events: addressing a few comments

This patch addresses a few post-submit comment for
commits f562ac34a51dc and 60c9f63b66921.

Bug: 34901696
Bug: 62179647
Test: runtest frameworks-net
Merged-In: I4abec57e0c6bc869dc57b5eb54582dd977b64c30

(cherry picked from commit 175b574e)

Change-Id: Ied9d0cec98685e5a91ed2ca2c81ad88d7ae8d751
parent a87b15c9
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -35,7 +35,7 @@ public class WakeupStats {
    public long systemWakeups = 0;
    public long systemWakeups = 0;
    public long nonApplicationWakeups = 0;
    public long nonApplicationWakeups = 0;
    public long applicationWakeups = 0;
    public long applicationWakeups = 0;
    public long unroutedWakeups = 0;
    public long noUidWakeups = 0;
    public long durationSec = 0;
    public long durationSec = 0;


    public WakeupStats(String iface) {
    public WakeupStats(String iface) {
@@ -58,7 +58,7 @@ public class WakeupStats {
                systemWakeups++;
                systemWakeups++;
                break;
                break;
            case NO_UID:
            case NO_UID:
                unroutedWakeups++;
                noUidWakeups++;
                break;
                break;
            default:
            default:
                if (ev.uid >= Process.FIRST_APPLICATION_UID) {
                if (ev.uid >= Process.FIRST_APPLICATION_UID) {
@@ -80,7 +80,7 @@ public class WakeupStats {
                .append(", system: ").append(systemWakeups)
                .append(", system: ").append(systemWakeups)
                .append(", apps: ").append(applicationWakeups)
                .append(", apps: ").append(applicationWakeups)
                .append(", non-apps: ").append(nonApplicationWakeups)
                .append(", non-apps: ").append(nonApplicationWakeups)
                .append(", unrouted: ").append(unroutedWakeups)
                .append(", no uid: ").append(noUidWakeups)
                .append(", ").append(durationSec).append("s)")
                .append(", ").append(durationSec).append("s)")
                .toString();
                .toString();
    }
    }
+2 −2
Original line number Original line Diff line number Diff line
@@ -501,8 +501,8 @@ message WakeupStats {
  // between [1001, 9999]. See android.os.Process for possible uids.
  // between [1001, 9999]. See android.os.Process for possible uids.
  optional int64 non_application_wakeups = 6;
  optional int64 non_application_wakeups = 6;


  // The total number of wakeup packets with no associated sockets.
  // The total number of wakeup packets with no associated socket or uid.
  optional int64 unrouted_wakeups = 7;
  optional int64 no_uid_wakeups = 7;
}
}


// Represents one of the IP connectivity event defined in this file.
// Represents one of the IP connectivity event defined in this file.
+1 −1
Original line number Original line Diff line number Diff line
@@ -126,7 +126,7 @@ final public class IpConnectivityEventBuilder {
        wakeupStats.systemWakeups = in.systemWakeups;
        wakeupStats.systemWakeups = in.systemWakeups;
        wakeupStats.nonApplicationWakeups = in.nonApplicationWakeups;
        wakeupStats.nonApplicationWakeups = in.nonApplicationWakeups;
        wakeupStats.applicationWakeups = in.applicationWakeups;
        wakeupStats.applicationWakeups = in.applicationWakeups;
        wakeupStats.unroutedWakeups = in.unroutedWakeups;
        wakeupStats.noUidWakeups = in.noUidWakeups;
        final IpConnectivityEvent out = buildEvent(0, 0, in.iface);
        final IpConnectivityEvent out = buildEvent(0, 0, in.iface);
        out.setWakeupStats(wakeupStats);
        out.setWakeupStats(wakeupStats);
        return out;
        return out;
+2 −2
Original line number Original line Diff line number Diff line
@@ -170,11 +170,11 @@ public class NetdEventListenerService extends INetdEventListener.Stub {
            timestampMs = System.currentTimeMillis();
            timestampMs = System.currentTimeMillis();
        }
        }


        addWakupEvent(iface, timestampMs, uid);
        addWakeupEvent(iface, timestampMs, uid);
    }
    }


    @GuardedBy("this")
    @GuardedBy("this")
    private void addWakupEvent(String iface, long timestampMs, int uid) {
    private void addWakeupEvent(String iface, long timestampMs, int uid) {
        int index = wakeupEventIndex(mWakeupEventCursor);
        int index = wakeupEventIndex(mWakeupEventCursor);
        mWakeupEventCursor++;
        mWakeupEventCursor++;
        WakeupEvent event = new WakeupEvent();
        WakeupEvent event = new WakeupEvent();
+2 −2
Original line number Original line Diff line number Diff line
@@ -512,7 +512,7 @@ public class IpConnectivityEventBuilderTest {
        stats.nonApplicationWakeups = 1;
        stats.nonApplicationWakeups = 1;
        stats.rootWakeups = 2;
        stats.rootWakeups = 2;
        stats.systemWakeups = 3;
        stats.systemWakeups = 3;
        stats.unroutedWakeups = 3;
        stats.noUidWakeups = 3;


        IpConnectivityEvent got = IpConnectivityEventBuilder.toProto(stats);
        IpConnectivityEvent got = IpConnectivityEventBuilder.toProto(stats);
        String want = String.join("\n",
        String want = String.join("\n",
@@ -526,11 +526,11 @@ public class IpConnectivityEventBuilderTest {
                "  wakeup_stats <",
                "  wakeup_stats <",
                "    application_wakeups: 5",
                "    application_wakeups: 5",
                "    duration_sec: 0",
                "    duration_sec: 0",
                "    no_uid_wakeups: 3",
                "    non_application_wakeups: 1",
                "    non_application_wakeups: 1",
                "    root_wakeups: 2",
                "    root_wakeups: 2",
                "    system_wakeups: 3",
                "    system_wakeups: 3",
                "    total_wakeups: 14",
                "    total_wakeups: 14",
                "    unrouted_wakeups: 3",
                "  >",
                "  >",
                ">",
                ">",
                "version: 2\n");
                "version: 2\n");
Loading