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

Commit fd5ff49d authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7521311 from 1c3d54b9 to sc-release

Change-Id: I5272c351b431a6411c2051dc533fc0174378da60
parents f08611be 1c3d54b9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -218,6 +218,7 @@ package android.app {
    field public static final String OPSTR_ACTIVITY_RECOGNITION = "android:activity_recognition";
    field public static final String OPSTR_ACTIVITY_RECOGNITION_SOURCE = "android:activity_recognition_source";
    field public static final String OPSTR_MANAGE_ONGOING_CALLS = "android:manage_ongoing_calls";
    field public static final String OPSTR_RECORD_AUDIO_HOTWORD = "android:record_audio_hotword";
    field public static final String OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER = "android:use_icc_auth_with_device_identifier";
    field public static final int OP_COARSE_LOCATION = 0; // 0x0
    field public static final int OP_RECORD_AUDIO = 27; // 0x1b
+1 −0
Original line number Diff line number Diff line
@@ -1668,6 +1668,7 @@ public class AppOpsManager {
     *
     * @hide
     */
    @TestApi
    public static final String OPSTR_RECORD_AUDIO_HOTWORD = "android:record_audio_hotword";

    /**
+321 −71

File changed.

Preview size limit exceeded, changes collapsed.

+38 −4
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Process;
import android.os.SystemClock;
import android.util.SparseBooleanArray;

@@ -1487,8 +1488,31 @@ public final class NetworkStats implements Parcelable {
                continue;
            }

            if (recycle.uid == tunUid) {
                // Add up traffic through tunUid's underlying interfaces.
            if (tunUid == Process.SYSTEM_UID) {
                // Kernel-based VPN or VCN, traffic sent by apps on the VPN/VCN network
                //
                // Since the data is not UID-accounted on underlying networks, just use VPN/VCN
                // network usage as ground truth. Encrypted traffic on the underlying networks will
                // never be processed here because encrypted traffic on the underlying interfaces
                // is not present in UID stats, and this method is only called on UID stats.
                if (tunIface.equals(recycle.iface)) {
                    tunIfaceTotal.add(recycle);
                    underlyingIfacesTotal.add(recycle);

                    // In steady state, there should always be one network, but edge cases may
                    // result in the network being null (network lost), and thus no underlying
                    // ifaces is possible.
                    if (perInterfaceTotal.length > 0) {
                        // While platform VPNs and VCNs have exactly one underlying network, that
                        // network may have multiple interfaces (eg for 464xlat). This layer does
                        // not have the required information to identify which of the interfaces
                        // were used. Select "any" of the interfaces. Since overhead is already
                        // lost, this number is an approximation anyways.
                        perInterfaceTotal[0].add(recycle);
                    }
                }
            } else if (recycle.uid == tunUid) {
                // VpnService VPN, traffic sent by the VPN app over underlying networks
                for (int j = 0; j < underlyingIfaces.size(); j++) {
                    if (Objects.equals(underlyingIfaces.get(j), recycle.iface)) {
                        perInterfaceTotal[j].add(recycle);
@@ -1497,7 +1521,7 @@ public final class NetworkStats implements Parcelable {
                    }
                }
            } else if (tunIface.equals(recycle.iface)) {
                // Add up all tunIface traffic excluding traffic from the vpn app itself.
                // VpnService VPN; traffic sent by apps on the VPN network
                tunIfaceTotal.add(recycle);
            }
        }
@@ -1532,9 +1556,13 @@ public final class NetworkStats implements Parcelable {
                // Consider only entries that go onto the VPN interface.
                continue;
            }
            if (uid[i] == tunUid) {

            if (uid[i] == tunUid && tunUid != Process.SYSTEM_UID) {
                // Exclude VPN app from the redistribution, as it can choose to create packet
                // streams by writing to itself.
                //
                // However, for platform VPNs, do not exclude the system's usage of the VPN network,
                // since it is never local-only, and never double counted
                continue;
            }
            tmpEntry.uid = uid[i];
@@ -1641,6 +1669,12 @@ public final class NetworkStats implements Parcelable {
            int tunUid,
            @NonNull List<String> underlyingIfaces,
            @NonNull Entry[] moved) {
        if (tunUid == Process.SYSTEM_UID) {
            // No traffic recorded on a per-UID basis for in-kernel VPN/VCNs over underlying
            // networks; thus no traffic to deduct.
            return;
        }

        for (int i = 0; i < underlyingIfaces.size(); i++) {
            moved[i].uid = tunUid;
            // Add debug info
+3 −4
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package android.os;

import static android.app.ActivityManager.PROCESS_STATE_BOUND_TOP;
import static android.os.BatteryStatsManager.NUM_WIFI_STATES;
import static android.os.BatteryStatsManager.NUM_WIFI_SUPPL_STATES;

@@ -903,9 +902,9 @@ public abstract class BatteryStats implements Parcelable {
         * is not attributed to any non-critical process states.
         */
        public static final int[] CRITICAL_PROC_STATES = {
                PROCESS_STATE_TOP,
                PROCESS_STATE_BOUND_TOP, PROCESS_STATE_FOREGROUND_SERVICE,
                PROCESS_STATE_FOREGROUND
                Uid.PROCESS_STATE_TOP,
                Uid.PROCESS_STATE_FOREGROUND_SERVICE,
                Uid.PROCESS_STATE_FOREGROUND
        };

        public abstract long getProcessStateTime(int state, long elapsedRealtimeUs, int which);
Loading