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

Commit 28715a76 authored by Junyu Lai's avatar Junyu Lai Committed by Automerger Merge Worker
Browse files

Merge "[SP31] Expose onSetWarningAndLimit System API" am: 3757df2e

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625864

Change-Id: I7a95af1d2879fce22e1e644923661ccbc2253f26
parents 734f12bc 3757df2e
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -6443,9 +6443,11 @@ package android.net.netstats.provider {
    method public void notifyAlertReached();
    method public void notifyAlertReached();
    method public void notifyLimitReached();
    method public void notifyLimitReached();
    method public void notifyStatsUpdated(int, @NonNull android.net.NetworkStats, @NonNull android.net.NetworkStats);
    method public void notifyStatsUpdated(int, @NonNull android.net.NetworkStats, @NonNull android.net.NetworkStats);
    method public void notifyWarningReached();
    method public abstract void onRequestStatsUpdate(int);
    method public abstract void onRequestStatsUpdate(int);
    method public abstract void onSetAlert(long);
    method public abstract void onSetAlert(long);
    method public abstract void onSetLimit(@NonNull String, long);
    method public abstract void onSetLimit(@NonNull String, long);
    method public void onSetWarningAndLimit(@NonNull String, long, long);
    field public static final int QUOTA_UNLIMITED = -1; // 0xffffffff
    field public static final int QUOTA_UNLIMITED = -1; // 0xffffffff
  }
  }
+0 −7
Original line number Original line Diff line number Diff line
@@ -147,10 +147,7 @@ public abstract class NetworkStatsProvider {


    /**
    /**
     * Notify system that the warning set by {@link #onSetWarningAndLimit} has been reached.
     * Notify system that the warning set by {@link #onSetWarningAndLimit} has been reached.
     *
     * @hide
     */
     */
    // TODO: Expose as system API.
    public void notifyWarningReached() {
    public void notifyWarningReached() {
        try {
        try {
            // Reuse the code path to notify warning reached with limit reached
            // Reuse the code path to notify warning reached with limit reached
@@ -198,7 +195,6 @@ public abstract class NetworkStatsProvider {
     * @param quotaBytes the quota defined as the number of bytes, starting from zero and counting
     * @param quotaBytes the quota defined as the number of bytes, starting from zero and counting
     *                   from now. A value of {@link #QUOTA_UNLIMITED} indicates there is no limit.
     *                   from now. A value of {@link #QUOTA_UNLIMITED} indicates there is no limit.
     */
     */
    // TODO: deprecate this once onSetWarningAndLimit is ready.
    public abstract void onSetLimit(@NonNull String iface, long quotaBytes);
    public abstract void onSetLimit(@NonNull String iface, long quotaBytes);


    /**
    /**
@@ -217,10 +213,7 @@ public abstract class NetworkStatsProvider {
     *                     there is no warning.
     *                     there is no warning.
     * @param limitBytes the limit defined as the number of bytes, starting from zero and counting
     * @param limitBytes the limit defined as the number of bytes, starting from zero and counting
     *                   from now. A value of {@link #QUOTA_UNLIMITED} indicates there is no limit.
     *                   from now. A value of {@link #QUOTA_UNLIMITED} indicates there is no limit.
     *
     * @hide
     */
     */
    // TODO: Expose as system API.
    public void onSetWarningAndLimit(@NonNull String iface, long warningBytes, long limitBytes) {
    public void onSetWarningAndLimit(@NonNull String iface, long warningBytes, long limitBytes) {
        // Backward compatibility for those who didn't override this function.
        // Backward compatibility for those who didn't override this function.
        onSetLimit(iface, limitBytes);
        onSetLimit(iface, limitBytes);