dump_gps: Support bugreport extract resource info
Bug: 369971486 Flag: EXEMPT log information update. Test: Different input value in b/369971486. Test: Read the sysfs value in b/369971486. Test: Collect bugreport and check the attachment in b/369971486. Test: Sepolicy test in b/369971486. Change-Id: Ib8f2565387a9a2c7d715e4791bbcddb86a12fb70
This commit is contained in:
parent
c90999f82a
commit
2c8ec7ea44
1 changed files with 41 additions and 3 deletions
|
@ -13,13 +13,16 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include <unistd.h>
|
|
||||||
#include <dump/pixel_dump.h>
|
|
||||||
#include <android-base/properties.h>
|
|
||||||
#include <android-base/file.h>
|
#include <android-base/file.h>
|
||||||
|
#include <android-base/properties.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <dump/pixel_dump.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define GPS_LOG_NUMBER_PROPERTY "persist.vendor.gps.aol.log_num"
|
#define GPS_LOG_NUMBER_PROPERTY "persist.vendor.gps.aol.log_num"
|
||||||
#define GPS_LOG_DIRECTORY "/data/vendor/gps/logs"
|
#define GPS_LOG_DIRECTORY "/data/vendor/gps/logs"
|
||||||
|
#define GPS_RESOURCE_DIRECTORY "/data/vendor/gps/resource"
|
||||||
#define GPS_TMP_LOG_DIRECTORY "/data/vendor/gps/logs/.tmp"
|
#define GPS_TMP_LOG_DIRECTORY "/data/vendor/gps/logs/.tmp"
|
||||||
#define GPS_LOG_PREFIX "gl-"
|
#define GPS_LOG_PREFIX "gl-"
|
||||||
#define GPS_MCU_LOG_PREFIX "esw-"
|
#define GPS_MCU_LOG_PREFIX "esw-"
|
||||||
|
@ -29,6 +32,40 @@
|
||||||
#define GPS_RAWLOG_PREFIX "rawbin"
|
#define GPS_RAWLOG_PREFIX "rawbin"
|
||||||
#define GPS_MEMDUMP_LOG_PREFIX "memdump_"
|
#define GPS_MEMDUMP_LOG_PREFIX "memdump_"
|
||||||
|
|
||||||
|
static void copyDirectory(const std::string &source,
|
||||||
|
const std::string &outputDir) {
|
||||||
|
DIR *dir = opendir(source.c_str());
|
||||||
|
if (dir == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mkdir(outputDir.c_str(), 0777) == -1) {
|
||||||
|
closedir(dir);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct dirent *entry;
|
||||||
|
while ((entry = readdir(dir)) != nullptr) {
|
||||||
|
std::string entryName = entry->d_name;
|
||||||
|
if (entryName == "." || entryName == "..") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string sourcePath = source + "/" + entryName;
|
||||||
|
std::string destPath = outputDir + "/" + entryName;
|
||||||
|
|
||||||
|
struct stat st;
|
||||||
|
if (stat(sourcePath.c_str(), &st) == 0) {
|
||||||
|
if (S_ISDIR(st.st_mode))
|
||||||
|
copyDirectory(sourcePath, destPath);
|
||||||
|
else
|
||||||
|
copyFile(sourcePath.c_str(), destPath.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
if(!::android::base::GetBoolProperty("vendor.gps.aol.enabled", false)) {
|
if(!::android::base::GetBoolProperty("vendor.gps.aol.enabled", false)) {
|
||||||
printf("vendor.gps.aol.enabled is false. gps logging is not running.\n");
|
printf("vendor.gps.aol.enabled is false. gps logging is not running.\n");
|
||||||
|
@ -50,6 +87,7 @@ int main() {
|
||||||
}
|
}
|
||||||
dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), maxFileNum, GPS_RAWLOG_PREFIX);
|
dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), maxFileNum, GPS_RAWLOG_PREFIX);
|
||||||
dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), 18, GPS_MEMDUMP_LOG_PREFIX);
|
dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), 18, GPS_MEMDUMP_LOG_PREFIX);
|
||||||
|
copyDirectory(GPS_RESOURCE_DIRECTORY, concatenatePath(outputDir.c_str(), "resource"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue