Loading api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -48449,6 +48449,7 @@ package android.util { method public static boolean logEvent(int); method public static boolean logEvent(int); method public static boolean logStart(int); method public static boolean logStart(int); method public static boolean logStop(int); method public static boolean logStop(int); method public static void write(int, @NonNull java.lang.Object...); } } public class StringBuilderPrinter implements android.util.Printer { public class StringBuilderPrinter implements android.util.Printer { api/system-current.txt +15 −0 Original line number Original line Diff line number Diff line Loading @@ -9208,6 +9208,21 @@ package android.util { method public int getUid(); method public int getUid(); } } public class StatsLogAtoms { field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED = 170; // 0xaa field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__AUTO_DENIED = 8; // 0x8 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__AUTO_GRANTED = 5; // 0x5 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED = 1; // 0x1 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED_POLICY_FIXED = 3; // 0x3 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED_USER_FIXED = 2; // 0x2 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_DENIED = 6; // 0x6 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_DENIED_WITH_PREJUDICE = 7; // 0x7 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_GRANTED = 4; // 0x4 } @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @IntDef(prefix="PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__", value={android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED_USER_FIXED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED_POLICY_FIXED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_GRANTED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__AUTO_GRANTED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_DENIED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_DENIED_WITH_PREJUDICE, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__AUTO_DENIED}) public static @interface StatsLogAtoms.PermissionGrantRequestResultReported_Result { } } } package android.view { package android.view { cmds/statsd/src/atoms.proto +43 −0 Original line number Original line Diff line number Diff line Loading @@ -236,6 +236,7 @@ message Atom { BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported = 167; BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported = 167; ScreenTimeoutExtensionReported screen_timeout_extension_reported = 168; ScreenTimeoutExtensionReported screen_timeout_extension_reported = 168; ProcessStartTime process_start_time = 169; ProcessStartTime process_start_time = 169; PermissionGrantRequestResultReported permission_grant_request_result_reported = 170; } } // Pulled events will start at field 10000. // Pulled events will start at field 10000. Loading Loading @@ -5096,6 +5097,48 @@ message SeStateChanged { optional string terminal = 3; optional string terminal = 3; } } /** * Information about a permission grant request */ message PermissionGrantRequestResultReported { // unique value identifying an API call. A API call might result in multiple of these atoms optional int64 request_id = 1; // UID of package requesting the permission grant optional int32 requesting_uid = 2 [(is_uid) = true]; // Name of package requesting the permission grant optional string requesting_package_name = 3; // The permission to be granted optional string permission_name = 4; // If the permission was explicitly requested via the API or added by the system optional bool is_implicit = 5; enum Result { UNDEFINED = 0; // permission request was ignored IGNORED = 1; // permission request was ignored because it was user fixed IGNORED_USER_FIXED = 2; // permission request was ignored because it was policy fixed IGNORED_POLICY_FIXED = 3; // permission was granted by user action USER_GRANTED = 4; // permission was automatically granted AUTO_GRANTED = 5; // permission was denied by user action USER_DENIED = 6; // permission was denied with prejudice by the user USER_DENIED_WITH_PREJUDICE = 7; // permission was automatically denied AUTO_DENIED = 8; } // The result of the permission grant optional Result result = 6; } /** /** * Logs when Omapi API used * Logs when Omapi API used * Logged from: * Logged from: Loading cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java +17 −4 Original line number Original line Diff line number Diff line Loading @@ -32,7 +32,8 @@ import com.google.common.io.Files; import java.io.File; import java.io.File; import java.io.IOException; import java.io.IOException; import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.HashSet; import java.util.Set; import java.util.Set; import java.util.logging.Level; import java.util.logging.Level; Loading Loading @@ -60,6 +61,7 @@ public class TestDrive { }; }; private static final Logger LOGGER = Logger.getLogger(TestDrive.class.getName()); private static final Logger LOGGER = Logger.getLogger(TestDrive.class.getName()); private String mAdditionalAllowedPackage; private final Set<Long> mTrackedMetrics = new HashSet<>(); private final Set<Long> mTrackedMetrics = new HashSet<>(); public static void main(String[] args) { public static void main(String[] args) { Loading @@ -69,11 +71,16 @@ public class TestDrive { String remoteConfigPath = null; String remoteConfigPath = null; if (args.length < 1) { if (args.length < 1) { LOGGER.log(Level.SEVERE, "Usage: ./test_drive <atomId1> <atomId2> ... <atomIdN>"); LOGGER.log(Level.SEVERE, "Usage: ./test_drive [-p additional_allowed_package] " + "<atomId1> <atomId2> ... <atomIdN>"); return; return; } } for (int i = 0; i < args.length; i++) { if (args.length >= 3 && args[0].equals("-p")) { testDrive.mAdditionalAllowedPackage = args[1]; } for (int i = testDrive.mAdditionalAllowedPackage == null ? 0 : 2; i < args.length; i++) { try { try { int atomId = Integer.valueOf(args[i]); int atomId = Integer.valueOf(args[i]); if (Atom.getDescriptor().findFieldByNumber(atomId) == null) { if (Atom.getDescriptor().findFieldByNumber(atomId) == null) { Loading Loading @@ -137,9 +144,15 @@ public class TestDrive { long metricId = METRIC_ID_BASE; long metricId = METRIC_ID_BASE; long atomMatcherId = ATOM_MATCHER_ID_BASE; long atomMatcherId = ATOM_MATCHER_ID_BASE; ArrayList<String> allowedSources = new ArrayList<>(); Collections.addAll(allowedSources, ALLOWED_LOG_SOURCES); if (mAdditionalAllowedPackage != null) { allowedSources.add(mAdditionalAllowedPackage); } StatsdConfig.Builder builder = StatsdConfig.newBuilder(); StatsdConfig.Builder builder = StatsdConfig.newBuilder(); builder builder .addAllAllowedLogSource(Arrays.asList(ALLOWED_LOG_SOURCES)) .addAllAllowedLogSource(allowedSources) .setHashStringsInMetricReport(false); .setHashStringsInMetricReport(false); for (int atomId : atomIds) { for (int atomId : atomIds) { Loading core/java/android/util/StatsLog.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.util; package android.util; import android.annotation.NonNull; import android.os.IStatsManager; import android.os.IStatsManager; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; Loading Loading @@ -113,4 +114,18 @@ public final class StatsLog extends StatsLogInternal { sService = IStatsManager.Stub.asInterface(ServiceManager.getService("stats")); sService = IStatsManager.Stub.asInterface(ServiceManager.getService("stats")); return sService; return sService; } } /** * Add a log to the stats log. * * @param id The id of the atom * @param params The parameters of the atom's message. */ public static void write(int id, @NonNull Object... params) { switch (id) { case PERMISSION_GRANT_REQUEST_RESULT_REPORTED: write(id, (long) params[0], (int) params[1], (String) params[2], (String) params[3], (boolean) params[4], (int) params[5]); } } } } Loading
api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -48449,6 +48449,7 @@ package android.util { method public static boolean logEvent(int); method public static boolean logEvent(int); method public static boolean logStart(int); method public static boolean logStart(int); method public static boolean logStop(int); method public static boolean logStop(int); method public static void write(int, @NonNull java.lang.Object...); } } public class StringBuilderPrinter implements android.util.Printer { public class StringBuilderPrinter implements android.util.Printer {
api/system-current.txt +15 −0 Original line number Original line Diff line number Diff line Loading @@ -9208,6 +9208,21 @@ package android.util { method public int getUid(); method public int getUid(); } } public class StatsLogAtoms { field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED = 170; // 0xaa field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__AUTO_DENIED = 8; // 0x8 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__AUTO_GRANTED = 5; // 0x5 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED = 1; // 0x1 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED_POLICY_FIXED = 3; // 0x3 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED_USER_FIXED = 2; // 0x2 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_DENIED = 6; // 0x6 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_DENIED_WITH_PREJUDICE = 7; // 0x7 field public static final int PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_GRANTED = 4; // 0x4 } @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @IntDef(prefix="PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__", value={android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED_USER_FIXED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__IGNORED_POLICY_FIXED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_GRANTED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__AUTO_GRANTED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_DENIED, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__USER_DENIED_WITH_PREJUDICE, android.util.StatsLogAtoms.PERMISSION_GRANT_REQUEST_RESULT_REPORTED__RESULT__AUTO_DENIED}) public static @interface StatsLogAtoms.PermissionGrantRequestResultReported_Result { } } } package android.view { package android.view {
cmds/statsd/src/atoms.proto +43 −0 Original line number Original line Diff line number Diff line Loading @@ -236,6 +236,7 @@ message Atom { BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported = 167; BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported = 167; ScreenTimeoutExtensionReported screen_timeout_extension_reported = 168; ScreenTimeoutExtensionReported screen_timeout_extension_reported = 168; ProcessStartTime process_start_time = 169; ProcessStartTime process_start_time = 169; PermissionGrantRequestResultReported permission_grant_request_result_reported = 170; } } // Pulled events will start at field 10000. // Pulled events will start at field 10000. Loading Loading @@ -5096,6 +5097,48 @@ message SeStateChanged { optional string terminal = 3; optional string terminal = 3; } } /** * Information about a permission grant request */ message PermissionGrantRequestResultReported { // unique value identifying an API call. A API call might result in multiple of these atoms optional int64 request_id = 1; // UID of package requesting the permission grant optional int32 requesting_uid = 2 [(is_uid) = true]; // Name of package requesting the permission grant optional string requesting_package_name = 3; // The permission to be granted optional string permission_name = 4; // If the permission was explicitly requested via the API or added by the system optional bool is_implicit = 5; enum Result { UNDEFINED = 0; // permission request was ignored IGNORED = 1; // permission request was ignored because it was user fixed IGNORED_USER_FIXED = 2; // permission request was ignored because it was policy fixed IGNORED_POLICY_FIXED = 3; // permission was granted by user action USER_GRANTED = 4; // permission was automatically granted AUTO_GRANTED = 5; // permission was denied by user action USER_DENIED = 6; // permission was denied with prejudice by the user USER_DENIED_WITH_PREJUDICE = 7; // permission was automatically denied AUTO_DENIED = 8; } // The result of the permission grant optional Result result = 6; } /** /** * Logs when Omapi API used * Logs when Omapi API used * Logged from: * Logged from: Loading
cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java +17 −4 Original line number Original line Diff line number Diff line Loading @@ -32,7 +32,8 @@ import com.google.common.io.Files; import java.io.File; import java.io.File; import java.io.IOException; import java.io.IOException; import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.HashSet; import java.util.Set; import java.util.Set; import java.util.logging.Level; import java.util.logging.Level; Loading Loading @@ -60,6 +61,7 @@ public class TestDrive { }; }; private static final Logger LOGGER = Logger.getLogger(TestDrive.class.getName()); private static final Logger LOGGER = Logger.getLogger(TestDrive.class.getName()); private String mAdditionalAllowedPackage; private final Set<Long> mTrackedMetrics = new HashSet<>(); private final Set<Long> mTrackedMetrics = new HashSet<>(); public static void main(String[] args) { public static void main(String[] args) { Loading @@ -69,11 +71,16 @@ public class TestDrive { String remoteConfigPath = null; String remoteConfigPath = null; if (args.length < 1) { if (args.length < 1) { LOGGER.log(Level.SEVERE, "Usage: ./test_drive <atomId1> <atomId2> ... <atomIdN>"); LOGGER.log(Level.SEVERE, "Usage: ./test_drive [-p additional_allowed_package] " + "<atomId1> <atomId2> ... <atomIdN>"); return; return; } } for (int i = 0; i < args.length; i++) { if (args.length >= 3 && args[0].equals("-p")) { testDrive.mAdditionalAllowedPackage = args[1]; } for (int i = testDrive.mAdditionalAllowedPackage == null ? 0 : 2; i < args.length; i++) { try { try { int atomId = Integer.valueOf(args[i]); int atomId = Integer.valueOf(args[i]); if (Atom.getDescriptor().findFieldByNumber(atomId) == null) { if (Atom.getDescriptor().findFieldByNumber(atomId) == null) { Loading Loading @@ -137,9 +144,15 @@ public class TestDrive { long metricId = METRIC_ID_BASE; long metricId = METRIC_ID_BASE; long atomMatcherId = ATOM_MATCHER_ID_BASE; long atomMatcherId = ATOM_MATCHER_ID_BASE; ArrayList<String> allowedSources = new ArrayList<>(); Collections.addAll(allowedSources, ALLOWED_LOG_SOURCES); if (mAdditionalAllowedPackage != null) { allowedSources.add(mAdditionalAllowedPackage); } StatsdConfig.Builder builder = StatsdConfig.newBuilder(); StatsdConfig.Builder builder = StatsdConfig.newBuilder(); builder builder .addAllAllowedLogSource(Arrays.asList(ALLOWED_LOG_SOURCES)) .addAllAllowedLogSource(allowedSources) .setHashStringsInMetricReport(false); .setHashStringsInMetricReport(false); for (int atomId : atomIds) { for (int atomId : atomIds) { Loading
core/java/android/util/StatsLog.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.util; package android.util; import android.annotation.NonNull; import android.os.IStatsManager; import android.os.IStatsManager; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; Loading Loading @@ -113,4 +114,18 @@ public final class StatsLog extends StatsLogInternal { sService = IStatsManager.Stub.asInterface(ServiceManager.getService("stats")); sService = IStatsManager.Stub.asInterface(ServiceManager.getService("stats")); return sService; return sService; } } /** * Add a log to the stats log. * * @param id The id of the atom * @param params The parameters of the atom's message. */ public static void write(int id, @NonNull Object... params) { switch (id) { case PERMISSION_GRANT_REQUEST_RESULT_REPORTED: write(id, (long) params[0], (int) params[1], (String) params[2], (String) params[3], (boolean) params[4], (int) params[5]); } } } }