Loading cmds/dumpstate/Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,8 @@ LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \ LOCAL_MODULE := dumpstate LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES) LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES) \ android.hardware.vibrator@1.0 LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) Loading cmds/dumpstate/dumpstate.cpp +35 −11 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ #include <android-base/strings.h> #include <android-base/unique_fd.h> #include <android/hardware/dumpstate/1.0/IDumpstateDevice.h> #include <android/hardware/vibrator/1.0/IVibrator.h> #include <cutils/native_handle.h> #include <cutils/properties.h> #include <hardware_legacy/power.h> Loading @@ -54,6 +55,10 @@ #include "DumpstateService.h" #include "dumpstate.h" using ::android::hardware::dumpstate::V1_0::IDumpstateDevice; using ::android::hardware::vibrator::V1_0::IVibrator; using VibratorStatus = ::android::hardware::vibrator::V1_0::Status; /* read before root is shed */ static char cmdline_buf[16384] = "(unknown)"; static const char *dump_traces_path = NULL; Loading Loading @@ -1164,8 +1169,8 @@ void Dumpstate::DumpstateBoard() { printf("== Board\n"); printf("========================================================\n"); android::sp<android::hardware::dumpstate::V1_0::IDumpstateDevice> dumpstate_device( android::hardware::dumpstate::V1_0::IDumpstateDevice::getService("DumpstateDevice")); ::android::sp<IDumpstateDevice> dumpstate_device( IDumpstateDevice::getService("DumpstateDevice")); if (dumpstate_device == nullptr) { // TODO: temporary workaround until devices on master implement it MYLOGE("no IDumpstateDevice implementation; using legacy dumpstate_board()\n"); Loading Loading @@ -1586,12 +1591,21 @@ int main(int argc, char *argv[]) { fclose(cmdline); } /* open the vibrator before dropping root */ std::unique_ptr<FILE, int(*)(FILE*)> vibrator(NULL, fclose); ::android::sp<IVibrator> vibrator = nullptr; if (do_vibrate) { vibrator.reset(fopen("/sys/class/timed_output/vibrator/enable", "we")); if (vibrator) { vibrate(vibrator.get(), 150); vibrator = IVibrator::getService("vibrator"); if (vibrator != nullptr) { // cancel previous vibration if any ::android::hardware::Return<VibratorStatus> offStatus = vibrator->off(); if (!offStatus.isOk() || offStatus != VibratorStatus::OK) { MYLOGE("Vibrator off failed."); } else { ::android::hardware::Return<VibratorStatus> onStatus = vibrator->on(150); if (!onStatus.isOk() || onStatus != VibratorStatus::OK) { MYLOGE("Vibrator on failed."); } } } } Loading Loading @@ -1759,12 +1773,22 @@ int main(int argc, char *argv[]) { } /* vibrate a few but shortly times to let user know it's finished */ if (vibrator) { if (vibrator != nullptr) { // in case dumpstate magically completes before the above vibration ::android::hardware::Return<VibratorStatus> offStatus = vibrator->off(); if (!offStatus.isOk() || offStatus != VibratorStatus::OK) { MYLOGE("Vibrator off failed."); } else { for (int i = 0; i < 3; i++) { vibrate(vibrator.get(), 75); ::android::hardware::Return<VibratorStatus> onStatus = vibrator->on(75); if (!onStatus.isOk() || onStatus != VibratorStatus::OK) { MYLOGE("Vibrator on failed."); break; } usleep((75 + 50) * 1000); } } } /* tell activity manager we're done */ if (do_broadcast) { Loading cmds/dumpstate/dumpstate.h +0 −3 Original line number Diff line number Diff line Loading @@ -402,9 +402,6 @@ void play_sound(const char *path); /* Implemented by libdumpstate_board to dump board-specific info */ void dumpstate_board(); /* Vibrates for a given durating (in milliseconds). */ void vibrate(FILE* vibrator, int ms); /* Checks if a given path is a directory. */ bool is_dir(const char* pathname); Loading cmds/dumpstate/utils.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -1061,11 +1061,6 @@ void Dumpstate::TakeScreenshot(const std::string& path) { } } void vibrate(FILE* vibrator, int ms) { fprintf(vibrator, "%d\n", ms); fflush(vibrator); } bool is_dir(const char* pathname) { struct stat info; if (stat(pathname, &info) == -1) { Loading Loading
cmds/dumpstate/Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,8 @@ LOCAL_SRC_FILES := $(COMMON_SRC_FILES) \ LOCAL_MODULE := dumpstate LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES) LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES) \ android.hardware.vibrator@1.0 LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) Loading
cmds/dumpstate/dumpstate.cpp +35 −11 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ #include <android-base/strings.h> #include <android-base/unique_fd.h> #include <android/hardware/dumpstate/1.0/IDumpstateDevice.h> #include <android/hardware/vibrator/1.0/IVibrator.h> #include <cutils/native_handle.h> #include <cutils/properties.h> #include <hardware_legacy/power.h> Loading @@ -54,6 +55,10 @@ #include "DumpstateService.h" #include "dumpstate.h" using ::android::hardware::dumpstate::V1_0::IDumpstateDevice; using ::android::hardware::vibrator::V1_0::IVibrator; using VibratorStatus = ::android::hardware::vibrator::V1_0::Status; /* read before root is shed */ static char cmdline_buf[16384] = "(unknown)"; static const char *dump_traces_path = NULL; Loading Loading @@ -1164,8 +1169,8 @@ void Dumpstate::DumpstateBoard() { printf("== Board\n"); printf("========================================================\n"); android::sp<android::hardware::dumpstate::V1_0::IDumpstateDevice> dumpstate_device( android::hardware::dumpstate::V1_0::IDumpstateDevice::getService("DumpstateDevice")); ::android::sp<IDumpstateDevice> dumpstate_device( IDumpstateDevice::getService("DumpstateDevice")); if (dumpstate_device == nullptr) { // TODO: temporary workaround until devices on master implement it MYLOGE("no IDumpstateDevice implementation; using legacy dumpstate_board()\n"); Loading Loading @@ -1586,12 +1591,21 @@ int main(int argc, char *argv[]) { fclose(cmdline); } /* open the vibrator before dropping root */ std::unique_ptr<FILE, int(*)(FILE*)> vibrator(NULL, fclose); ::android::sp<IVibrator> vibrator = nullptr; if (do_vibrate) { vibrator.reset(fopen("/sys/class/timed_output/vibrator/enable", "we")); if (vibrator) { vibrate(vibrator.get(), 150); vibrator = IVibrator::getService("vibrator"); if (vibrator != nullptr) { // cancel previous vibration if any ::android::hardware::Return<VibratorStatus> offStatus = vibrator->off(); if (!offStatus.isOk() || offStatus != VibratorStatus::OK) { MYLOGE("Vibrator off failed."); } else { ::android::hardware::Return<VibratorStatus> onStatus = vibrator->on(150); if (!onStatus.isOk() || onStatus != VibratorStatus::OK) { MYLOGE("Vibrator on failed."); } } } } Loading Loading @@ -1759,12 +1773,22 @@ int main(int argc, char *argv[]) { } /* vibrate a few but shortly times to let user know it's finished */ if (vibrator) { if (vibrator != nullptr) { // in case dumpstate magically completes before the above vibration ::android::hardware::Return<VibratorStatus> offStatus = vibrator->off(); if (!offStatus.isOk() || offStatus != VibratorStatus::OK) { MYLOGE("Vibrator off failed."); } else { for (int i = 0; i < 3; i++) { vibrate(vibrator.get(), 75); ::android::hardware::Return<VibratorStatus> onStatus = vibrator->on(75); if (!onStatus.isOk() || onStatus != VibratorStatus::OK) { MYLOGE("Vibrator on failed."); break; } usleep((75 + 50) * 1000); } } } /* tell activity manager we're done */ if (do_broadcast) { Loading
cmds/dumpstate/dumpstate.h +0 −3 Original line number Diff line number Diff line Loading @@ -402,9 +402,6 @@ void play_sound(const char *path); /* Implemented by libdumpstate_board to dump board-specific info */ void dumpstate_board(); /* Vibrates for a given durating (in milliseconds). */ void vibrate(FILE* vibrator, int ms); /* Checks if a given path is a directory. */ bool is_dir(const char* pathname); Loading
cmds/dumpstate/utils.cpp +0 −5 Original line number Diff line number Diff line Loading @@ -1061,11 +1061,6 @@ void Dumpstate::TakeScreenshot(const std::string& path) { } } void vibrate(FILE* vibrator, int ms) { fprintf(vibrator, "%d\n", ms); fflush(vibrator); } bool is_dir(const char* pathname) { struct stat info; if (stat(pathname, &info) == -1) { Loading