Loading cmds/dumpstate/dumpstate.cpp +0 −38 Original line number Diff line number Diff line Loading @@ -101,7 +101,6 @@ void add_mountinfo(); #define ALT_PSTORE_LAST_KMSG "/sys/fs/pstore/console-ramoops-0" #define BLK_DEV_SYS_DIR "/sys/block" #define RAFT_DIR "/data/misc/raft" #define RECOVERY_DIR "/cache/recovery" #define RECOVERY_DATA_DIR "/data/misc/recovery" #define UPDATE_ENGINE_LOG_DIR "/data/misc/update_engine_log" Loading Loading @@ -455,40 +454,6 @@ static void dump_systrace() { } } static void dump_raft() { if (PropertiesHelper::IsUserBuild()) { return; } std::string raft_path = ds.GetPath("-raft_log.txt"); if (raft_path.empty()) { MYLOGD("raft_path is empty\n"); return; } struct stat s; if (stat(RAFT_DIR, &s) != 0 || !S_ISDIR(s.st_mode)) { MYLOGD("%s does not exist or is not a directory\n", RAFT_DIR); return; } CommandOptions options = CommandOptions::WithTimeout(600).Build(); if (!ds.IsZipping()) { // Write compressed and encoded raft logs to stdout if it's not a zipped bugreport. RunCommand("RAFT LOGS", {"logcompressor", "-r", RAFT_DIR}, options); return; } RunCommand("RAFT LOGS", {"logcompressor", "-n", "-r", RAFT_DIR, "-o", raft_path}, options); if (!ds.AddZipEntry("raft_log.txt", raft_path)) { MYLOGE("Unable to add raft log %s to zip file\n", raft_path.c_str()); } else { if (remove(raft_path.c_str())) { MYLOGE("Error removing raft file %s: %s\n", raft_path.c_str(), strerror(errno)); } } } static bool skip_not_stat(const char *path) { static const char stat[] = "/stat"; size_t len = strlen(path); Loading Loading @@ -2085,9 +2050,6 @@ int run_main(int argc, char* argv[]) { // keep the system stats as close to its initial state as possible. RunDumpsysCritical(); // TODO: Drop root user and move into dumpstate() once b/28633932 is fixed. dump_raft(); /* collect stack traces from Dalvik and native processes (needs root) */ dump_traces_path = dump_traces(); Loading cmds/installd/otapreopt_script.sh +0 −3 Original line number Diff line number Diff line Loading @@ -18,9 +18,6 @@ # This script will run as a postinstall step to drive otapreopt. # Temporarily disable for b/115853663. exit 0 TARGET_SLOT="$1" STATUS_FD="$2" Loading libs/binder/ndk/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ cc_library { "ibinder.cpp", "parcel.cpp", "process.cpp", "status.cpp", "service_manager.cpp", ], Loading libs/binder/ndk/ibinder.cpp +38 −34 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <android/binder_status.h> #include "parcel_internal.h" #include "status_internal.h" #include <android-base/logging.h> Loading @@ -27,6 +28,7 @@ using DeathRecipient = ::android::IBinder::DeathRecipient; using ::android::IBinder; using ::android::Parcel; using ::android::sp; using ::android::status_t; using ::android::String16; using ::android::wp; Loading Loading @@ -116,17 +118,18 @@ const String16& ABBinder::getInterfaceDescriptor() const { return getClass()->getInterfaceDescriptor(); } binder_status_t ABBinder::onTransact(transaction_code_t code, const Parcel& data, Parcel* reply, status_t ABBinder::onTransact(transaction_code_t code, const Parcel& data, Parcel* reply, binder_flags_t flags) { if (isUserCommand(code)) { if (!data.checkInterface(this)) { return EX_ILLEGAL_STATE; return STATUS_PERMISSION_DENIED; } const AParcel in = AParcel::readOnly(this, &data); AParcel out = AParcel(this, reply, false /*owns*/); return getClass()->onTransact(this, code, &in, &out); binder_status_t status = getClass()->onTransact(this, code, &in, &out); return PruneStatusT(status); } else { return BBinder::onTransact(code, data, reply, flags); } Loading Loading @@ -253,13 +256,13 @@ binder_status_t AIBinder_DeathRecipient::linkToDeath(AIBinder* binder, void* coo sp<TransferDeathRecipient> recipient = new TransferDeathRecipient(binder->getBinder(), cookie, mOnDied); binder_status_t status = binder->getBinder()->linkToDeath(recipient, cookie, 0 /*flags*/); if (status != EX_NONE) { return status; status_t status = binder->getBinder()->linkToDeath(recipient, cookie, 0 /*flags*/); if (status != STATUS_OK) { return PruneStatusT(status); } mDeathRecipients.push_back(recipient); return EX_NONE; return STATUS_OK; } binder_status_t AIBinder_DeathRecipient::unlinkToDeath(AIBinder* binder, void* cookie) { Loading @@ -270,22 +273,19 @@ binder_status_t AIBinder_DeathRecipient::unlinkToDeath(AIBinder* binder, void* c for (auto it = mDeathRecipients.rbegin(); it != mDeathRecipients.rend(); ++it) { sp<TransferDeathRecipient> recipient = *it; if (recipient->getCookie() == cookie && recipient->getWho() == binder->getBinder()) { if (recipient->getCookie() == cookie && recipient->getWho() == binder->getBinder()) { mDeathRecipients.erase(it.base() - 1); binder_status_t status = binder->getBinder()->unlinkToDeath(recipient, cookie, 0 /*flags*/); if (status != EX_NONE) { status_t status = binder->getBinder()->unlinkToDeath(recipient, cookie, 0 /*flags*/); if (status != ::android::OK) { LOG(ERROR) << __func__ << ": removed reference to death recipient but unlink failed."; } return status; return PruneStatusT(status); } } return -ENOENT; return STATUS_NAME_NOT_FOUND; } // start of C-API methods Loading Loading @@ -323,19 +323,20 @@ bool AIBinder_isAlive(const AIBinder* binder) { binder_status_t AIBinder_ping(AIBinder* binder) { if (binder == nullptr) { return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } return binder->getBinder()->pingBinder(); return PruneStatusT(binder->getBinder()->pingBinder()); } binder_status_t AIBinder_linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient, void* cookie) { if (binder == nullptr || recipient == nullptr) { LOG(ERROR) << __func__ << ": Must provide binder and recipient."; return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } // returns binder_status_t return recipient->linkToDeath(binder, cookie); } Loading @@ -343,9 +344,10 @@ binder_status_t AIBinder_unlinkToDeath(AIBinder* binder, AIBinder_DeathRecipient void* cookie) { if (binder == nullptr || recipient == nullptr) { LOG(ERROR) << __func__ << ": Must provide binder and recipient."; return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } // returns binder_status_t return recipient->unlinkToDeath(binder, cookie); } Loading Loading @@ -406,14 +408,14 @@ void* AIBinder_getUserData(AIBinder* binder) { binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in) { if (binder == nullptr || in == nullptr) { LOG(ERROR) << __func__ << ": requires non-null parameters."; return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } const AIBinder_Class* clazz = binder->getClass(); if (clazz == nullptr) { LOG(ERROR) << __func__ << ": Class must be defined for a remote binder transaction. See " "AIBinder_associateClass."; return EX_ILLEGAL_STATE; return STATUS_INVALID_OPERATION; } if (!binder->isRemote()) { Loading @@ -424,20 +426,22 @@ binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in) { } *in = new AParcel(binder); binder_status_t status = (**in)->writeInterfaceToken(clazz->getInterfaceDescriptor()); if (status != EX_NONE) { status_t status = (*in)->get()->writeInterfaceToken(clazz->getInterfaceDescriptor()); binder_status_t ret = PruneStatusT(status); if (ret != STATUS_OK) { delete *in; *in = nullptr; } return status; return ret; } binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, AParcel** in, AParcel** out, binder_flags_t flags) { if (in == nullptr) { LOG(ERROR) << __func__ << ": requires non-null in parameter"; return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } using AutoParcelDestroyer = std::unique_ptr<AParcel*, void (*)(AParcel**)>; Loading @@ -447,36 +451,36 @@ binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, APa if (!isUserCommand(code)) { LOG(ERROR) << __func__ << ": Only user-defined transactions can be made from the NDK."; return EX_UNSUPPORTED_OPERATION; return STATUS_UNKNOWN_TRANSACTION; } if ((flags & ~FLAG_ONEWAY) != 0) { LOG(ERROR) << __func__ << ": Unrecognized flags sent: " << flags; return EX_ILLEGAL_ARGUMENT; return STATUS_BAD_VALUE; } if (binder == nullptr || *in == nullptr || out == nullptr) { LOG(ERROR) << __func__ << ": requires non-null parameters."; return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } if ((*in)->getBinder() != binder) { LOG(ERROR) << __func__ << ": parcel is associated with binder object " << binder << " but called with " << (*in)->getBinder(); return EX_ILLEGAL_STATE; return STATUS_BAD_VALUE; } *out = new AParcel(binder); binder_status_t parcelStatus = binder->getBinder()->transact(code, *(*in)->operator->(), (*out)->operator->(), flags); status_t status = binder->getBinder()->transact(code, *(*in)->get(), (*out)->get(), flags); binder_status_t ret = PruneStatusT(status); if (parcelStatus != EX_NONE) { if (ret != STATUS_OK) { delete *out; *out = nullptr; } return parcelStatus; return ret; } AIBinder_DeathRecipient* AIBinder_DeathRecipient_new( Loading libs/binder/ndk/ibinder_internal.h +2 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ struct ABBinder : public AIBinder, public ::android::BBinder { ABBinder* asABBinder() override { return this; } const ::android::String16& getInterfaceDescriptor() const override; binder_status_t onTransact(uint32_t code, const ::android::Parcel& data, ::android::status_t onTransact(uint32_t code, const ::android::Parcel& data, ::android::Parcel* reply, binder_flags_t flags) override; private: Loading Loading
cmds/dumpstate/dumpstate.cpp +0 −38 Original line number Diff line number Diff line Loading @@ -101,7 +101,6 @@ void add_mountinfo(); #define ALT_PSTORE_LAST_KMSG "/sys/fs/pstore/console-ramoops-0" #define BLK_DEV_SYS_DIR "/sys/block" #define RAFT_DIR "/data/misc/raft" #define RECOVERY_DIR "/cache/recovery" #define RECOVERY_DATA_DIR "/data/misc/recovery" #define UPDATE_ENGINE_LOG_DIR "/data/misc/update_engine_log" Loading Loading @@ -455,40 +454,6 @@ static void dump_systrace() { } } static void dump_raft() { if (PropertiesHelper::IsUserBuild()) { return; } std::string raft_path = ds.GetPath("-raft_log.txt"); if (raft_path.empty()) { MYLOGD("raft_path is empty\n"); return; } struct stat s; if (stat(RAFT_DIR, &s) != 0 || !S_ISDIR(s.st_mode)) { MYLOGD("%s does not exist or is not a directory\n", RAFT_DIR); return; } CommandOptions options = CommandOptions::WithTimeout(600).Build(); if (!ds.IsZipping()) { // Write compressed and encoded raft logs to stdout if it's not a zipped bugreport. RunCommand("RAFT LOGS", {"logcompressor", "-r", RAFT_DIR}, options); return; } RunCommand("RAFT LOGS", {"logcompressor", "-n", "-r", RAFT_DIR, "-o", raft_path}, options); if (!ds.AddZipEntry("raft_log.txt", raft_path)) { MYLOGE("Unable to add raft log %s to zip file\n", raft_path.c_str()); } else { if (remove(raft_path.c_str())) { MYLOGE("Error removing raft file %s: %s\n", raft_path.c_str(), strerror(errno)); } } } static bool skip_not_stat(const char *path) { static const char stat[] = "/stat"; size_t len = strlen(path); Loading Loading @@ -2085,9 +2050,6 @@ int run_main(int argc, char* argv[]) { // keep the system stats as close to its initial state as possible. RunDumpsysCritical(); // TODO: Drop root user and move into dumpstate() once b/28633932 is fixed. dump_raft(); /* collect stack traces from Dalvik and native processes (needs root) */ dump_traces_path = dump_traces(); Loading
cmds/installd/otapreopt_script.sh +0 −3 Original line number Diff line number Diff line Loading @@ -18,9 +18,6 @@ # This script will run as a postinstall step to drive otapreopt. # Temporarily disable for b/115853663. exit 0 TARGET_SLOT="$1" STATUS_FD="$2" Loading
libs/binder/ndk/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ cc_library { "ibinder.cpp", "parcel.cpp", "process.cpp", "status.cpp", "service_manager.cpp", ], Loading
libs/binder/ndk/ibinder.cpp +38 −34 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <android/binder_status.h> #include "parcel_internal.h" #include "status_internal.h" #include <android-base/logging.h> Loading @@ -27,6 +28,7 @@ using DeathRecipient = ::android::IBinder::DeathRecipient; using ::android::IBinder; using ::android::Parcel; using ::android::sp; using ::android::status_t; using ::android::String16; using ::android::wp; Loading Loading @@ -116,17 +118,18 @@ const String16& ABBinder::getInterfaceDescriptor() const { return getClass()->getInterfaceDescriptor(); } binder_status_t ABBinder::onTransact(transaction_code_t code, const Parcel& data, Parcel* reply, status_t ABBinder::onTransact(transaction_code_t code, const Parcel& data, Parcel* reply, binder_flags_t flags) { if (isUserCommand(code)) { if (!data.checkInterface(this)) { return EX_ILLEGAL_STATE; return STATUS_PERMISSION_DENIED; } const AParcel in = AParcel::readOnly(this, &data); AParcel out = AParcel(this, reply, false /*owns*/); return getClass()->onTransact(this, code, &in, &out); binder_status_t status = getClass()->onTransact(this, code, &in, &out); return PruneStatusT(status); } else { return BBinder::onTransact(code, data, reply, flags); } Loading Loading @@ -253,13 +256,13 @@ binder_status_t AIBinder_DeathRecipient::linkToDeath(AIBinder* binder, void* coo sp<TransferDeathRecipient> recipient = new TransferDeathRecipient(binder->getBinder(), cookie, mOnDied); binder_status_t status = binder->getBinder()->linkToDeath(recipient, cookie, 0 /*flags*/); if (status != EX_NONE) { return status; status_t status = binder->getBinder()->linkToDeath(recipient, cookie, 0 /*flags*/); if (status != STATUS_OK) { return PruneStatusT(status); } mDeathRecipients.push_back(recipient); return EX_NONE; return STATUS_OK; } binder_status_t AIBinder_DeathRecipient::unlinkToDeath(AIBinder* binder, void* cookie) { Loading @@ -270,22 +273,19 @@ binder_status_t AIBinder_DeathRecipient::unlinkToDeath(AIBinder* binder, void* c for (auto it = mDeathRecipients.rbegin(); it != mDeathRecipients.rend(); ++it) { sp<TransferDeathRecipient> recipient = *it; if (recipient->getCookie() == cookie && recipient->getWho() == binder->getBinder()) { if (recipient->getCookie() == cookie && recipient->getWho() == binder->getBinder()) { mDeathRecipients.erase(it.base() - 1); binder_status_t status = binder->getBinder()->unlinkToDeath(recipient, cookie, 0 /*flags*/); if (status != EX_NONE) { status_t status = binder->getBinder()->unlinkToDeath(recipient, cookie, 0 /*flags*/); if (status != ::android::OK) { LOG(ERROR) << __func__ << ": removed reference to death recipient but unlink failed."; } return status; return PruneStatusT(status); } } return -ENOENT; return STATUS_NAME_NOT_FOUND; } // start of C-API methods Loading Loading @@ -323,19 +323,20 @@ bool AIBinder_isAlive(const AIBinder* binder) { binder_status_t AIBinder_ping(AIBinder* binder) { if (binder == nullptr) { return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } return binder->getBinder()->pingBinder(); return PruneStatusT(binder->getBinder()->pingBinder()); } binder_status_t AIBinder_linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient, void* cookie) { if (binder == nullptr || recipient == nullptr) { LOG(ERROR) << __func__ << ": Must provide binder and recipient."; return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } // returns binder_status_t return recipient->linkToDeath(binder, cookie); } Loading @@ -343,9 +344,10 @@ binder_status_t AIBinder_unlinkToDeath(AIBinder* binder, AIBinder_DeathRecipient void* cookie) { if (binder == nullptr || recipient == nullptr) { LOG(ERROR) << __func__ << ": Must provide binder and recipient."; return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } // returns binder_status_t return recipient->unlinkToDeath(binder, cookie); } Loading Loading @@ -406,14 +408,14 @@ void* AIBinder_getUserData(AIBinder* binder) { binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in) { if (binder == nullptr || in == nullptr) { LOG(ERROR) << __func__ << ": requires non-null parameters."; return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } const AIBinder_Class* clazz = binder->getClass(); if (clazz == nullptr) { LOG(ERROR) << __func__ << ": Class must be defined for a remote binder transaction. See " "AIBinder_associateClass."; return EX_ILLEGAL_STATE; return STATUS_INVALID_OPERATION; } if (!binder->isRemote()) { Loading @@ -424,20 +426,22 @@ binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in) { } *in = new AParcel(binder); binder_status_t status = (**in)->writeInterfaceToken(clazz->getInterfaceDescriptor()); if (status != EX_NONE) { status_t status = (*in)->get()->writeInterfaceToken(clazz->getInterfaceDescriptor()); binder_status_t ret = PruneStatusT(status); if (ret != STATUS_OK) { delete *in; *in = nullptr; } return status; return ret; } binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, AParcel** in, AParcel** out, binder_flags_t flags) { if (in == nullptr) { LOG(ERROR) << __func__ << ": requires non-null in parameter"; return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } using AutoParcelDestroyer = std::unique_ptr<AParcel*, void (*)(AParcel**)>; Loading @@ -447,36 +451,36 @@ binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, APa if (!isUserCommand(code)) { LOG(ERROR) << __func__ << ": Only user-defined transactions can be made from the NDK."; return EX_UNSUPPORTED_OPERATION; return STATUS_UNKNOWN_TRANSACTION; } if ((flags & ~FLAG_ONEWAY) != 0) { LOG(ERROR) << __func__ << ": Unrecognized flags sent: " << flags; return EX_ILLEGAL_ARGUMENT; return STATUS_BAD_VALUE; } if (binder == nullptr || *in == nullptr || out == nullptr) { LOG(ERROR) << __func__ << ": requires non-null parameters."; return EX_NULL_POINTER; return STATUS_UNEXPECTED_NULL; } if ((*in)->getBinder() != binder) { LOG(ERROR) << __func__ << ": parcel is associated with binder object " << binder << " but called with " << (*in)->getBinder(); return EX_ILLEGAL_STATE; return STATUS_BAD_VALUE; } *out = new AParcel(binder); binder_status_t parcelStatus = binder->getBinder()->transact(code, *(*in)->operator->(), (*out)->operator->(), flags); status_t status = binder->getBinder()->transact(code, *(*in)->get(), (*out)->get(), flags); binder_status_t ret = PruneStatusT(status); if (parcelStatus != EX_NONE) { if (ret != STATUS_OK) { delete *out; *out = nullptr; } return parcelStatus; return ret; } AIBinder_DeathRecipient* AIBinder_DeathRecipient_new( Loading
libs/binder/ndk/ibinder_internal.h +2 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ struct ABBinder : public AIBinder, public ::android::BBinder { ABBinder* asABBinder() override { return this; } const ::android::String16& getInterfaceDescriptor() const override; binder_status_t onTransact(uint32_t code, const ::android::Parcel& data, ::android::status_t onTransact(uint32_t code, const ::android::Parcel& data, ::android::Parcel* reply, binder_flags_t flags) override; private: Loading