From: Steven Moreland Date: Fri, 16 Dec 2016 00:13:39 +0000 (-0800) Subject: dumpstate: remove references to legacy dumpstate X-Git-Tag: android-x86-8.1-r1~863^2~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7440ddb786b7732478173fe142512dba4e2a8dfd;p=android-x86%2Fframeworks-native.git dumpstate: remove references to legacy dumpstate Test: dumpstate_tests pass Test: manual verification Bug: 31982882 Change-Id: If48cccec2e334d54acf6f3a67098475d3122117a --- diff --git a/cmds/dumpstate/Android.mk b/cmds/dumpstate/Android.mk index 983700f7fb..1c7f3e7a9d 100644 --- a/cmds/dumpstate/Android.mk +++ b/cmds/dumpstate/Android.mk @@ -107,8 +107,6 @@ LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES) \ LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) -LOCAL_HAL_STATIC_LIBRARIES := libdumpstate - LOCAL_CFLAGS += $(COMMON_LOCAL_CFLAGS) LOCAL_INIT_RC := dumpstate.rc @@ -181,14 +179,3 @@ LOCAL_GENERATED_SOURCES += $(GEN) LOCAL_PICKUP_FILES := $(dumpstate_tests_intermediates) include $(BUILD_NATIVE_TEST) - -# =======================# -# libdumpstate.default # -# =======================# -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := libdumpstate_default.cpp -LOCAL_MODULE := libdumpstate.default - -LOCAL_STATIC_LIBRARIES := libdumpstateheaders -include $(BUILD_STATIC_LIBRARY) diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index b6ea8a35d4..1c43cacbb4 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -107,6 +107,9 @@ static int DumpFile(const std::string& title, const std::string& path) { // Relative directory (inside the zip) for all files copied as-is into the bugreport. static const std::string ZIP_ROOT_DIR = "FS"; +// Must be hardcoded because dumpstate HAL implementation need SELinux access to it +static const std::string kDumpstateBoardPath = "/bugreports/dumpstate_board.txt"; + static constexpr char PROPERTY_EXTRA_OPTIONS[] = "dumpstate.options"; static constexpr char PROPERTY_LAST_ID[] = "dumpstate.last_id"; static constexpr char PROPERTY_VERSION[] = "dumpstate.version"; @@ -1080,7 +1083,7 @@ static void dumpstate() { ds.DumpstateBoard(); - /* Migrate the ril_dumpstate to a dumpstate_board()? */ + /* Migrate the ril_dumpstate to a device specific dumpstate? */ int rilDumpstateTimeout = android::base::GetIntProperty("ril.dumpstate.timeout", 0); if (rilDumpstateTimeout > 0) { // su does not exist on user builds, so try running without it. @@ -1149,21 +1152,18 @@ void Dumpstate::DumpstateBoard() { printf("== Board\n"); printf("========================================================\n"); - ::android::sp dumpstate_device( - IDumpstateDevice::getService("DumpstateDevice")); + ::android::sp dumpstate_device(IDumpstateDevice::getService("dumpstate")); if (dumpstate_device == nullptr) { - // TODO: temporary workaround until devices on master implement it - MYLOGE("no IDumpstateDevice implementation; using legacy dumpstate_board()\n"); - dumpstate_board(); + MYLOGE("No IDumpstateDevice implementation\n"); return; } if (!IsZipping()) { - MYLOGE("Not dumping board info because it's not a zipped bugreport\n"); + MYLOGD("Not dumping board info because it's not a zipped bugreport\n"); return; } - std::string path = ds.GetPath("-dumpstate-board.txt"); + std::string path = kDumpstateBoardPath; MYLOGI("Calling IDumpstateDevice implementation using path %s\n", path.c_str()); int fd = @@ -1182,7 +1182,13 @@ void Dumpstate::DumpstateBoard() { handle->data[0] = fd; // TODO: need a timeout mechanism so dumpstate does not hang on device implementation call. - dumpstate_device->dumpstateBoard(handle); + android::hardware::Return status = dumpstate_device->dumpstateBoard(handle); + if (!status.isOk()) { + MYLOGE("dumpstateBoard failed: %s\n", status.description().c_str()); + native_handle_close(handle); + native_handle_delete(handle); + return; + } AddZipEntry("dumpstate-board.txt", path); printf("*** See dumpstate-board.txt entry ***\n"); diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h index 2c11c0c053..5179dbc0fe 100644 --- a/cmds/dumpstate/dumpstate.h +++ b/cmds/dumpstate/dumpstate.h @@ -399,9 +399,6 @@ void dump_route_tables(); /* Play a sound via Stagefright */ void play_sound(const char *path); -/* Implemented by libdumpstate_board to dump board-specific info */ -void dumpstate_board(); - /* Checks if a given path is a directory. */ bool is_dir(const char* pathname); diff --git a/cmds/dumpstate/libdumpstate_default.cpp b/cmds/dumpstate/libdumpstate_default.cpp deleted file mode 100644 index f3997abcd7..0000000000 --- a/cmds/dumpstate/libdumpstate_default.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "dumpstate.h" - -void dumpstate_board(void) -{ -} - diff --git a/cmds/dumpstate/tests/dumpstate_test.cpp b/cmds/dumpstate/tests/dumpstate_test.cpp index 5ca61025b1..e7999ac8dc 100644 --- a/cmds/dumpstate/tests/dumpstate_test.cpp +++ b/cmds/dumpstate/tests/dumpstate_test.cpp @@ -56,10 +56,6 @@ using os::DumpstateService; using os::IDumpstateListener; using os::IDumpstateToken; -// Not used on test cases yet... -void dumpstate_board(void) { -} - class DumpstateListenerMock : public IDumpstateListener { public: MOCK_METHOD1(onProgressUpdated, binder::Status(int32_t progress));