Loading PREUPLOAD.cfg +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ clang_format = true [Builtin Hooks Options] # Only turn on clang-format check for the following subfolders. clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp libs/graphicsenv/ libs/gui/ libs/ui/ libs/vr/ Loading cmds/installd/otapreopt.cpp +23 −19 Original line number Diff line number Diff line Loading @@ -322,21 +322,8 @@ private: return false; } const char* isa = parameters_.instruction_set; // Check whether the file exists where expected. std::string dalvik_cache = GetOTADataDirectory() + "/" + DALVIK_CACHE; std::string isa_path = dalvik_cache + "/" + isa; std::string art_path = isa_path + "/system@framework@boot.art"; std::string oat_path = isa_path + "/system@framework@boot.oat"; bool cleared = false; if (access(art_path.c_str(), F_OK) == 0 && access(oat_path.c_str(), F_OK) == 0) { // Files exist, assume everything is alright if not forced. Otherwise clean up. if (!force) { return true; } ClearDirectory(isa_path); cleared = true; } // Reset umask in otapreopt, so that we control the the access for the files we create. umask(0); Loading @@ -355,19 +342,36 @@ private: } } // Prepare to create. if (!cleared) { // Check whether we have files in /data. // TODO: check that the files are correct wrt/ jars. std::string art_path = isa_path + "/system@framework@boot.art"; std::string oat_path = isa_path + "/system@framework@boot.oat"; bool cleared = false; if (access(art_path.c_str(), F_OK) == 0 && access(oat_path.c_str(), F_OK) == 0) { // Files exist, assume everything is alright if not forced. Otherwise clean up. if (!force) { return true; } ClearDirectory(isa_path); cleared = true; } // Check whether we have an image in /system. // TODO: check that the files are correct wrt/ jars. std::string preopted_boot_art_path = StringPrintf("/system/framework/%s/boot.art", isa); if (access(preopted_boot_art_path.c_str(), F_OK) != 0) { // No preopted boot image. Try to compile. return Dex2oatBootImage(boot_classpath_, art_path, oat_path, isa); } if (access(preopted_boot_art_path.c_str(), F_OK) == 0) { // Note: we ignore |force| here. return true; } if (!cleared) { ClearDirectory(isa_path); } return Dex2oatBootImage(boot_classpath_, art_path, oat_path, isa); } static bool CreatePath(const std::string& path) { // Create the given path. Use string processing instead of dirname, as dirname's need for // a writable char buffer is painful. Loading cmds/servicemanager/service_manager.c +1 −0 Original line number Diff line number Diff line Loading @@ -274,6 +274,7 @@ int svcmgr_handler(struct binder_state *bs, // Note that we ignore the strict_policy and don't propagate it // further (since we do no outbound RPCs anyway). strict_policy = bio_get_uint32(msg); bio_get_uint32(msg); // Ignore worksource header. s = bio_get_string16(msg, &len); if (s == NULL) { return -1; Loading libs/binder/IPCThreadState.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,10 @@ static const char *kCommandStrings[] = { "BC_DEAD_BINDER_DONE" }; // The work source represents the UID of the process we should attribute the transaction to. // We use -1 to specify that the work source was not set using #setWorkSource. static const int kUnsetWorkSource = -1; static const char* getReturnString(uint32_t cmd) { size_t idx = cmd & 0xff; Loading Loading @@ -383,6 +387,25 @@ int32_t IPCThreadState::getStrictModePolicy() const return mStrictModePolicy; } uid_t IPCThreadState::setWorkSource(uid_t uid) { uid_t returnValue = mWorkSource; mWorkSource = uid; return returnValue; } uid_t IPCThreadState::getWorkSource() const { return mWorkSource; } uid_t IPCThreadState::clearWorkSource() { uid_t returnValue = mWorkSource; mWorkSource = kUnsetWorkSource; return returnValue; } void IPCThreadState::setLastTransactionBinderFlags(int32_t flags) { mLastTransactionBinderFlags = flags; Loading Loading @@ -736,6 +759,7 @@ status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy) IPCThreadState::IPCThreadState() : mProcess(ProcessState::self()), mWorkSource(kUnsetWorkSource), mStrictModePolicy(0), mLastTransactionBinderFlags(0) { Loading libs/binder/Parcel.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -601,6 +601,7 @@ status_t Parcel::writeInterfaceToken(const String16& interface) { writeInt32(IPCThreadState::self()->getStrictModePolicy() | STRICT_MODE_PENALTY_GATHER); writeInt32(IPCThreadState::self()->getWorkSource()); // currently the interface identification token is just its name as a string return writeString16(interface); } Loading @@ -613,6 +614,7 @@ bool Parcel::checkInterface(IBinder* binder) const bool Parcel::enforceInterface(const String16& interface, IPCThreadState* threadState) const { // StrictModePolicy. int32_t strictPolicy = readInt32(); if (threadState == nullptr) { threadState = IPCThreadState::self(); Loading @@ -627,6 +629,10 @@ bool Parcel::enforceInterface(const String16& interface, } else { threadState->setStrictModePolicy(strictPolicy); } // WorkSource. int32_t workSource = readInt32(); threadState->setWorkSource(workSource); // Interface descriptor. const String16 str(readString16()); if (str == interface) { return true; Loading Loading
PREUPLOAD.cfg +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ clang_format = true [Builtin Hooks Options] # Only turn on clang-format check for the following subfolders. clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp libs/graphicsenv/ libs/gui/ libs/ui/ libs/vr/ Loading
cmds/installd/otapreopt.cpp +23 −19 Original line number Diff line number Diff line Loading @@ -322,21 +322,8 @@ private: return false; } const char* isa = parameters_.instruction_set; // Check whether the file exists where expected. std::string dalvik_cache = GetOTADataDirectory() + "/" + DALVIK_CACHE; std::string isa_path = dalvik_cache + "/" + isa; std::string art_path = isa_path + "/system@framework@boot.art"; std::string oat_path = isa_path + "/system@framework@boot.oat"; bool cleared = false; if (access(art_path.c_str(), F_OK) == 0 && access(oat_path.c_str(), F_OK) == 0) { // Files exist, assume everything is alright if not forced. Otherwise clean up. if (!force) { return true; } ClearDirectory(isa_path); cleared = true; } // Reset umask in otapreopt, so that we control the the access for the files we create. umask(0); Loading @@ -355,19 +342,36 @@ private: } } // Prepare to create. if (!cleared) { // Check whether we have files in /data. // TODO: check that the files are correct wrt/ jars. std::string art_path = isa_path + "/system@framework@boot.art"; std::string oat_path = isa_path + "/system@framework@boot.oat"; bool cleared = false; if (access(art_path.c_str(), F_OK) == 0 && access(oat_path.c_str(), F_OK) == 0) { // Files exist, assume everything is alright if not forced. Otherwise clean up. if (!force) { return true; } ClearDirectory(isa_path); cleared = true; } // Check whether we have an image in /system. // TODO: check that the files are correct wrt/ jars. std::string preopted_boot_art_path = StringPrintf("/system/framework/%s/boot.art", isa); if (access(preopted_boot_art_path.c_str(), F_OK) != 0) { // No preopted boot image. Try to compile. return Dex2oatBootImage(boot_classpath_, art_path, oat_path, isa); } if (access(preopted_boot_art_path.c_str(), F_OK) == 0) { // Note: we ignore |force| here. return true; } if (!cleared) { ClearDirectory(isa_path); } return Dex2oatBootImage(boot_classpath_, art_path, oat_path, isa); } static bool CreatePath(const std::string& path) { // Create the given path. Use string processing instead of dirname, as dirname's need for // a writable char buffer is painful. Loading
cmds/servicemanager/service_manager.c +1 −0 Original line number Diff line number Diff line Loading @@ -274,6 +274,7 @@ int svcmgr_handler(struct binder_state *bs, // Note that we ignore the strict_policy and don't propagate it // further (since we do no outbound RPCs anyway). strict_policy = bio_get_uint32(msg); bio_get_uint32(msg); // Ignore worksource header. s = bio_get_string16(msg, &len); if (s == NULL) { return -1; Loading
libs/binder/IPCThreadState.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,10 @@ static const char *kCommandStrings[] = { "BC_DEAD_BINDER_DONE" }; // The work source represents the UID of the process we should attribute the transaction to. // We use -1 to specify that the work source was not set using #setWorkSource. static const int kUnsetWorkSource = -1; static const char* getReturnString(uint32_t cmd) { size_t idx = cmd & 0xff; Loading Loading @@ -383,6 +387,25 @@ int32_t IPCThreadState::getStrictModePolicy() const return mStrictModePolicy; } uid_t IPCThreadState::setWorkSource(uid_t uid) { uid_t returnValue = mWorkSource; mWorkSource = uid; return returnValue; } uid_t IPCThreadState::getWorkSource() const { return mWorkSource; } uid_t IPCThreadState::clearWorkSource() { uid_t returnValue = mWorkSource; mWorkSource = kUnsetWorkSource; return returnValue; } void IPCThreadState::setLastTransactionBinderFlags(int32_t flags) { mLastTransactionBinderFlags = flags; Loading Loading @@ -736,6 +759,7 @@ status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy) IPCThreadState::IPCThreadState() : mProcess(ProcessState::self()), mWorkSource(kUnsetWorkSource), mStrictModePolicy(0), mLastTransactionBinderFlags(0) { Loading
libs/binder/Parcel.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -601,6 +601,7 @@ status_t Parcel::writeInterfaceToken(const String16& interface) { writeInt32(IPCThreadState::self()->getStrictModePolicy() | STRICT_MODE_PENALTY_GATHER); writeInt32(IPCThreadState::self()->getWorkSource()); // currently the interface identification token is just its name as a string return writeString16(interface); } Loading @@ -613,6 +614,7 @@ bool Parcel::checkInterface(IBinder* binder) const bool Parcel::enforceInterface(const String16& interface, IPCThreadState* threadState) const { // StrictModePolicy. int32_t strictPolicy = readInt32(); if (threadState == nullptr) { threadState = IPCThreadState::self(); Loading @@ -627,6 +629,10 @@ bool Parcel::enforceInterface(const String16& interface, } else { threadState->setStrictModePolicy(strictPolicy); } // WorkSource. int32_t workSource = readInt32(); threadState->setWorkSource(workSource); // Interface descriptor. const String16 str(readString16()); if (str == interface) { return true; Loading