Namespaces

Enumerations

enum class HwShutdownReason : std::uint8_t
Name Value
kNotSet 0
kUndefined 1
kCold 2
kWarm 3
kBrownout 4
kWatchdog 5
kUserHardReset 6
kNotParseable 7

Defined at line 12 of file ../../src/developer/forensics/feedback/reboot_log/hw_shutdown_reason.h

enum class ZirconShutdownReason : std::uint8_t
Name Value
kNotSet 0
kNoCrash 1
kKernelPanic 2
kOOM 3
kSwWatchdog 4
kUnknown 5
kRootJobTermination 6
kNotParseable 7

Defined at line 12 of file ../../src/developer/forensics/feedback/reboot_log/zircon_shutdown_reason.h

enum class GracefulShutdownReason
Name Value Comments
kNotSet 0 --
kUserRequest 1 --
kSystemUpdate 2 --
kRetrySystemUpdate 3 --
kHighTemperature 4 --
kSessionFailure 5 --
kSysmgrFailure 6

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kCriticalComponentFailure 7

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kFdr 8

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kZbiSwap 9

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kOutOfMemory 10

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kNetstackMigration 11

TODO(https://fxbug.dev/42081574): Remove this reason once Netstack2 is
fully migrated to Netstack3.

kAndroidUnexpectedReason 12

TODO(https://fxbug.dev/42081574): Remove this reason once Netstack2 is
fully migrated to Netstack3.

kAndroidNoReason 13

TODO(https://fxbug.dev/42081574): Remove this reason once Netstack2 is
fully migrated to Netstack3.

kAndroidRescueParty 14

TODO(https://fxbug.dev/42081574): Remove this reason once Netstack2 is
fully migrated to Netstack3.

kAndroidCriticalProcessFailure 15

TODO(https://fxbug.dev/42081574): Remove this reason once Netstack2 is
fully migrated to Netstack3.

kDeveloperRequest 16

TODO(https://fxbug.dev/42081574): Remove this reason once Netstack2 is
fully migrated to Netstack3.

kUserRequestDeviceStuck 17

TODO(https://fxbug.dev/42081574): Remove this reason once Netstack2 is
fully migrated to Netstack3.

kBatteryDrained 18

TODO(https://fxbug.dev/42081574): Remove this reason once Netstack2 is
fully migrated to Netstack3.

kNotSupported 19

TODO(https://fxbug.dev/42081574): Remove this reason once Netstack2 is
fully migrated to Netstack3.

kNotParseable 20

TODO(https://fxbug.dev/42081574): Remove this reason once Netstack2 is
fully migrated to Netstack3.

Feedback's internal representation of why a device shutdown gracefully.

These values should not be used to understand why a device has shutdown outside of this

component.

Defined at line 19 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.h

enum class CrashReportUploadPolicy
Name Value Comments
kDisabled 0

Crash reports should not be uploaded and be kept in the store.

kEnabled 1

Crash reports should be uploaded and on success removed from the store, if present.
If the upload is unsuccessful and the policy changes to kDisabled, the crash report should
follow the kDisabled policy.

kReadFromPrivacySettings 2

Policy should not be read from the config, but instead from the privacy settings.

Policy defining whether to upload pending and future crash reports to a remote crash server.

Defined at line 20 of file ../../src/developer/forensics/feedback/config.h

enum class FinalShutdownReason : std::uint8_t
Name Value Comments
kNotParseable 0

Should map to any kNotParseable from HwShutdownReason or ZirconShutdownReason.

kCold 1

Should map to HwShutdownReason without kNotSet and kNoParseable.

kBrownout 2

Should map to HwShutdownReason without kNotSet and kNoParseable.

kHwWatchdog 3

Should map to HwShutdownReason without kNotSet and kNoParseable.

kUserHardReset 4

Should map to HwShutdownReason without kNotSet and kNoParseable.

kSpontaneousReboot 5

Should map to ZirconShutdownReason without kNotSet, kNoCrash and kNotParseable.

kKernelPanic 6

Should map to ZirconShutdownReason without kNotSet, kNoCrash and kNotParseable.

kOom 7

Should map to ZirconShutdownReason without kNotSet, kNoCrash and kNotParseable.

kSwWatchdog 8

Should map to ZirconShutdownReason without kNotSet, kNoCrash and kNotParseable.

kRootJobTermination 9

Should map to ZirconShutdownReason without kNotSet, kNoCrash and kNotParseable.

kGenericGraceful 10

Should map to GracefulShutdownReason without kNotSet, kNotSupported and kNotParseable.

kUnexpectedReasonGraceful 11

Should map to GracefulShutdownReason without kNotSet, kNotSupported and kNotParseable.

kUserRequest 12

Should map to GracefulShutdownReason without kNotSet, kNotSupported and kNotParseable.

kSystemUpdate 13

Should map to GracefulShutdownReason without kNotSet, kNotSupported and kNotParseable.

kRetrySystemUpdate 14

Should map to GracefulShutdownReason without kNotSet, kNotSupported and kNotParseable.

kHighTemperature 15

Should map to GracefulShutdownReason without kNotSet, kNotSupported and kNotParseable.

kSessionFailure 16

Should map to GracefulShutdownReason without kNotSet, kNotSupported and kNotParseable.

kSysmgrFailure 17

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kCriticalComponentFailure 18

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kFdr 19

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kZbiSwap 20

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kNetstackMigration 21

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kAndroidUnexpectedReason 22

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kAndroidNoReason 23

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kAndroidRescueParty 24

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kAndroidCriticalProcessFailure 25

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kDeveloperRequest 26

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kUserRequestDeviceStuck 27

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

kBatteryDrained 28

TODO(https://fxbug.dev/394392398): kSysmgrFailure is from CFv1, remove once it's no longer
written as a graceful shutdown reason or once deprecated reasons can be ignored.

Defined at line 23 of file ../../src/developer/forensics/feedback/reboot_log/final_shutdown_info.h

enum class SpontaneousRebootReason : std::uint8_t
Name Value
kSpontaneous 0
kBriefPowerLoss 1
kHardReset 2

Defined at line 33 of file ../../src/developer/forensics/feedback/config.h

enum class GracefulShutdownAction : std::uint8_t
Name Value
kPoweroff 0
kReboot 1
kRebootToRecovery 2
kRebootToBootloader 3
kNotSupported 4
kNotParseable 5

Feedback's internal representation of how a device shutdown gracefully.

These values should not be used to understand how a device has shutdown outside of this

component.

Defined at line 51 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.h

Records

Functions

  • template <>
    fuchsia::feedback::Annotations Encode<fuchsia::feedback::Annotations> (const Annotations & annotations)

    Defined at line 14 of file ../../src/developer/forensics/feedback/annotations/encode.cc

  • int main ()

    Defined at line 32 of file ../../src/developer/forensics/feedback/main.cc

  • Annotations FromFidl (const std::vector<fuchsia::feedback::Annotation> & annotations)

    Deserializes |annotations| as Annotations.

    Defined at line 11 of file ../../src/developer/forensics/feedback/annotations/decode.cc

  • template <typename T>
    T Encode (const Annotations & annotations)

    Returns |annotations| serialize as a certain type.

  • Annotations GetStartupAnnotations (const FinalShutdownInfo & final_shutdown_info, SpontaneousRebootReason spontaneous_reboot_reason, const std::string & compilation_mode_path)

    Gets annotations that are available immediately and synchronously when the component starts and

    never change while it is running.

    Defined at line 89 of file ../../src/developer/forensics/feedback/annotations/startup_annotations.cc

  • bool TestAndSetNotAFdr (const std::string & not_a_fdr_file)

    Return whether |not_a_fdr_path| existed in the file system and create it otherwise.

    Defined at line 53 of file ../../src/developer/forensics/feedback/namespace_init.cc

  • int DefaultCacheIdFn ()

    Default function for generating a random starting cache id by drawing from a uniform distribution

    between 0 and 7500. This is done in an attempt to prevent collisions between the current and

    previous boot logs and keep stringified IDs between 1 and 4 digits for easy human consumption.

    Defined at line 14 of file ../../src/developer/forensics/feedback/redactor_factory.cc

  • void MoveFile (const std::string & from, const std::string & to)

    Moves the file to |to| from |from|.

    Defined at line 28 of file ../../src/developer/forensics/feedback/namespace_init.cc

  • std::unique_ptr<RedactorBase> RedactorFromConfig (inspect::Node * root_node, const BuildTypeConfig & config, ::fit::function<int ()> seed_cache_id)

    Returns an IdentityRedactor if the file at |enable_flag_file| doesn't exist, otherwise return a

    Redactor.

    Defined at line 25 of file ../../src/developer/forensics/feedback/redactor_factory.cc

  • std::optional<SystemTime> GetPreviousSystemTime (const std::string & path)

    Parses the previous system time from the given file containing JSON. Returns std::nullopt on

    error.

    Defined at line 25 of file ../../src/developer/forensics/feedback/system_time_tracker.cc

  • template <>
    std::string Encode<std::string> (const Annotations & annotations)

    Defined at line 36 of file ../../src/developer/forensics/feedback/annotations/encode.cc

  • void CreatePreviousLogsFile (cobalt::Logger * cobalt, StorageSize max_decompressed_size, const std::string & dir, const std::string & write_path)

    Feedback data

    Decompress and concatenate the logs from the previous boot in |dir| and store the at

    |write_path|.

    Defined at line 65 of file ../../src/developer/forensics/feedback/namespace_init.cc

  • void MoveAndRecordBootId (const std::string & new_boot_id, const std::string & previous_boot_id_path, const std::string & current_boot_id_path, const std::string & timeline_path)

    Move the boot id stored at |current_boot_id_path| to |previous_boot_id_path| and write a new

    boot id to |current_boot_id_path|.

    Appends the new boot id to the timeline stored at |timeline_path| and truncates the timeline

    to the last 10 boot ids.

    Defined at line 90 of file ../../src/developer/forensics/feedback/namespace_init.cc

  • void MoveAndRecordBuildVersion (const std::string & current_build_version, const std::string & previous_build_version_path, const std::string & current_build_version_path)

    Move the build version stored at |current_build_version_path| to |previous_build_version_path|

    and write the current build version to |current_build_version_path|.

    Defined at line 114 of file ../../src/developer/forensics/feedback/namespace_init.cc

  • fpromise::promise<LifecycleStopSignal, Error> WaitForLifecycleStop (async_dispatcher_t * dispatcher, fidl::InterfaceRequest<fuchsia::process::lifecycle::Lifecycle> request)

    Returns a promise which will complete successfully when the lifecycle signal is received.

    Note, the response will be sent when the `LifecycleStopSignal` object is destroyed, if it hasn't

    already been sent.

    Defined at line 73 of file ../../src/developer/forensics/feedback/stop_signals.cc

  • void PrintTo (const AttachmentValue & value, std::ostream * os)

    Defined at line 161 of file ../../src/developer/forensics/testing/gpretty_printers.h

  • fpromise::promise<GracefulShutdownInfoSignal, Error> WaitForShutdownInfo (async_dispatcher_t * dispatcher, fidl::InterfaceRequest<fuchsia::hardware::power::statecontrol::ShutdownWatcher> request)

    Returns a promise which will complete successfully when the shutdown signal is received.

    Note, the response will be sent when the `GracefulShutdownInfoSignal` object is destroyed, if it

    hasn't already been sent.

    Defined at line 163 of file ../../src/developer/forensics/feedback/stop_signals.cc

  • void PrintTo (const GracefulShutdownInfoSignal & signal, std::ostream * os)

    Defined at line 180 of file ../../src/developer/forensics/testing/gpretty_printers.h

  • void PrintTo (const GracefulShutdownAction action, std::ostream * os)

    Defined at line 189 of file ../../src/developer/forensics/testing/gpretty_printers.h

  • std::string ToString (GracefulShutdownAction action)

    Defined at line 223 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc

  • std::string ToString (GracefulShutdownReason reason)

    Defined at line 244 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc

  • std::optional<SnapshotConfig> GetSnapshotConfig (const std::string & path)

    Defined at line 283 of file ../../src/developer/forensics/feedback/config.cc

  • std::optional<SnapshotExclusionConfig> GetSnapshotExclusionConfig (const std::string & path)

    Defined at line 288 of file ../../src/developer/forensics/feedback/config.cc

  • GracefulShutdownAction ToGracefulShutdownAction (const fuchsia::hardware::power::statecontrol::ShutdownOptions & options)

    Extracts the ShutdownAction from |options| and returns the action as a GracefulShutdownAction.

    Check-fails that |options| has the action set.

    Defined at line 476 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc

  • std::optional<FeedbackConfig> GetFeedbackConfig (const std::string & path)

    Defined at line 294 of file ../../src/developer/forensics/feedback/config.cc

  • std::vector<GracefulShutdownReason> ToGracefulShutdownReasons (const fuchsia::hardware::power::statecontrol::ShutdownOptions & options)

    Defined at line 496 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc

  • void ExposeConfig (inspect::Node & inspect_root, const FeedbackConfig & feedback_config)

    Exposes the static configuration based on build type and product.

    Defined at line 299 of file ../../src/developer/forensics/feedback/config.cc

  • std::vector<GracefulShutdownReason> FromLegacyTxtFile (std::string_view content)

    Converts the file contents into a list of `GracefulShutdownReasons`.

    The expected format is:

    "Reason 1,Reason 2,Reason 3"

    If the given string is empty, the returned list will be empty.

    Defined at line 399 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc

  • std::string ToString (CrashReportUploadPolicy upload_policy)

    Returns the string version of the enum.

    Defined at line 335 of file ../../src/developer/forensics/feedback/config.cc

  • std::string ToLegacyFileContentForTesting (const std::vector<GracefulShutdownReason> & reasons)

    Converts the list of `GracefulShutdownReasonss` into a single string.

    The format is:

    "Reason 1,Reason 2,Reason 3"

    Defined at line 297 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc

  • std::vector<std::string> ToReasonStrings (const std::vector<GracefulShutdownReason> & reasons)

    The input is limited to GracefulShutdownReasons that map to

    |power::statecontrol::ShutdownReason|.

    Note that some variants that should not be persisted (e.g. `kNotParseable`) are translated to

    `kNotSupported`.

    Defined at line 305 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc

  • GracefulShutdownInfo FromJson (const std::string & content)

    The input is limited to GracefulShutdownActions that map to |power::statecontrol::ShutdownAction|

    and GracefulShutdownReasons that map to |power::statecontrol::ShutdownReason|.

    The format is expected to be:

    {

    action: "action",

    reasons: [

    "Reason 1",

    "Reason 2"

    ]

    }

    Defined at line 415 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc

  • std::string ToJson (GracefulShutdownAction action, const std::vector<GracefulShutdownReason> & reasons)

    The input is limited to GracefulShutdownActions that map to |power::statecontrol::ShutdownAction|

    and GracefulShutdownReasons that map to |power::statecontrol::ShutdownReason|.

    Defined at line 353 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc

  • std::string ToRawStrings (const std::vector<GracefulShutdownReason> & reasons)

    Converts the list of `GracefulShutdownReasons` into a single comma-separated string, like

    "Reason 1,Reason 2,Reason 3".

    Defined at line 381 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc

  • void WriteGracefulShutdownInfo (GracefulShutdownAction action, const std::vector<GracefulShutdownReason> & reasons, const std::string & path)

    Writes the graceful shutdown action and reasons to `path`.

    Defined at line 510 of file ../../src/developer/forensics/feedback/reboot_log/graceful_shutdown_info.cc