Loading cmds/statsd/src/atoms.proto +93 −0 Original line number Diff line number Diff line Loading @@ -299,6 +299,10 @@ message Atom { CarPowerStateChanged car_power_state_changed = 203; GarageModeInfo garage_mode_info = 204; TestAtomReported test_atom_reported = 205 [(log_from_module) = "cts"]; ContentCaptureCallerMismatchReported content_capture_caller_mismatch_reported = 206; ContentCaptureServiceEvents content_capture_service_events = 207; ContentCaptureSessionEvents content_capture_session_events = 208; ContentCaptureFlushed content_capture_flushed = 209; } // Pulled events will start at field 10000. Loading Loading @@ -4830,6 +4834,95 @@ message BuildInformation { optional string tags = 9; } /** * Logs information about mismatched caller for content capture. * * Logged from: * frameworks/base/core/java/android/service/contentcapture/ContentCaptureService.java */ message ContentCaptureCallerMismatchReported { optional string intended_package = 1; optional string calling_package = 2; } /** * Logs information about content capture service events. * * Logged from: * frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java */ message ContentCaptureServiceEvents { // The type of event. enum Event { UNKNOWN = 0; ON_CONNECTED = 1; ON_DISCONNECTED = 2; SET_WHITELIST = 3; SET_DISABLED = 4; ON_USER_DATA_REMOVED = 5; } optional Event event = 1; // component/package of content capture service. optional string service_info = 2; // component/package of target. // it's a concatenated list of component/package for SET_WHITELIST event // separated by " ". optional string target_info = 3; } /** * Logs information about content capture session events. * * Logged from: * frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java */ message ContentCaptureSessionEvents { // The type of event. enum Event { UNKNOWN = 0; ON_SESSION_STARTED = 1; ON_SESSION_FINISHED = 2; SESSION_NOT_CREATED = 3; } optional int32 session_id = 1; optional Event event = 2; // (n/a on session finished) optional int32 state_flags = 3; // component/package of content capture service. optional string service_info = 4; // component/package of app. // (n/a on session finished) optional string app_info = 5; optional bool is_child_session = 6; } /** * Logs information about session being flushed. * * Logged from: * frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java */ message ContentCaptureFlushed { optional int32 session_id = 1; // component/package of content capture service. optional string service_info = 2; // component/package of app. optional string app_info = 3; // session start/finish events optional int32 child_session_started = 4; optional int32 child_session_finished = 5; // count of view events. optional int32 view_appeared_count = 6; optional int32 view_disappeared_count = 7; optional int32 view_text_changed_count = 8; // Flush stats. optional int32 max_events = 9; optional int32 idle_flush_freq = 10; optional int32 text_flush_freq = 11; optional int32 flush_reason = 12; } /** * Pulls on-device BatteryStats power use calculations for the overall device. */ Loading cmds/statsd/src/statsd_config.proto +2 −0 Original line number Diff line number Diff line Loading @@ -330,6 +330,8 @@ message IncidentdDetails { // Class name of the incident report receiver. optional string receiver_cls = 4; optional string alert_description = 5; } message PerfettoDetails { Loading cmds/statsd/src/subscriber/IncidentdReporter.cpp +8 −3 Original line number Diff line number Diff line Loading @@ -36,12 +36,14 @@ namespace statsd { using android::util::ProtoOutputStream; using std::vector; using util::FIELD_TYPE_MESSAGE; using util::FIELD_TYPE_INT32; using util::FIELD_TYPE_INT64; using util::FIELD_TYPE_MESSAGE; using util::FIELD_TYPE_STRING; // field ids in IncidentHeaderProto const int FIELD_ID_ALERT_ID = 1; const int FIELD_ID_REASON = 2; const int FIELD_ID_CONFIG_KEY = 3; const int FIELD_ID_CONFIG_KEY_UID = 1; const int FIELD_ID_CONFIG_KEY_ID = 2; Loading @@ -57,9 +59,11 @@ const int FIELD_ID_PACKAGE_INFO = 3; namespace { void getProtoData(const int64_t& rule_id, int64_t metricId, const MetricDimensionKey& dimensionKey, int64_t metricValue, const ConfigKey& configKey, vector<uint8_t>* protoData) { int64_t metricValue, const ConfigKey& configKey, const string& reason, vector<uint8_t>* protoData) { ProtoOutputStream headerProto; headerProto.write(FIELD_TYPE_INT64 | FIELD_ID_ALERT_ID, (long long)rule_id); headerProto.write(FIELD_TYPE_STRING | FIELD_ID_REASON, reason); uint64_t token = headerProto.start(FIELD_TYPE_MESSAGE | FIELD_ID_CONFIG_KEY); headerProto.write(FIELD_TYPE_INT32 | FIELD_ID_CONFIG_KEY_UID, configKey.GetUid()); Loading Loading @@ -142,7 +146,8 @@ bool GenerateIncidentReport(const IncidentdDetails& config, int64_t rule_id, int IncidentReportArgs incidentReport; vector<uint8_t> protoData; getProtoData(rule_id, metricId, dimensionKey, metricValue, configKey, &protoData); getProtoData(rule_id, metricId, dimensionKey, metricValue, configKey, config.alert_description(), &protoData); incidentReport.addHeader(protoData); for (int i = 0; i < config.section_size(); i++) { Loading core/java/android/app/ApplicationPackageManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -1920,8 +1920,8 @@ public class ApplicationPackageManager extends PackageManager { private int installExistingPackageAsUser(String packageName, int installReason, int userId) throws NameNotFoundException { try { int res = mPM.installExistingPackageAsUser(packageName, userId, 0 /*installFlags*/, installReason); int res = mPM.installExistingPackageAsUser(packageName, userId, INSTALL_ALL_WHITELIST_RESTRICTED_PERMISSIONS, installReason, null); if (res == INSTALL_FAILED_INVALID_URI) { throw new NameNotFoundException("Package " + packageName + " doesn't exist"); } Loading core/java/android/app/admin/SecurityLog.java +5 −0 Original line number Diff line number Diff line Loading @@ -636,6 +636,11 @@ public class SecurityLog { public int hashCode() { return Objects.hash(mEvent, mId); } /** @hide */ public boolean eventEquals(SecurityEvent other) { return other != null && mEvent.equals(other.mEvent); } } /** * Retrieve all security logs and return immediately. Loading Loading
cmds/statsd/src/atoms.proto +93 −0 Original line number Diff line number Diff line Loading @@ -299,6 +299,10 @@ message Atom { CarPowerStateChanged car_power_state_changed = 203; GarageModeInfo garage_mode_info = 204; TestAtomReported test_atom_reported = 205 [(log_from_module) = "cts"]; ContentCaptureCallerMismatchReported content_capture_caller_mismatch_reported = 206; ContentCaptureServiceEvents content_capture_service_events = 207; ContentCaptureSessionEvents content_capture_session_events = 208; ContentCaptureFlushed content_capture_flushed = 209; } // Pulled events will start at field 10000. Loading Loading @@ -4830,6 +4834,95 @@ message BuildInformation { optional string tags = 9; } /** * Logs information about mismatched caller for content capture. * * Logged from: * frameworks/base/core/java/android/service/contentcapture/ContentCaptureService.java */ message ContentCaptureCallerMismatchReported { optional string intended_package = 1; optional string calling_package = 2; } /** * Logs information about content capture service events. * * Logged from: * frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java */ message ContentCaptureServiceEvents { // The type of event. enum Event { UNKNOWN = 0; ON_CONNECTED = 1; ON_DISCONNECTED = 2; SET_WHITELIST = 3; SET_DISABLED = 4; ON_USER_DATA_REMOVED = 5; } optional Event event = 1; // component/package of content capture service. optional string service_info = 2; // component/package of target. // it's a concatenated list of component/package for SET_WHITELIST event // separated by " ". optional string target_info = 3; } /** * Logs information about content capture session events. * * Logged from: * frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java */ message ContentCaptureSessionEvents { // The type of event. enum Event { UNKNOWN = 0; ON_SESSION_STARTED = 1; ON_SESSION_FINISHED = 2; SESSION_NOT_CREATED = 3; } optional int32 session_id = 1; optional Event event = 2; // (n/a on session finished) optional int32 state_flags = 3; // component/package of content capture service. optional string service_info = 4; // component/package of app. // (n/a on session finished) optional string app_info = 5; optional bool is_child_session = 6; } /** * Logs information about session being flushed. * * Logged from: * frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java */ message ContentCaptureFlushed { optional int32 session_id = 1; // component/package of content capture service. optional string service_info = 2; // component/package of app. optional string app_info = 3; // session start/finish events optional int32 child_session_started = 4; optional int32 child_session_finished = 5; // count of view events. optional int32 view_appeared_count = 6; optional int32 view_disappeared_count = 7; optional int32 view_text_changed_count = 8; // Flush stats. optional int32 max_events = 9; optional int32 idle_flush_freq = 10; optional int32 text_flush_freq = 11; optional int32 flush_reason = 12; } /** * Pulls on-device BatteryStats power use calculations for the overall device. */ Loading
cmds/statsd/src/statsd_config.proto +2 −0 Original line number Diff line number Diff line Loading @@ -330,6 +330,8 @@ message IncidentdDetails { // Class name of the incident report receiver. optional string receiver_cls = 4; optional string alert_description = 5; } message PerfettoDetails { Loading
cmds/statsd/src/subscriber/IncidentdReporter.cpp +8 −3 Original line number Diff line number Diff line Loading @@ -36,12 +36,14 @@ namespace statsd { using android::util::ProtoOutputStream; using std::vector; using util::FIELD_TYPE_MESSAGE; using util::FIELD_TYPE_INT32; using util::FIELD_TYPE_INT64; using util::FIELD_TYPE_MESSAGE; using util::FIELD_TYPE_STRING; // field ids in IncidentHeaderProto const int FIELD_ID_ALERT_ID = 1; const int FIELD_ID_REASON = 2; const int FIELD_ID_CONFIG_KEY = 3; const int FIELD_ID_CONFIG_KEY_UID = 1; const int FIELD_ID_CONFIG_KEY_ID = 2; Loading @@ -57,9 +59,11 @@ const int FIELD_ID_PACKAGE_INFO = 3; namespace { void getProtoData(const int64_t& rule_id, int64_t metricId, const MetricDimensionKey& dimensionKey, int64_t metricValue, const ConfigKey& configKey, vector<uint8_t>* protoData) { int64_t metricValue, const ConfigKey& configKey, const string& reason, vector<uint8_t>* protoData) { ProtoOutputStream headerProto; headerProto.write(FIELD_TYPE_INT64 | FIELD_ID_ALERT_ID, (long long)rule_id); headerProto.write(FIELD_TYPE_STRING | FIELD_ID_REASON, reason); uint64_t token = headerProto.start(FIELD_TYPE_MESSAGE | FIELD_ID_CONFIG_KEY); headerProto.write(FIELD_TYPE_INT32 | FIELD_ID_CONFIG_KEY_UID, configKey.GetUid()); Loading Loading @@ -142,7 +146,8 @@ bool GenerateIncidentReport(const IncidentdDetails& config, int64_t rule_id, int IncidentReportArgs incidentReport; vector<uint8_t> protoData; getProtoData(rule_id, metricId, dimensionKey, metricValue, configKey, &protoData); getProtoData(rule_id, metricId, dimensionKey, metricValue, configKey, config.alert_description(), &protoData); incidentReport.addHeader(protoData); for (int i = 0; i < config.section_size(); i++) { Loading
core/java/android/app/ApplicationPackageManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -1920,8 +1920,8 @@ public class ApplicationPackageManager extends PackageManager { private int installExistingPackageAsUser(String packageName, int installReason, int userId) throws NameNotFoundException { try { int res = mPM.installExistingPackageAsUser(packageName, userId, 0 /*installFlags*/, installReason); int res = mPM.installExistingPackageAsUser(packageName, userId, INSTALL_ALL_WHITELIST_RESTRICTED_PERMISSIONS, installReason, null); if (res == INSTALL_FAILED_INVALID_URI) { throw new NameNotFoundException("Package " + packageName + " doesn't exist"); } Loading
core/java/android/app/admin/SecurityLog.java +5 −0 Original line number Diff line number Diff line Loading @@ -636,6 +636,11 @@ public class SecurityLog { public int hashCode() { return Objects.hash(mEvent, mId); } /** @hide */ public boolean eventEquals(SecurityEvent other) { return other != null && mEvent.equals(other.mEvent); } } /** * Retrieve all security logs and return immediately. Loading