Loading cmds/dumpstate/dumpstate.cpp +12 −19 Original line number Original line Diff line number Diff line Loading @@ -1367,13 +1367,11 @@ static void DumpExternalFragmentationInfo() { printf("\n"); printf("\n"); } } static void DumpstateArcOnly() { static void DumpstateLimitedOnly() { // Trimmed-down version of dumpstate to only include a whitelisted // Trimmed-down version of dumpstate to only include a whitelisted // set of logs (system log, event log, and system server / system app // set of logs (system log, event log, and system server / system app // crashes, and ARC networking logs). See b/136273873 and b/138459828 // crashes, and networking logs). See b/136273873 and b/138459828 // for context. New sections must be first approved by Chrome OS Privacy // for context. // and then added to server side cros monitoring PII scrubber before adding // them here. See cl/312126645 for an example. DurationReporter duration_reporter("DUMPSTATE"); DurationReporter duration_reporter("DUMPSTATE"); unsigned long timeout_ms; unsigned long timeout_ms; // calculate timeout // calculate timeout Loading @@ -1391,11 +1389,6 @@ static void DumpstateArcOnly() { printf("== Networking Service\n"); printf("== Networking Service\n"); printf("========================================================\n"); printf("========================================================\n"); // ARC networking service implements dumpsys by reusing the 'wifi' service name. // The top-level handler is implemented in handleDump() in // vendor/google_arc/libs/arc-services/src/com/android/server/arc/net/ArcNetworkService.java. // It outputs a subset of Android system server state relevant for debugging ARC // connectivity issues, in a PII-free manner. See b/147270970. RunDumpsys("DUMPSYS NETWORK_SERVICE_LIMITED", {"wifi", "-a"}, RunDumpsys("DUMPSYS NETWORK_SERVICE_LIMITED", {"wifi", "-a"}, CommandOptions::WithTimeout(90).Build(), SEC_TO_MSEC(10)); CommandOptions::WithTimeout(90).Build(), SEC_TO_MSEC(10)); Loading Loading @@ -2100,7 +2093,7 @@ void Dumpstate::DumpstateBoard() { static void ShowUsage() { static void ShowUsage() { fprintf(stderr, fprintf(stderr, "usage: dumpstate [-h] [-b soundfile] [-e soundfile] [-d] [-p] " "usage: dumpstate [-h] [-b soundfile] [-e soundfile] [-d] [-p] " "[-z] [-s] [-S] [-q] [-P] [-R] [-A] [-V version]\n" "[-z] [-s] [-S] [-q] [-P] [-R] [-L] [-V version]\n" " -h: display this help message\n" " -h: display this help message\n" " -b: play sound file instead of vibrate, at beginning of job\n" " -b: play sound file instead of vibrate, at beginning of job\n" " -e: play sound file instead of vibrate, at end of job\n" " -e: play sound file instead of vibrate, at end of job\n" Loading @@ -2113,7 +2106,7 @@ static void ShowUsage() { " -P: send broadcast when started and do progress updates\n" " -P: send broadcast when started and do progress updates\n" " -R: take bugreport in remote mode (requires -z and -d, shouldn't be used with -P)\n" " -R: take bugreport in remote mode (requires -z and -d, shouldn't be used with -P)\n" " -w: start binder service and make it wait for a call to startBugreport\n" " -w: start binder service and make it wait for a call to startBugreport\n" " -A: output limited information that is safe for submission in ARC++ bugreports\n" " -L: output limited information that is safe for submission in feedback reports\n" " -v: prints the dumpstate header and exit\n"); " -v: prints the dumpstate header and exit\n"); } } Loading Loading @@ -2359,12 +2352,12 @@ static void LogDumpOptions(const Dumpstate::DumpOptions& options) { "do_zip_file: %d do_vibrate: %d use_socket: %d use_control_socket: %d do_screenshot: %d " "do_zip_file: %d do_vibrate: %d use_socket: %d use_control_socket: %d do_screenshot: %d " "is_remote_mode: %d show_header_only: %d do_start_service: %d telephony_only: %d " "is_remote_mode: %d show_header_only: %d do_start_service: %d telephony_only: %d " "wifi_only: %d do_progress_updates: %d fd: %d bugreport_mode: %s dumpstate_hal_mode: %s " "wifi_only: %d do_progress_updates: %d fd: %d bugreport_mode: %s dumpstate_hal_mode: %s " "arc_only: %d args: %s\n", "limited_only: %d args: %s\n", options.do_zip_file, options.do_vibrate, options.use_socket, options.use_control_socket, options.do_zip_file, options.do_vibrate, options.use_socket, options.use_control_socket, options.do_screenshot, options.is_remote_mode, options.show_header_only, options.do_screenshot, options.is_remote_mode, options.show_header_only, options.do_start_service, options.telephony_only, options.wifi_only, options.do_start_service, options.telephony_only, options.wifi_only, options.do_progress_updates, options.bugreport_fd.get(), options.bugreport_mode.c_str(), options.do_progress_updates, options.bugreport_fd.get(), options.bugreport_mode.c_str(), toString(options.dumpstate_hal_mode).c_str(), options.arc_only, options.args.c_str()); toString(options.dumpstate_hal_mode).c_str(), options.limited_only, options.args.c_str()); } } void Dumpstate::DumpOptions::Initialize(BugreportMode bugreport_mode, void Dumpstate::DumpOptions::Initialize(BugreportMode bugreport_mode, Loading @@ -2386,7 +2379,7 @@ void Dumpstate::DumpOptions::Initialize(BugreportMode bugreport_mode, Dumpstate::RunStatus Dumpstate::DumpOptions::Initialize(int argc, char* argv[]) { Dumpstate::RunStatus Dumpstate::DumpOptions::Initialize(int argc, char* argv[]) { RunStatus status = RunStatus::OK; RunStatus status = RunStatus::OK; int c; int c; while ((c = getopt(argc, argv, "dho:svqzpAPBRSV:w")) != -1) { while ((c = getopt(argc, argv, "dho:svqzpLPBRSV:w")) != -1) { switch (c) { switch (c) { // clang-format off // clang-format off case 'd': do_add_date = true; break; case 'd': do_add_date = true; break; Loading @@ -2398,7 +2391,7 @@ Dumpstate::RunStatus Dumpstate::DumpOptions::Initialize(int argc, char* argv[]) case 'p': do_screenshot = true; break; case 'p': do_screenshot = true; break; case 'P': do_progress_updates = true; break; case 'P': do_progress_updates = true; break; case 'R': is_remote_mode = true; break; case 'R': is_remote_mode = true; break; case 'A': arc_only = true; break; case 'L': limited_only = true; break; case 'V': break; // compatibility no-op case 'V': break; // compatibility no-op case 'w': case 'w': // This was already processed // This was already processed Loading Loading @@ -2683,7 +2676,7 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid, // duration is logged into MYLOG instead. // duration is logged into MYLOG instead. PrintHeader(); PrintHeader(); // TODO(nandana) reduce code repetition in if branches // TODO(b/158737089) reduce code repetition in if branches if (options_->telephony_only) { if (options_->telephony_only) { MaybeTakeEarlyScreenshot(); MaybeTakeEarlyScreenshot(); onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); Loading @@ -2695,11 +2688,11 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid, onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); MaybeCheckUserConsent(calling_uid, calling_package); MaybeCheckUserConsent(calling_uid, calling_package); DumpstateWifiOnly(); DumpstateWifiOnly(); } else if (options_->arc_only) { } else if (options_->limited_only) { MaybeTakeEarlyScreenshot(); MaybeTakeEarlyScreenshot(); onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); MaybeCheckUserConsent(calling_uid, calling_package); MaybeCheckUserConsent(calling_uid, calling_package); DumpstateArcOnly(); DumpstateLimitedOnly(); } else { } else { // Invoke critical dumpsys first to preserve system state, before doing anything else. // Invoke critical dumpsys first to preserve system state, before doing anything else. RunDumpsysCritical(); RunDumpsysCritical(); Loading cmds/dumpstate/dumpstate.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -378,7 +378,7 @@ class Dumpstate { bool telephony_only = false; bool telephony_only = false; bool wifi_only = false; bool wifi_only = false; // Trimmed-down version of dumpstate to only include whitelisted logs. // Trimmed-down version of dumpstate to only include whitelisted logs. bool arc_only = false; bool limited_only = false; // Whether progress updates should be published. // Whether progress updates should be published. bool do_progress_updates = false; bool do_progress_updates = false; // The mode we'll use when calling IDumpstateDevice::dumpstateBoard. // The mode we'll use when calling IDumpstateDevice::dumpstateBoard. Loading cmds/dumpstate/main.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,7 @@ bool ShouldStartServiceAndWait(int argc, char* argv[]) { bool do_wait = false; bool do_wait = false; int c; int c; // Keep flags in sync with Dumpstate::DumpOptions::Initialize. // Keep flags in sync with Dumpstate::DumpOptions::Initialize. while ((c = getopt(argc, argv, "dho:svqzpAPBRSV:w")) != -1 && !do_wait) { while ((c = getopt(argc, argv, "dho:svqzpLPBRSV:w")) != -1 && !do_wait) { switch (c) { switch (c) { case 'w': case 'w': do_wait = true; do_wait = true; Loading cmds/dumpstate/tests/dumpstate_test.cpp +15 −15 Original line number Original line Diff line number Diff line Loading @@ -179,7 +179,7 @@ TEST_F(DumpOptionsTest, InitializeNone) { EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); } } Loading Loading @@ -207,7 +207,7 @@ TEST_F(DumpOptionsTest, InitializeAdbBugreport) { EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); } } Loading @@ -233,7 +233,7 @@ TEST_F(DumpOptionsTest, InitializeAdbShellBugreport) { EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); } } Loading @@ -252,7 +252,7 @@ TEST_F(DumpOptionsTest, InitializeFullBugReport) { EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.do_start_service); EXPECT_FALSE(options_.do_start_service); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeInteractiveBugReport) { TEST_F(DumpOptionsTest, InitializeInteractiveBugReport) { Loading @@ -270,7 +270,7 @@ TEST_F(DumpOptionsTest, InitializeInteractiveBugReport) { EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeRemoteBugReport) { TEST_F(DumpOptionsTest, InitializeRemoteBugReport) { Loading @@ -287,7 +287,7 @@ TEST_F(DumpOptionsTest, InitializeRemoteBugReport) { EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeWearBugReport) { TEST_F(DumpOptionsTest, InitializeWearBugReport) { Loading @@ -305,7 +305,7 @@ TEST_F(DumpOptionsTest, InitializeWearBugReport) { EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeTelephonyBugReport) { TEST_F(DumpOptionsTest, InitializeTelephonyBugReport) { Loading @@ -323,7 +323,7 @@ TEST_F(DumpOptionsTest, InitializeTelephonyBugReport) { EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeWifiBugReport) { TEST_F(DumpOptionsTest, InitializeWifiBugReport) { Loading @@ -341,10 +341,10 @@ TEST_F(DumpOptionsTest, InitializeWifiBugReport) { EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeArcOnlyBugreport) { TEST_F(DumpOptionsTest, InitializeLimitedOnlyBugreport) { // clang-format off // clang-format off char* argv[] = { char* argv[] = { const_cast<char*>("dumpstatez"), const_cast<char*>("dumpstatez"), Loading @@ -352,7 +352,7 @@ TEST_F(DumpOptionsTest, InitializeArcOnlyBugreport) { const_cast<char*>("-d"), const_cast<char*>("-d"), const_cast<char*>("-z"), const_cast<char*>("-z"), const_cast<char*>("-q"), const_cast<char*>("-q"), const_cast<char*>("-A") const_cast<char*>("-L") }; }; // clang-format on // clang-format on Loading @@ -363,7 +363,7 @@ TEST_F(DumpOptionsTest, InitializeArcOnlyBugreport) { EXPECT_TRUE(options_.do_zip_file); EXPECT_TRUE(options_.do_zip_file); EXPECT_TRUE(options_.use_control_socket); EXPECT_TRUE(options_.use_control_socket); EXPECT_FALSE(options_.do_vibrate); EXPECT_FALSE(options_.do_vibrate); EXPECT_TRUE(options_.arc_only); EXPECT_TRUE(options_.limited_only); // Other options retain default values // Other options retain default values EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.show_header_only); Loading Loading @@ -400,7 +400,7 @@ TEST_F(DumpOptionsTest, InitializeDefaultBugReport) { EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.wifi_only); EXPECT_FALSE(options_.wifi_only); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializePartial1) { TEST_F(DumpOptionsTest, InitializePartial1) { Loading Loading @@ -430,7 +430,7 @@ TEST_F(DumpOptionsTest, InitializePartial1) { EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); } } Loading Loading @@ -460,7 +460,7 @@ TEST_F(DumpOptionsTest, InitializePartial2) { EXPECT_FALSE(options_.do_zip_file); EXPECT_FALSE(options_.do_zip_file); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_control_socket); EXPECT_FALSE(options_.use_control_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); } } Loading services/sensorservice/SensorDeviceUtils.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -36,7 +36,7 @@ inline void quantizeValue(float *value, double resolution) { // Increase the value of the sensor's nominal resolution to ensure that // Increase the value of the sensor's nominal resolution to ensure that // sensor accuracy improvements, like runtime calibration, are not masked // sensor accuracy improvements, like runtime calibration, are not masked // during requantization. // during requantization. double incRes = 0.25 * resolution; double incRes = 0.125 * resolution; *value = round(static_cast<double>(*value) / incRes) * incRes; *value = round(static_cast<double>(*value) / incRes) * incRes; } } Loading Loading
cmds/dumpstate/dumpstate.cpp +12 −19 Original line number Original line Diff line number Diff line Loading @@ -1367,13 +1367,11 @@ static void DumpExternalFragmentationInfo() { printf("\n"); printf("\n"); } } static void DumpstateArcOnly() { static void DumpstateLimitedOnly() { // Trimmed-down version of dumpstate to only include a whitelisted // Trimmed-down version of dumpstate to only include a whitelisted // set of logs (system log, event log, and system server / system app // set of logs (system log, event log, and system server / system app // crashes, and ARC networking logs). See b/136273873 and b/138459828 // crashes, and networking logs). See b/136273873 and b/138459828 // for context. New sections must be first approved by Chrome OS Privacy // for context. // and then added to server side cros monitoring PII scrubber before adding // them here. See cl/312126645 for an example. DurationReporter duration_reporter("DUMPSTATE"); DurationReporter duration_reporter("DUMPSTATE"); unsigned long timeout_ms; unsigned long timeout_ms; // calculate timeout // calculate timeout Loading @@ -1391,11 +1389,6 @@ static void DumpstateArcOnly() { printf("== Networking Service\n"); printf("== Networking Service\n"); printf("========================================================\n"); printf("========================================================\n"); // ARC networking service implements dumpsys by reusing the 'wifi' service name. // The top-level handler is implemented in handleDump() in // vendor/google_arc/libs/arc-services/src/com/android/server/arc/net/ArcNetworkService.java. // It outputs a subset of Android system server state relevant for debugging ARC // connectivity issues, in a PII-free manner. See b/147270970. RunDumpsys("DUMPSYS NETWORK_SERVICE_LIMITED", {"wifi", "-a"}, RunDumpsys("DUMPSYS NETWORK_SERVICE_LIMITED", {"wifi", "-a"}, CommandOptions::WithTimeout(90).Build(), SEC_TO_MSEC(10)); CommandOptions::WithTimeout(90).Build(), SEC_TO_MSEC(10)); Loading Loading @@ -2100,7 +2093,7 @@ void Dumpstate::DumpstateBoard() { static void ShowUsage() { static void ShowUsage() { fprintf(stderr, fprintf(stderr, "usage: dumpstate [-h] [-b soundfile] [-e soundfile] [-d] [-p] " "usage: dumpstate [-h] [-b soundfile] [-e soundfile] [-d] [-p] " "[-z] [-s] [-S] [-q] [-P] [-R] [-A] [-V version]\n" "[-z] [-s] [-S] [-q] [-P] [-R] [-L] [-V version]\n" " -h: display this help message\n" " -h: display this help message\n" " -b: play sound file instead of vibrate, at beginning of job\n" " -b: play sound file instead of vibrate, at beginning of job\n" " -e: play sound file instead of vibrate, at end of job\n" " -e: play sound file instead of vibrate, at end of job\n" Loading @@ -2113,7 +2106,7 @@ static void ShowUsage() { " -P: send broadcast when started and do progress updates\n" " -P: send broadcast when started and do progress updates\n" " -R: take bugreport in remote mode (requires -z and -d, shouldn't be used with -P)\n" " -R: take bugreport in remote mode (requires -z and -d, shouldn't be used with -P)\n" " -w: start binder service and make it wait for a call to startBugreport\n" " -w: start binder service and make it wait for a call to startBugreport\n" " -A: output limited information that is safe for submission in ARC++ bugreports\n" " -L: output limited information that is safe for submission in feedback reports\n" " -v: prints the dumpstate header and exit\n"); " -v: prints the dumpstate header and exit\n"); } } Loading Loading @@ -2359,12 +2352,12 @@ static void LogDumpOptions(const Dumpstate::DumpOptions& options) { "do_zip_file: %d do_vibrate: %d use_socket: %d use_control_socket: %d do_screenshot: %d " "do_zip_file: %d do_vibrate: %d use_socket: %d use_control_socket: %d do_screenshot: %d " "is_remote_mode: %d show_header_only: %d do_start_service: %d telephony_only: %d " "is_remote_mode: %d show_header_only: %d do_start_service: %d telephony_only: %d " "wifi_only: %d do_progress_updates: %d fd: %d bugreport_mode: %s dumpstate_hal_mode: %s " "wifi_only: %d do_progress_updates: %d fd: %d bugreport_mode: %s dumpstate_hal_mode: %s " "arc_only: %d args: %s\n", "limited_only: %d args: %s\n", options.do_zip_file, options.do_vibrate, options.use_socket, options.use_control_socket, options.do_zip_file, options.do_vibrate, options.use_socket, options.use_control_socket, options.do_screenshot, options.is_remote_mode, options.show_header_only, options.do_screenshot, options.is_remote_mode, options.show_header_only, options.do_start_service, options.telephony_only, options.wifi_only, options.do_start_service, options.telephony_only, options.wifi_only, options.do_progress_updates, options.bugreport_fd.get(), options.bugreport_mode.c_str(), options.do_progress_updates, options.bugreport_fd.get(), options.bugreport_mode.c_str(), toString(options.dumpstate_hal_mode).c_str(), options.arc_only, options.args.c_str()); toString(options.dumpstate_hal_mode).c_str(), options.limited_only, options.args.c_str()); } } void Dumpstate::DumpOptions::Initialize(BugreportMode bugreport_mode, void Dumpstate::DumpOptions::Initialize(BugreportMode bugreport_mode, Loading @@ -2386,7 +2379,7 @@ void Dumpstate::DumpOptions::Initialize(BugreportMode bugreport_mode, Dumpstate::RunStatus Dumpstate::DumpOptions::Initialize(int argc, char* argv[]) { Dumpstate::RunStatus Dumpstate::DumpOptions::Initialize(int argc, char* argv[]) { RunStatus status = RunStatus::OK; RunStatus status = RunStatus::OK; int c; int c; while ((c = getopt(argc, argv, "dho:svqzpAPBRSV:w")) != -1) { while ((c = getopt(argc, argv, "dho:svqzpLPBRSV:w")) != -1) { switch (c) { switch (c) { // clang-format off // clang-format off case 'd': do_add_date = true; break; case 'd': do_add_date = true; break; Loading @@ -2398,7 +2391,7 @@ Dumpstate::RunStatus Dumpstate::DumpOptions::Initialize(int argc, char* argv[]) case 'p': do_screenshot = true; break; case 'p': do_screenshot = true; break; case 'P': do_progress_updates = true; break; case 'P': do_progress_updates = true; break; case 'R': is_remote_mode = true; break; case 'R': is_remote_mode = true; break; case 'A': arc_only = true; break; case 'L': limited_only = true; break; case 'V': break; // compatibility no-op case 'V': break; // compatibility no-op case 'w': case 'w': // This was already processed // This was already processed Loading Loading @@ -2683,7 +2676,7 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid, // duration is logged into MYLOG instead. // duration is logged into MYLOG instead. PrintHeader(); PrintHeader(); // TODO(nandana) reduce code repetition in if branches // TODO(b/158737089) reduce code repetition in if branches if (options_->telephony_only) { if (options_->telephony_only) { MaybeTakeEarlyScreenshot(); MaybeTakeEarlyScreenshot(); onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); Loading @@ -2695,11 +2688,11 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid, onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); MaybeCheckUserConsent(calling_uid, calling_package); MaybeCheckUserConsent(calling_uid, calling_package); DumpstateWifiOnly(); DumpstateWifiOnly(); } else if (options_->arc_only) { } else if (options_->limited_only) { MaybeTakeEarlyScreenshot(); MaybeTakeEarlyScreenshot(); onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); onUiIntensiveBugreportDumpsFinished(calling_uid, calling_package); MaybeCheckUserConsent(calling_uid, calling_package); MaybeCheckUserConsent(calling_uid, calling_package); DumpstateArcOnly(); DumpstateLimitedOnly(); } else { } else { // Invoke critical dumpsys first to preserve system state, before doing anything else. // Invoke critical dumpsys first to preserve system state, before doing anything else. RunDumpsysCritical(); RunDumpsysCritical(); Loading
cmds/dumpstate/dumpstate.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -378,7 +378,7 @@ class Dumpstate { bool telephony_only = false; bool telephony_only = false; bool wifi_only = false; bool wifi_only = false; // Trimmed-down version of dumpstate to only include whitelisted logs. // Trimmed-down version of dumpstate to only include whitelisted logs. bool arc_only = false; bool limited_only = false; // Whether progress updates should be published. // Whether progress updates should be published. bool do_progress_updates = false; bool do_progress_updates = false; // The mode we'll use when calling IDumpstateDevice::dumpstateBoard. // The mode we'll use when calling IDumpstateDevice::dumpstateBoard. Loading
cmds/dumpstate/main.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,7 @@ bool ShouldStartServiceAndWait(int argc, char* argv[]) { bool do_wait = false; bool do_wait = false; int c; int c; // Keep flags in sync with Dumpstate::DumpOptions::Initialize. // Keep flags in sync with Dumpstate::DumpOptions::Initialize. while ((c = getopt(argc, argv, "dho:svqzpAPBRSV:w")) != -1 && !do_wait) { while ((c = getopt(argc, argv, "dho:svqzpLPBRSV:w")) != -1 && !do_wait) { switch (c) { switch (c) { case 'w': case 'w': do_wait = true; do_wait = true; Loading
cmds/dumpstate/tests/dumpstate_test.cpp +15 −15 Original line number Original line Diff line number Diff line Loading @@ -179,7 +179,7 @@ TEST_F(DumpOptionsTest, InitializeNone) { EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); } } Loading Loading @@ -207,7 +207,7 @@ TEST_F(DumpOptionsTest, InitializeAdbBugreport) { EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); } } Loading @@ -233,7 +233,7 @@ TEST_F(DumpOptionsTest, InitializeAdbShellBugreport) { EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); } } Loading @@ -252,7 +252,7 @@ TEST_F(DumpOptionsTest, InitializeFullBugReport) { EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.do_start_service); EXPECT_FALSE(options_.do_start_service); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeInteractiveBugReport) { TEST_F(DumpOptionsTest, InitializeInteractiveBugReport) { Loading @@ -270,7 +270,7 @@ TEST_F(DumpOptionsTest, InitializeInteractiveBugReport) { EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeRemoteBugReport) { TEST_F(DumpOptionsTest, InitializeRemoteBugReport) { Loading @@ -287,7 +287,7 @@ TEST_F(DumpOptionsTest, InitializeRemoteBugReport) { EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeWearBugReport) { TEST_F(DumpOptionsTest, InitializeWearBugReport) { Loading @@ -305,7 +305,7 @@ TEST_F(DumpOptionsTest, InitializeWearBugReport) { EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeTelephonyBugReport) { TEST_F(DumpOptionsTest, InitializeTelephonyBugReport) { Loading @@ -323,7 +323,7 @@ TEST_F(DumpOptionsTest, InitializeTelephonyBugReport) { EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeWifiBugReport) { TEST_F(DumpOptionsTest, InitializeWifiBugReport) { Loading @@ -341,10 +341,10 @@ TEST_F(DumpOptionsTest, InitializeWifiBugReport) { EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializeArcOnlyBugreport) { TEST_F(DumpOptionsTest, InitializeLimitedOnlyBugreport) { // clang-format off // clang-format off char* argv[] = { char* argv[] = { const_cast<char*>("dumpstatez"), const_cast<char*>("dumpstatez"), Loading @@ -352,7 +352,7 @@ TEST_F(DumpOptionsTest, InitializeArcOnlyBugreport) { const_cast<char*>("-d"), const_cast<char*>("-d"), const_cast<char*>("-z"), const_cast<char*>("-z"), const_cast<char*>("-q"), const_cast<char*>("-q"), const_cast<char*>("-A") const_cast<char*>("-L") }; }; // clang-format on // clang-format on Loading @@ -363,7 +363,7 @@ TEST_F(DumpOptionsTest, InitializeArcOnlyBugreport) { EXPECT_TRUE(options_.do_zip_file); EXPECT_TRUE(options_.do_zip_file); EXPECT_TRUE(options_.use_control_socket); EXPECT_TRUE(options_.use_control_socket); EXPECT_FALSE(options_.do_vibrate); EXPECT_FALSE(options_.do_vibrate); EXPECT_TRUE(options_.arc_only); EXPECT_TRUE(options_.limited_only); // Other options retain default values // Other options retain default values EXPECT_FALSE(options_.show_header_only); EXPECT_FALSE(options_.show_header_only); Loading Loading @@ -400,7 +400,7 @@ TEST_F(DumpOptionsTest, InitializeDefaultBugReport) { EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.wifi_only); EXPECT_FALSE(options_.wifi_only); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); } } TEST_F(DumpOptionsTest, InitializePartial1) { TEST_F(DumpOptionsTest, InitializePartial1) { Loading Loading @@ -430,7 +430,7 @@ TEST_F(DumpOptionsTest, InitializePartial1) { EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_screenshot); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.do_progress_updates); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.is_remote_mode); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); } } Loading Loading @@ -460,7 +460,7 @@ TEST_F(DumpOptionsTest, InitializePartial2) { EXPECT_FALSE(options_.do_zip_file); EXPECT_FALSE(options_.do_zip_file); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_control_socket); EXPECT_FALSE(options_.use_control_socket); EXPECT_FALSE(options_.arc_only); EXPECT_FALSE(options_.limited_only); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); EXPECT_EQ(options_.dumpstate_hal_mode, DumpstateMode::DEFAULT); } } Loading
services/sensorservice/SensorDeviceUtils.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -36,7 +36,7 @@ inline void quantizeValue(float *value, double resolution) { // Increase the value of the sensor's nominal resolution to ensure that // Increase the value of the sensor's nominal resolution to ensure that // sensor accuracy improvements, like runtime calibration, are not masked // sensor accuracy improvements, like runtime calibration, are not masked // during requantization. // during requantization. double incRes = 0.25 * resolution; double incRes = 0.125 * resolution; *value = round(static_cast<double>(*value) / incRes) * incRes; *value = round(static_cast<double>(*value) / incRes) * incRes; } } Loading