Add bugreport mode for debugging onboarding.
Bug: 294990844
Test: atest
android.bugreport.cts.BugreportManagerTest#testOnboardingBugreport
Change-Id: I7e344fbd65977b7300ffcceae2ba6c9f35ae8a7a
diff --git a/cmds/dumpstate/DumpstateService.cpp b/cmds/dumpstate/DumpstateService.cpp
index a7bc018..c787113 100644
--- a/cmds/dumpstate/DumpstateService.cpp
+++ b/cmds/dumpstate/DumpstateService.cpp
@@ -141,6 +141,7 @@
bugreport_mode != Dumpstate::BugreportMode::BUGREPORT_WEAR &&
bugreport_mode != Dumpstate::BugreportMode::BUGREPORT_TELEPHONY &&
bugreport_mode != Dumpstate::BugreportMode::BUGREPORT_WIFI &&
+ bugreport_mode != Dumpstate::BugreportMode::BUGREPORT_ONBOARDING &&
bugreport_mode != Dumpstate::BugreportMode::BUGREPORT_DEFAULT) {
MYLOGE("Invalid input: bad bugreport mode: %d", bugreport_mode);
signalErrorAndExit(listener, IDumpstateListener::BUGREPORT_ERROR_INVALID_INPUT);
diff --git a/cmds/dumpstate/binder/android/os/IDumpstate.aidl b/cmds/dumpstate/binder/android/os/IDumpstate.aidl
index 0dc8f5a..fa9bcf3 100644
--- a/cmds/dumpstate/binder/android/os/IDumpstate.aidl
+++ b/cmds/dumpstate/binder/android/os/IDumpstate.aidl
@@ -49,6 +49,9 @@
// Default mode.
const int BUGREPORT_MODE_DEFAULT = 6;
+ // Bugreport taken for onboarding related flows.
+ const int BUGREPORT_MODE_ONBOARDING = 7;
+
// Use pre-dumped data.
const int BUGREPORT_FLAG_USE_PREDUMPED_UI_DATA = 0x1;
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index e132b35..376d57a 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -2176,6 +2176,11 @@
printf("========================================================\n");
}
+// Collects a lightweight dumpstate to be used for debugging onboarding related flows.
+static void DumpstateOnboardingOnly() {
+ ds.AddDir(LOGPERSIST_DATA_DIR, false);
+}
+
Dumpstate::RunStatus Dumpstate::DumpTraces(const char** path) {
const std::string temp_file_pattern = ds.bugreport_internal_dir_ + "/dumptrace_XXXXXX";
const size_t buf_size = temp_file_pattern.length() + 1;
@@ -2308,6 +2313,7 @@
return dumpstate_hal_hidl::DumpstateMode::CONNECTIVITY;
case Dumpstate::BugreportMode::BUGREPORT_WIFI:
return dumpstate_hal_hidl::DumpstateMode::WIFI;
+ case Dumpstate::BugreportMode::BUGREPORT_ONBOARDING:
case Dumpstate::BugreportMode::BUGREPORT_DEFAULT:
return dumpstate_hal_hidl::DumpstateMode::DEFAULT;
}
@@ -2329,6 +2335,7 @@
return dumpstate_hal_aidl::IDumpstateDevice::DumpstateMode::CONNECTIVITY;
case Dumpstate::BugreportMode::BUGREPORT_WIFI:
return dumpstate_hal_aidl::IDumpstateDevice::DumpstateMode::WIFI;
+ case Dumpstate::BugreportMode::BUGREPORT_ONBOARDING:
case Dumpstate::BugreportMode::BUGREPORT_DEFAULT:
return dumpstate_hal_aidl::IDumpstateDevice::DumpstateMode::DEFAULT;
}
@@ -2812,6 +2819,8 @@
return "BUGREPORT_TELEPHONY";
case Dumpstate::BugreportMode::BUGREPORT_WIFI:
return "BUGREPORT_WIFI";
+ case Dumpstate::BugreportMode::BUGREPORT_ONBOARDING:
+ return "BUGREPORT_ONBOARDING";
case Dumpstate::BugreportMode::BUGREPORT_DEFAULT:
return "BUGREPORT_DEFAULT";
}
@@ -2857,6 +2866,10 @@
options->wifi_only = true;
options->do_screenshot = false;
break;
+ case Dumpstate::BugreportMode::BUGREPORT_ONBOARDING:
+ options->onboarding_only = true;
+ options->do_screenshot = false;
+ break;
case Dumpstate::BugreportMode::BUGREPORT_DEFAULT:
break;
}
@@ -3276,6 +3289,8 @@
DumpstateWifiOnly();
} else if (options_->limited_only) {
DumpstateLimitedOnly();
+ } else if (options_->onboarding_only) {
+ DumpstateOnboardingOnly();
} else {
// Dump state for the default case. This also drops root.
RunStatus s = DumpstateDefaultAfterCritical();
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 8a31c31..0a032ec 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -201,6 +201,7 @@
BUGREPORT_WEAR = android::os::IDumpstate::BUGREPORT_MODE_WEAR,
BUGREPORT_TELEPHONY = android::os::IDumpstate::BUGREPORT_MODE_TELEPHONY,
BUGREPORT_WIFI = android::os::IDumpstate::BUGREPORT_MODE_WIFI,
+ BUGREPORT_ONBOARDING = android::os::IDumpstate::BUGREPORT_MODE_ONBOARDING,
BUGREPORT_DEFAULT = android::os::IDumpstate::BUGREPORT_MODE_DEFAULT
};
@@ -412,6 +413,7 @@
bool show_header_only = false;
bool telephony_only = false;
bool wifi_only = false;
+ bool onboarding_only = false;
// Trimmed-down version of dumpstate to only include whitelisted logs.
bool limited_only = false;
// Whether progress updates should be published.