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

Commit a841e524 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Expose quota status for active network."

parents 1824a62b f0ceede8
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -11116,6 +11116,7 @@ package android.net {
  public class ConnectivityManager {
    method public android.net.NetworkInfo getActiveNetworkInfo();
    method public android.net.NetworkQuotaInfo getActiveNetworkQuotaInfo();
    method public android.net.NetworkInfo[] getAllNetworkInfo();
    method public boolean getBackgroundDataSetting();
    method public android.net.NetworkInfo getNetworkInfo(int);
@@ -11130,7 +11131,7 @@ package android.net {
    field public static final int DEFAULT_NETWORK_PREFERENCE = 1; // 0x1
    field public static final java.lang.String EXTRA_EXTRA_INFO = "extraInfo";
    field public static final java.lang.String EXTRA_IS_FAILOVER = "isFailover";
    field public static final java.lang.String EXTRA_NETWORK_INFO = "networkInfo";
    field public static final deprecated java.lang.String EXTRA_NETWORK_INFO = "networkInfo";
    field public static final java.lang.String EXTRA_NO_CONNECTIVITY = "noConnectivity";
    field public static final java.lang.String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
    field public static final java.lang.String EXTRA_REASON = "reason";
@@ -11275,6 +11276,16 @@ package android.net {
    enum_constant public static final android.net.NetworkInfo.State UNKNOWN;
  }
  public class NetworkQuotaInfo implements android.os.Parcelable {
    method public int describeContents();
    method public long getEstimatedBytes();
    method public long getHardLimitBytes();
    method public long getSoftLimitBytes();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
    field public static final long NO_LIMIT = -1L; // 0xffffffffffffffffL
  }
  public class ParseException extends java.lang.RuntimeException {
    field public java.lang.String response;
  }
+24 −5
Original line number Diff line number Diff line
@@ -16,10 +16,11 @@

package android.net;

import static com.android.internal.util.Preconditions.checkNotNull;

import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.os.Binder;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;

import java.net.InetAddress;
@@ -67,11 +68,19 @@ public class ConnectivityManager {
     * is set to {@code true} if there are no connected networks at all.
     */
    public static final String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";

    /**
     * The lookup key for a {@link NetworkInfo} object. Retrieve with
     * {@link android.content.Intent#getParcelableExtra(String)}.
     *
     * @deprecated Since {@link NetworkInfo} can vary based on UID, applications
     *             should always obtain network information through
     *             {@link #getActiveNetworkInfo()} or
     *             {@link #getAllNetworkInfo()}.
     */
    @Deprecated
    public static final String EXTRA_NETWORK_INFO = "networkInfo";

    /**
     * The lookup key for a boolean that indicates whether a connect event
     * is for a network to which the connectivity manager was failing over
@@ -514,6 +523,19 @@ public class ConnectivityManager {
        }
    }

    /**
     * Return quota status for the current active network, or {@code null} if no
     * network is active. Quota status can change rapidly, so these values
     * shouldn't be cached.
     */
    public NetworkQuotaInfo getActiveNetworkQuotaInfo() {
        try {
            return mService.getActiveNetworkQuotaInfo();
        } catch (RemoteException e) {
            return null;
        }
    }

    /**
     * Gets the value of the setting for enabling Mobile data.
     *
@@ -546,10 +568,7 @@ public class ConnectivityManager {
     * {@hide}
     */
    public ConnectivityManager(IConnectivityManager service) {
        if (service == null) {
            throw new IllegalArgumentException("missing IConnectivityManager");
        }
        mService = service;
        mService = checkNotNull(service, "missing IConnectivityManager");
    }

    /**
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.net;

import android.net.LinkProperties;
import android.net.NetworkInfo;
import android.net.NetworkQuotaInfo;
import android.net.NetworkState;
import android.net.ProxyProperties;
import android.os.IBinder;
@@ -47,6 +48,8 @@ interface IConnectivityManager

    NetworkState[] getAllNetworkState();

    NetworkQuotaInfo getActiveNetworkQuotaInfo();

    boolean setRadios(boolean onOff);

    boolean setRadio(int networkType, boolean turnOn);
+8 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package android.net;

import android.net.INetworkPolicyListener;
import android.net.NetworkPolicy;
import android.net.NetworkQuotaInfo;
import android.net.NetworkState;
import android.net.NetworkTemplate;

/**
@@ -27,6 +29,7 @@ import android.net.NetworkTemplate;
 */
interface INetworkPolicyManager {

    /** Control UID policies. */
    void setUidPolicy(int uid, int policy);
    int getUidPolicy(int uid);

@@ -35,12 +38,17 @@ interface INetworkPolicyManager {
    void registerListener(INetworkPolicyListener listener);
    void unregisterListener(INetworkPolicyListener listener);

    /** Control network policies atomically. */
    void setNetworkPolicies(in NetworkPolicy[] policies);
    NetworkPolicy[] getNetworkPolicies();

    /** Snooze limit on policy matching given template. */
    void snoozePolicy(in NetworkTemplate template);

    /** Control if background data is restricted system-wide. */
    void setRestrictBackground(boolean restrictBackground);
    boolean getRestrictBackground();

    NetworkQuotaInfo getNetworkQuotaInfo(in NetworkState state);

}
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net;

parcelable NetworkQuotaInfo;
Loading