Loading api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -300,6 +300,7 @@ package android.app { field public static final java.lang.String OPSTR_REQUEST_INSTALL_PACKAGES = "android:request_install_packages"; field public static final java.lang.String OPSTR_RUN_ANY_IN_BACKGROUND = "android:run_any_in_background"; field public static final java.lang.String OPSTR_RUN_IN_BACKGROUND = "android:run_in_background"; field public static final java.lang.String OPSTR_START_FOREGROUND = "android:start_foreground"; field public static final java.lang.String OPSTR_TAKE_AUDIO_FOCUS = "android:take_audio_focus"; field public static final java.lang.String OPSTR_TAKE_MEDIA_BUTTONS = "android:take_media_buttons"; field public static final java.lang.String OPSTR_TOAST_WINDOW = "android:toast_window"; Loading api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ package android.app { field public static final java.lang.String OPSTR_REQUEST_INSTALL_PACKAGES = "android:request_install_packages"; field public static final java.lang.String OPSTR_RUN_ANY_IN_BACKGROUND = "android:run_any_in_background"; field public static final java.lang.String OPSTR_RUN_IN_BACKGROUND = "android:run_in_background"; field public static final java.lang.String OPSTR_START_FOREGROUND = "android:start_foreground"; field public static final java.lang.String OPSTR_TAKE_AUDIO_FOCUS = "android:take_audio_focus"; field public static final java.lang.String OPSTR_TAKE_MEDIA_BUTTONS = "android:take_media_buttons"; field public static final java.lang.String OPSTR_TOAST_WINDOW = "android:toast_window"; Loading core/java/android/app/AppOpsManager.java +16 −2 Original line number Diff line number Diff line Loading @@ -272,8 +272,10 @@ public class AppOpsManager { public static final int OP_ACCEPT_HANDOVER = 74; /** @hide Create and Manage IPsec Tunnels */ public static final int OP_MANAGE_IPSEC_TUNNELS = 75; /** @hide Any app start foreground service. */ public static final int OP_START_FOREGROUND = 76; /** @hide */ public static final int _NUM_OP = 76; public static final int _NUM_OP = 77; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; Loading Loading @@ -512,6 +514,9 @@ public class AppOpsManager { /** @hide */ @SystemApi @TestApi public static final String OPSTR_MANAGE_IPSEC_TUNNELS = "android:manage_ipsec_tunnels"; /** @hide */ @SystemApi @TestApi public static final String OPSTR_START_FOREGROUND = "android:start_foreground"; // Warning: If an permission is added here it also has to be added to // com.android.packageinstaller.permission.utils.EventLogger Loading Loading @@ -560,6 +565,7 @@ public class AppOpsManager { OP_SYSTEM_ALERT_WINDOW, OP_WRITE_SETTINGS, OP_REQUEST_INSTALL_PACKAGES, OP_START_FOREGROUND, }; /** Loading Loading @@ -647,6 +653,7 @@ public class AppOpsManager { OP_BIND_ACCESSIBILITY_SERVICE, OP_ACCEPT_HANDOVER, OP_MANAGE_IPSEC_TUNNELS, OP_START_FOREGROUND, }; /** Loading Loading @@ -729,6 +736,7 @@ public class AppOpsManager { OPSTR_BIND_ACCESSIBILITY_SERVICE, OPSTR_ACCEPT_HANDOVER, OPSTR_MANAGE_IPSEC_TUNNELS, OPSTR_START_FOREGROUND, }; /** Loading Loading @@ -812,6 +820,7 @@ public class AppOpsManager { "BIND_ACCESSIBILITY_SERVICE", "ACCEPT_HANDOVER", "MANAGE_IPSEC_TUNNELS", "START_FOREGROUND", }; /** Loading Loading @@ -895,6 +904,7 @@ public class AppOpsManager { Manifest.permission.BIND_ACCESSIBILITY_SERVICE, Manifest.permission.ACCEPT_HANDOVER, null, // no permission for OP_MANAGE_IPSEC_TUNNELS Manifest.permission.FOREGROUND_SERVICE, }; /** Loading Loading @@ -979,6 +989,7 @@ public class AppOpsManager { null, // OP_BIND_ACCESSIBILITY_SERVICE null, // ACCEPT_HANDOVER null, // MANAGE_IPSEC_TUNNELS null, // START_FOREGROUND }; /** Loading Loading @@ -1062,6 +1073,7 @@ public class AppOpsManager { false, // OP_BIND_ACCESSIBILITY_SERVICE false, // ACCEPT_HANDOVER false, // MANAGE_IPSEC_HANDOVERS false, // START_FOREGROUND }; /** Loading Loading @@ -1144,6 +1156,7 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, // OP_BIND_ACCESSIBILITY_SERVICE AppOpsManager.MODE_ALLOWED, // ACCEPT_HANDOVER AppOpsManager.MODE_ERRORED, // MANAGE_IPSEC_TUNNELS AppOpsManager.MODE_ALLOWED, // OP_START_FOREGROUND }; /** Loading Loading @@ -1230,6 +1243,7 @@ public class AppOpsManager { false, // OP_BIND_ACCESSIBILITY_SERVICE false, // ACCEPT_HANDOVER false, // MANAGE_IPSEC_TUNNELS false, // START_FOREGROUND }; /** Loading core/java/android/net/INetworkStatsService.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,16 @@ interface INetworkStatsService { /** Return data layer snapshot of UID network usage. */ NetworkStats getDataLayerSnapshotForUid(int uid); /** Get a detailed snapshot of stats since boot for all UIDs. * * <p>Results will not always be limited to stats on requiredIfaces when specified: stats for * interfaces stacked on the specified interfaces, or for interfaces on which the specified * interfaces are stacked on, will also be included. * @param requiredIfaces Interface names to get data for, or {@link NetworkStats#INTERFACES_ALL}. */ NetworkStats getDetailedUidStats(in String[] requiredIfaces); /** Return set of any ifaces associated with mobile networks since boot. */ String[] getMobileIfaces(); Loading core/java/android/net/NetworkStats.java +52 −12 Original line number Diff line number Diff line Loading @@ -64,6 +64,9 @@ public class NetworkStats implements Parcelable { /** Debug {@link #set} value when the VPN stats are moved out of a vpn UID. */ public static final int SET_DBG_VPN_OUT = 1002; /** Include all interfaces when filtering */ public static final String[] INTERFACES_ALL = null; /** {@link #tag} value for total data across all tags. */ // TODO: Rename TAG_NONE to TAG_ALL. public static final int TAG_NONE = 0; Loading Loading @@ -366,23 +369,27 @@ public class NetworkStats implements Parcelable { capacity = newLength; } iface[size] = entry.iface; uid[size] = entry.uid; set[size] = entry.set; tag[size] = entry.tag; metered[size] = entry.metered; roaming[size] = entry.roaming; defaultNetwork[size] = entry.defaultNetwork; rxBytes[size] = entry.rxBytes; rxPackets[size] = entry.rxPackets; txBytes[size] = entry.txBytes; txPackets[size] = entry.txPackets; operations[size] = entry.operations; setValues(size, entry); size++; return this; } private void setValues(int i, Entry entry) { iface[i] = entry.iface; uid[i] = entry.uid; set[i] = entry.set; tag[i] = entry.tag; metered[i] = entry.metered; roaming[i] = entry.roaming; defaultNetwork[i] = entry.defaultNetwork; rxBytes[i] = entry.rxBytes; rxPackets[i] = entry.rxPackets; txBytes[i] = entry.txBytes; txPackets[i] = entry.txPackets; operations[i] = entry.operations; } /** * Return specific stats entry. */ Loading Loading @@ -831,6 +838,39 @@ public class NetworkStats implements Parcelable { return stats; } /** * Only keep entries that match all specified filters. * * <p>This mutates the original structure in place. After this method is called, * size is the number of matching entries, and capacity is the previous capacity. * @param limitUid UID to filter for, or {@link #UID_ALL}. * @param limitIfaces Interfaces to filter for, or {@link #INTERFACES_ALL}. * @param limitTag Tag to filter for, or {@link #TAG_ALL}. */ public void filter(int limitUid, String[] limitIfaces, int limitTag) { if (limitUid == UID_ALL && limitTag == TAG_ALL && limitIfaces == INTERFACES_ALL) { return; } Entry entry = new Entry(); int nextOutputEntry = 0; for (int i = 0; i < size; i++) { entry = getValues(i, entry); final boolean matches = (limitUid == UID_ALL || limitUid == entry.uid) && (limitTag == TAG_ALL || limitTag == entry.tag) && (limitIfaces == INTERFACES_ALL || ArrayUtils.contains(limitIfaces, entry.iface)); if (matches) { setValues(nextOutputEntry, entry); nextOutputEntry++; } } size = nextOutputEntry; } public void dump(String prefix, PrintWriter pw) { pw.print(prefix); pw.print("NetworkStats: elapsedRealtime="); pw.println(elapsedRealtime); Loading Loading
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -300,6 +300,7 @@ package android.app { field public static final java.lang.String OPSTR_REQUEST_INSTALL_PACKAGES = "android:request_install_packages"; field public static final java.lang.String OPSTR_RUN_ANY_IN_BACKGROUND = "android:run_any_in_background"; field public static final java.lang.String OPSTR_RUN_IN_BACKGROUND = "android:run_in_background"; field public static final java.lang.String OPSTR_START_FOREGROUND = "android:start_foreground"; field public static final java.lang.String OPSTR_TAKE_AUDIO_FOCUS = "android:take_audio_focus"; field public static final java.lang.String OPSTR_TAKE_MEDIA_BUTTONS = "android:take_media_buttons"; field public static final java.lang.String OPSTR_TOAST_WINDOW = "android:toast_window"; Loading
api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ package android.app { field public static final java.lang.String OPSTR_REQUEST_INSTALL_PACKAGES = "android:request_install_packages"; field public static final java.lang.String OPSTR_RUN_ANY_IN_BACKGROUND = "android:run_any_in_background"; field public static final java.lang.String OPSTR_RUN_IN_BACKGROUND = "android:run_in_background"; field public static final java.lang.String OPSTR_START_FOREGROUND = "android:start_foreground"; field public static final java.lang.String OPSTR_TAKE_AUDIO_FOCUS = "android:take_audio_focus"; field public static final java.lang.String OPSTR_TAKE_MEDIA_BUTTONS = "android:take_media_buttons"; field public static final java.lang.String OPSTR_TOAST_WINDOW = "android:toast_window"; Loading
core/java/android/app/AppOpsManager.java +16 −2 Original line number Diff line number Diff line Loading @@ -272,8 +272,10 @@ public class AppOpsManager { public static final int OP_ACCEPT_HANDOVER = 74; /** @hide Create and Manage IPsec Tunnels */ public static final int OP_MANAGE_IPSEC_TUNNELS = 75; /** @hide Any app start foreground service. */ public static final int OP_START_FOREGROUND = 76; /** @hide */ public static final int _NUM_OP = 76; public static final int _NUM_OP = 77; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; Loading Loading @@ -512,6 +514,9 @@ public class AppOpsManager { /** @hide */ @SystemApi @TestApi public static final String OPSTR_MANAGE_IPSEC_TUNNELS = "android:manage_ipsec_tunnels"; /** @hide */ @SystemApi @TestApi public static final String OPSTR_START_FOREGROUND = "android:start_foreground"; // Warning: If an permission is added here it also has to be added to // com.android.packageinstaller.permission.utils.EventLogger Loading Loading @@ -560,6 +565,7 @@ public class AppOpsManager { OP_SYSTEM_ALERT_WINDOW, OP_WRITE_SETTINGS, OP_REQUEST_INSTALL_PACKAGES, OP_START_FOREGROUND, }; /** Loading Loading @@ -647,6 +653,7 @@ public class AppOpsManager { OP_BIND_ACCESSIBILITY_SERVICE, OP_ACCEPT_HANDOVER, OP_MANAGE_IPSEC_TUNNELS, OP_START_FOREGROUND, }; /** Loading Loading @@ -729,6 +736,7 @@ public class AppOpsManager { OPSTR_BIND_ACCESSIBILITY_SERVICE, OPSTR_ACCEPT_HANDOVER, OPSTR_MANAGE_IPSEC_TUNNELS, OPSTR_START_FOREGROUND, }; /** Loading Loading @@ -812,6 +820,7 @@ public class AppOpsManager { "BIND_ACCESSIBILITY_SERVICE", "ACCEPT_HANDOVER", "MANAGE_IPSEC_TUNNELS", "START_FOREGROUND", }; /** Loading Loading @@ -895,6 +904,7 @@ public class AppOpsManager { Manifest.permission.BIND_ACCESSIBILITY_SERVICE, Manifest.permission.ACCEPT_HANDOVER, null, // no permission for OP_MANAGE_IPSEC_TUNNELS Manifest.permission.FOREGROUND_SERVICE, }; /** Loading Loading @@ -979,6 +989,7 @@ public class AppOpsManager { null, // OP_BIND_ACCESSIBILITY_SERVICE null, // ACCEPT_HANDOVER null, // MANAGE_IPSEC_TUNNELS null, // START_FOREGROUND }; /** Loading Loading @@ -1062,6 +1073,7 @@ public class AppOpsManager { false, // OP_BIND_ACCESSIBILITY_SERVICE false, // ACCEPT_HANDOVER false, // MANAGE_IPSEC_HANDOVERS false, // START_FOREGROUND }; /** Loading Loading @@ -1144,6 +1156,7 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, // OP_BIND_ACCESSIBILITY_SERVICE AppOpsManager.MODE_ALLOWED, // ACCEPT_HANDOVER AppOpsManager.MODE_ERRORED, // MANAGE_IPSEC_TUNNELS AppOpsManager.MODE_ALLOWED, // OP_START_FOREGROUND }; /** Loading Loading @@ -1230,6 +1243,7 @@ public class AppOpsManager { false, // OP_BIND_ACCESSIBILITY_SERVICE false, // ACCEPT_HANDOVER false, // MANAGE_IPSEC_TUNNELS false, // START_FOREGROUND }; /** Loading
core/java/android/net/INetworkStatsService.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,16 @@ interface INetworkStatsService { /** Return data layer snapshot of UID network usage. */ NetworkStats getDataLayerSnapshotForUid(int uid); /** Get a detailed snapshot of stats since boot for all UIDs. * * <p>Results will not always be limited to stats on requiredIfaces when specified: stats for * interfaces stacked on the specified interfaces, or for interfaces on which the specified * interfaces are stacked on, will also be included. * @param requiredIfaces Interface names to get data for, or {@link NetworkStats#INTERFACES_ALL}. */ NetworkStats getDetailedUidStats(in String[] requiredIfaces); /** Return set of any ifaces associated with mobile networks since boot. */ String[] getMobileIfaces(); Loading
core/java/android/net/NetworkStats.java +52 −12 Original line number Diff line number Diff line Loading @@ -64,6 +64,9 @@ public class NetworkStats implements Parcelable { /** Debug {@link #set} value when the VPN stats are moved out of a vpn UID. */ public static final int SET_DBG_VPN_OUT = 1002; /** Include all interfaces when filtering */ public static final String[] INTERFACES_ALL = null; /** {@link #tag} value for total data across all tags. */ // TODO: Rename TAG_NONE to TAG_ALL. public static final int TAG_NONE = 0; Loading Loading @@ -366,23 +369,27 @@ public class NetworkStats implements Parcelable { capacity = newLength; } iface[size] = entry.iface; uid[size] = entry.uid; set[size] = entry.set; tag[size] = entry.tag; metered[size] = entry.metered; roaming[size] = entry.roaming; defaultNetwork[size] = entry.defaultNetwork; rxBytes[size] = entry.rxBytes; rxPackets[size] = entry.rxPackets; txBytes[size] = entry.txBytes; txPackets[size] = entry.txPackets; operations[size] = entry.operations; setValues(size, entry); size++; return this; } private void setValues(int i, Entry entry) { iface[i] = entry.iface; uid[i] = entry.uid; set[i] = entry.set; tag[i] = entry.tag; metered[i] = entry.metered; roaming[i] = entry.roaming; defaultNetwork[i] = entry.defaultNetwork; rxBytes[i] = entry.rxBytes; rxPackets[i] = entry.rxPackets; txBytes[i] = entry.txBytes; txPackets[i] = entry.txPackets; operations[i] = entry.operations; } /** * Return specific stats entry. */ Loading Loading @@ -831,6 +838,39 @@ public class NetworkStats implements Parcelable { return stats; } /** * Only keep entries that match all specified filters. * * <p>This mutates the original structure in place. After this method is called, * size is the number of matching entries, and capacity is the previous capacity. * @param limitUid UID to filter for, or {@link #UID_ALL}. * @param limitIfaces Interfaces to filter for, or {@link #INTERFACES_ALL}. * @param limitTag Tag to filter for, or {@link #TAG_ALL}. */ public void filter(int limitUid, String[] limitIfaces, int limitTag) { if (limitUid == UID_ALL && limitTag == TAG_ALL && limitIfaces == INTERFACES_ALL) { return; } Entry entry = new Entry(); int nextOutputEntry = 0; for (int i = 0; i < size; i++) { entry = getValues(i, entry); final boolean matches = (limitUid == UID_ALL || limitUid == entry.uid) && (limitTag == TAG_ALL || limitTag == entry.tag) && (limitIfaces == INTERFACES_ALL || ArrayUtils.contains(limitIfaces, entry.iface)); if (matches) { setValues(nextOutputEntry, entry); nextOutputEntry++; } } size = nextOutputEntry; } public void dump(String prefix, PrintWriter pw) { pw.print(prefix); pw.print("NetworkStats: elapsedRealtime="); pw.println(elapsedRealtime); Loading