Loading api/test-current.txt +0 −1 Original line number Diff line number Diff line Loading @@ -725,7 +725,6 @@ package android.content.pm { field public static final int FLAG_PERMISSION_USER_SET = 1; // 0x1 field public static final int MATCH_FACTORY_ONLY = 2097152; // 0x200000 field public static final int MATCH_KNOWN_PACKAGES = 4202496; // 0x402000 field public static boolean RESTRICTED_PERMISSIONS_ENABLED; field public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services"; field public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared"; } Loading cmds/incidentd/Android.bp +0 −14 Original line number Diff line number Diff line Loading @@ -60,12 +60,6 @@ cc_binary { "libservices", "libutils", "libprotobuf-cpp-lite", "libcrypto", "libkeystore_aidl", "libkeystore_binder", "libkeystore_parcelables", "android.hardware.keymaster@4.0", "libkeymaster4support", ], static_libs: [ Loading Loading @@ -119,8 +113,6 @@ cc_test { "src/incidentd_util.cpp", "src/proto_util.cpp", "src/report_directory.cpp", "src/cipher/IncidentKeyStore.cpp", "src/cipher/ProtoEncryption.cpp", "src/**/*.proto", ], Loading @@ -142,12 +134,6 @@ cc_test { "libprotoutil", "libservices", "libutils", "libcrypto", "libkeystore_aidl", "libkeystore_binder", "libkeystore_parcelables", "android.hardware.keymaster@4.0", "libkeymaster4support", ], target: { Loading cmds/incidentd/src/Privacy.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ namespace incidentd { using namespace android::os; using std::strstream; static const bool kEncryptionEnabled = false; uint64_t encode_field_id(const Privacy* p) { return (uint64_t)p->type << 32 | p->field_id; } string Privacy::toString() const { Loading @@ -52,10 +50,6 @@ const Privacy* lookup(const Privacy* p, uint32_t fieldId) { return NULL; } bool sectionEncryption(int section_id) { return kEncryptionEnabled ? (section_id == 3025) /*restricted image section*/ : false; } static bool isAllowed(const uint8_t policy, const uint8_t check) { switch (check) { case PRIVACY_POLICY_LOCAL: Loading cmds/incidentd/src/Privacy.h +0 −3 Original line number Diff line number Diff line Loading @@ -90,9 +90,6 @@ private: uint8_t mPolicy; }; // TODO: Add privacy flag in incident.proto and auto generate it inside Privacy. bool sectionEncryption(int section_id); /** * If a privacy policy is other than the defined values, update it to a real one. */ Loading cmds/incidentd/src/PrivacyFilter.cpp +21 −65 Original line number Diff line number Diff line Loading @@ -16,20 +16,19 @@ #define DEBUG false #include "Log.h" #include "incidentd_util.h" #include "PrivacyFilter.h" #include "proto_util.h" #include "incidentd_util.h" #include "proto_util.h" #include "Section.h" #include <android-base/file.h> #include <android/util/ProtoFileReader.h> #include <android/util/protobuf.h> #include <android/util/ProtoFileReader.h> #include <log/log.h> #include "cipher/IncidentKeyStore.h" #include "cipher/ProtoEncryption.h" namespace android { namespace os { namespace incidentd { Loading Loading @@ -146,8 +145,6 @@ public: */ status_t writeData(int fd); sp<ProtoReader> getData() { return mData; } private: /** * The global set of field --> required privacy level mapping. Loading Loading @@ -259,47 +256,8 @@ void PrivacyFilter::addFd(const sp<FilterFd>& output) { mOutputs.push_back(output); } static void write_section_to_file(int sectionId, FieldStripper& fieldStripper, sp<FilterFd> output, bool encryptIfNeeded) { status_t err; if (sectionEncryption(sectionId) && encryptIfNeeded) { ProtoEncryptor encryptor(fieldStripper.getData()); size_t encryptedSize = encryptor.encrypt(); if (encryptedSize <= 0) { output->onWriteError(BAD_VALUE); return; } err = write_section_header(output->getFd(), sectionId, encryptedSize); VLOG("Encrypted: write section header size %lu", (unsigned long)encryptedSize); encryptor.flush(output->getFd()); if (err != NO_ERROR) { output->onWriteError(err); return; } } else { err = write_section_header(output->getFd(), sectionId, fieldStripper.dataSize()); VLOG("No encryption: write section header size %lu", (unsigned long)fieldStripper.dataSize()); if (err != NO_ERROR) { output->onWriteError(err); return; } err = fieldStripper.writeData(output->getFd()); if (err != NO_ERROR) { output->onWriteError(err); return; } } } status_t PrivacyFilter::writeData(const FdBuffer& buffer, uint8_t bufferLevel, size_t* maxSize, bool encryptIfNeeded) { status_t PrivacyFilter::writeData(const FdBuffer& buffer, uint8_t bufferLevel, size_t* maxSize) { status_t err; if (maxSize != NULL) { Loading Loading @@ -330,7 +288,17 @@ status_t PrivacyFilter::writeData(const FdBuffer& buffer, uint8_t bufferLevel, s // Write the resultant buffer to the fd, along with the header. ssize_t dataSize = fieldStripper.dataSize(); if (dataSize > 0) { write_section_to_file(mSectionId, fieldStripper, output, encryptIfNeeded); err = write_section_header(output->getFd(), mSectionId, dataSize); if (err != NO_ERROR) { output->onWriteError(err); continue; } err = fieldStripper.writeData(output->getFd()); if (err != NO_ERROR) { output->onWriteError(err); continue; } } if (maxSize != NULL) { Loading Loading @@ -382,18 +350,8 @@ status_t filter_and_write_report(int to, int from, uint8_t bufferLevel, // Read this section from the reader into an FdBuffer size_t sectionSize = reader->readRawVarint(); FdBuffer sectionData; // Write data to FdBuffer, if the section was encrypted, decrypt first. if (sectionEncryption(fieldId)) { VLOG("sectionSize %lu", (unsigned long)sectionSize); ProtoDecryptor decryptor(reader, sectionSize); err = decryptor.decryptAndFlush(§ionData); } else { err = sectionData.write(reader, sectionSize); } if (err != NO_ERROR) { ALOGW("filter_and_write_report FdBuffer.write failed (this shouldn't happen): %s", strerror(-err)); Loading @@ -401,8 +359,7 @@ status_t filter_and_write_report(int to, int from, uint8_t bufferLevel, } // Do the filter and write. err = filter.writeData(sectionData, bufferLevel, nullptr, false /* do not encrypt again*/); err = filter.writeData(sectionData, bufferLevel, nullptr); if (err != NO_ERROR) { ALOGW("filter_and_write_report filter.writeData had an error: %s", strerror(-err)); return err; Loading @@ -411,7 +368,6 @@ status_t filter_and_write_report(int to, int from, uint8_t bufferLevel, // We don't need this field. Incident does not have any direct children // other than sections. So just skip them. write_field_or_skip(NULL, reader, fieldTag, true); VLOG("Skip this.... section %d", fieldId); } } Loading Loading
api/test-current.txt +0 −1 Original line number Diff line number Diff line Loading @@ -725,7 +725,6 @@ package android.content.pm { field public static final int FLAG_PERMISSION_USER_SET = 1; // 0x1 field public static final int MATCH_FACTORY_ONLY = 2097152; // 0x200000 field public static final int MATCH_KNOWN_PACKAGES = 4202496; // 0x402000 field public static boolean RESTRICTED_PERMISSIONS_ENABLED; field public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services"; field public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared"; } Loading
cmds/incidentd/Android.bp +0 −14 Original line number Diff line number Diff line Loading @@ -60,12 +60,6 @@ cc_binary { "libservices", "libutils", "libprotobuf-cpp-lite", "libcrypto", "libkeystore_aidl", "libkeystore_binder", "libkeystore_parcelables", "android.hardware.keymaster@4.0", "libkeymaster4support", ], static_libs: [ Loading Loading @@ -119,8 +113,6 @@ cc_test { "src/incidentd_util.cpp", "src/proto_util.cpp", "src/report_directory.cpp", "src/cipher/IncidentKeyStore.cpp", "src/cipher/ProtoEncryption.cpp", "src/**/*.proto", ], Loading @@ -142,12 +134,6 @@ cc_test { "libprotoutil", "libservices", "libutils", "libcrypto", "libkeystore_aidl", "libkeystore_binder", "libkeystore_parcelables", "android.hardware.keymaster@4.0", "libkeymaster4support", ], target: { Loading
cmds/incidentd/src/Privacy.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ namespace incidentd { using namespace android::os; using std::strstream; static const bool kEncryptionEnabled = false; uint64_t encode_field_id(const Privacy* p) { return (uint64_t)p->type << 32 | p->field_id; } string Privacy::toString() const { Loading @@ -52,10 +50,6 @@ const Privacy* lookup(const Privacy* p, uint32_t fieldId) { return NULL; } bool sectionEncryption(int section_id) { return kEncryptionEnabled ? (section_id == 3025) /*restricted image section*/ : false; } static bool isAllowed(const uint8_t policy, const uint8_t check) { switch (check) { case PRIVACY_POLICY_LOCAL: Loading
cmds/incidentd/src/Privacy.h +0 −3 Original line number Diff line number Diff line Loading @@ -90,9 +90,6 @@ private: uint8_t mPolicy; }; // TODO: Add privacy flag in incident.proto and auto generate it inside Privacy. bool sectionEncryption(int section_id); /** * If a privacy policy is other than the defined values, update it to a real one. */ Loading
cmds/incidentd/src/PrivacyFilter.cpp +21 −65 Original line number Diff line number Diff line Loading @@ -16,20 +16,19 @@ #define DEBUG false #include "Log.h" #include "incidentd_util.h" #include "PrivacyFilter.h" #include "proto_util.h" #include "incidentd_util.h" #include "proto_util.h" #include "Section.h" #include <android-base/file.h> #include <android/util/ProtoFileReader.h> #include <android/util/protobuf.h> #include <android/util/ProtoFileReader.h> #include <log/log.h> #include "cipher/IncidentKeyStore.h" #include "cipher/ProtoEncryption.h" namespace android { namespace os { namespace incidentd { Loading Loading @@ -146,8 +145,6 @@ public: */ status_t writeData(int fd); sp<ProtoReader> getData() { return mData; } private: /** * The global set of field --> required privacy level mapping. Loading Loading @@ -259,47 +256,8 @@ void PrivacyFilter::addFd(const sp<FilterFd>& output) { mOutputs.push_back(output); } static void write_section_to_file(int sectionId, FieldStripper& fieldStripper, sp<FilterFd> output, bool encryptIfNeeded) { status_t err; if (sectionEncryption(sectionId) && encryptIfNeeded) { ProtoEncryptor encryptor(fieldStripper.getData()); size_t encryptedSize = encryptor.encrypt(); if (encryptedSize <= 0) { output->onWriteError(BAD_VALUE); return; } err = write_section_header(output->getFd(), sectionId, encryptedSize); VLOG("Encrypted: write section header size %lu", (unsigned long)encryptedSize); encryptor.flush(output->getFd()); if (err != NO_ERROR) { output->onWriteError(err); return; } } else { err = write_section_header(output->getFd(), sectionId, fieldStripper.dataSize()); VLOG("No encryption: write section header size %lu", (unsigned long)fieldStripper.dataSize()); if (err != NO_ERROR) { output->onWriteError(err); return; } err = fieldStripper.writeData(output->getFd()); if (err != NO_ERROR) { output->onWriteError(err); return; } } } status_t PrivacyFilter::writeData(const FdBuffer& buffer, uint8_t bufferLevel, size_t* maxSize, bool encryptIfNeeded) { status_t PrivacyFilter::writeData(const FdBuffer& buffer, uint8_t bufferLevel, size_t* maxSize) { status_t err; if (maxSize != NULL) { Loading Loading @@ -330,7 +288,17 @@ status_t PrivacyFilter::writeData(const FdBuffer& buffer, uint8_t bufferLevel, s // Write the resultant buffer to the fd, along with the header. ssize_t dataSize = fieldStripper.dataSize(); if (dataSize > 0) { write_section_to_file(mSectionId, fieldStripper, output, encryptIfNeeded); err = write_section_header(output->getFd(), mSectionId, dataSize); if (err != NO_ERROR) { output->onWriteError(err); continue; } err = fieldStripper.writeData(output->getFd()); if (err != NO_ERROR) { output->onWriteError(err); continue; } } if (maxSize != NULL) { Loading Loading @@ -382,18 +350,8 @@ status_t filter_and_write_report(int to, int from, uint8_t bufferLevel, // Read this section from the reader into an FdBuffer size_t sectionSize = reader->readRawVarint(); FdBuffer sectionData; // Write data to FdBuffer, if the section was encrypted, decrypt first. if (sectionEncryption(fieldId)) { VLOG("sectionSize %lu", (unsigned long)sectionSize); ProtoDecryptor decryptor(reader, sectionSize); err = decryptor.decryptAndFlush(§ionData); } else { err = sectionData.write(reader, sectionSize); } if (err != NO_ERROR) { ALOGW("filter_and_write_report FdBuffer.write failed (this shouldn't happen): %s", strerror(-err)); Loading @@ -401,8 +359,7 @@ status_t filter_and_write_report(int to, int from, uint8_t bufferLevel, } // Do the filter and write. err = filter.writeData(sectionData, bufferLevel, nullptr, false /* do not encrypt again*/); err = filter.writeData(sectionData, bufferLevel, nullptr); if (err != NO_ERROR) { ALOGW("filter_and_write_report filter.writeData had an error: %s", strerror(-err)); return err; Loading @@ -411,7 +368,6 @@ status_t filter_and_write_report(int to, int from, uint8_t bufferLevel, // We don't need this field. Incident does not have any direct children // other than sections. So just skip them. write_field_or_skip(NULL, reader, fieldTag, true); VLOG("Skip this.... section %d", fieldId); } } Loading