Loading cmds/installd/dexopt.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -1958,6 +1958,11 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins /* child -- drop privileges before continuing */ /* child -- drop privileges before continuing */ drop_capabilities(uid); drop_capabilities(uid); // Clear BOOTCLASSPATH. // Let dex2oat use the BCP from boot image, excluding updatable BCP // modules for AOT to avoid app recompilation after their upgrades. unsetenv("BOOTCLASSPATH"); SetDex2OatScheduling(boot_complete); SetDex2OatScheduling(boot_complete); if (flock(out_oat_fd.get(), LOCK_EX | LOCK_NB) != 0) { if (flock(out_oat_fd.get(), LOCK_EX | LOCK_NB) != 0) { PLOG(ERROR) << "flock(" << out_oat_path << ") failed"; PLOG(ERROR) << "flock(" << out_oat_path << ") failed"; Loading cmds/installd/tests/installd_service_test.cpp +10 −8 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <stdlib.h> #include <stdlib.h> #include <string.h> #include <string.h> #include <sys/statvfs.h> #include <sys/statvfs.h> #include <sys/stat.h> #include <sys/xattr.h> #include <sys/xattr.h> #include <android-base/file.h> #include <android-base/file.h> Loading Loading @@ -70,27 +71,28 @@ static std::string get_full_path(const char* path) { static void mkdir(const char* path, uid_t owner, gid_t group, mode_t mode) { static void mkdir(const char* path, uid_t owner, gid_t group, mode_t mode) { const std::string fullPath = get_full_path(path); const std::string fullPath = get_full_path(path); ::mkdir(fullPath.c_str(), mode); EXPECT_EQ(::mkdir(fullPath.c_str(), mode), 0); ::chown(fullPath.c_str(), owner, group); EXPECT_EQ(::chown(fullPath.c_str(), owner, group), 0); ::chmod(fullPath.c_str(), mode); EXPECT_EQ(::chmod(fullPath.c_str(), mode), 0); } } static void touch(const char* path, uid_t owner, gid_t group, mode_t mode) { static void touch(const char* path, uid_t owner, gid_t group, mode_t mode) { int fd = ::open(get_full_path(path).c_str(), O_RDWR | O_CREAT, mode); int fd = ::open(get_full_path(path).c_str(), O_RDWR | O_CREAT, mode); ::fchown(fd, owner, group); EXPECT_NE(fd, -1); ::fchmod(fd, mode); EXPECT_EQ(::fchown(fd, owner, group), 0); ::close(fd); EXPECT_EQ(::fchmod(fd, mode), 0); EXPECT_EQ(::close(fd), 0); } } static int stat_gid(const char* path) { static int stat_gid(const char* path) { struct stat buf; struct stat buf; ::stat(get_full_path(path).c_str(), &buf); EXPECT_EQ(::stat(get_full_path(path).c_str(), &buf), 0); return buf.st_gid; return buf.st_gid; } } static int stat_mode(const char* path) { static int stat_mode(const char* path) { struct stat buf; struct stat buf; ::stat(get_full_path(path).c_str(), &buf); EXPECT_EQ(::stat(get_full_path(path).c_str(), &buf), 0); return buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISGID); return buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISGID); } } Loading libs/binder/ndk/Android.bp +8 −1 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,7 @@ cc_library { cc_library { name: "libbinder_ndk", name: "libbinder_ndk", vendor_available: false, vendor_available: true, export_include_dirs: [ export_include_dirs: [ "include_ndk", "include_ndk", Loading Loading @@ -50,6 +50,13 @@ cc_library { "libandroid_runtime", "libandroid_runtime", ], ], header_libs: [ "jni_headers", ], export_header_lib_headers: [ "jni_headers", ], version_script: "libbinder_ndk.map.txt", version_script: "libbinder_ndk.map.txt", stubs: { stubs: { symbol_file: "libbinder_ndk.map.txt", symbol_file: "libbinder_ndk.map.txt", Loading libs/graphicsenv/GraphicsEnv.cpp +15 −8 Original line number Original line Diff line number Diff line Loading @@ -156,9 +156,9 @@ void GraphicsEnv::setDriverPath(const std::string path) { mDriverPath = path; mDriverPath = path; } } void GraphicsEnv::setGpuStats(const std::string driverPackageName, void GraphicsEnv::setGpuStats(const std::string& driverPackageName, const std::string driverVersionName, const uint64_t driverVersionCode, const std::string& driverVersionName, const std::string appPackageName) { const uint64_t driverVersionCode, const std::string& appPackageName) { ATRACE_CALL(); ATRACE_CALL(); ALOGV("setGpuStats:\n" ALOGV("setGpuStats:\n" Loading Loading @@ -316,28 +316,28 @@ bool GraphicsEnv::shouldUseAngle() { return false; return false; } } return mUseAngle; return (mUseAngle == YES) ? true : false; } } void GraphicsEnv::updateUseAngle() { void GraphicsEnv::updateUseAngle() { mUseAngle = false; mUseAngle = NO; const char* ANGLE_PREFER_ANGLE = "angle"; const char* ANGLE_PREFER_ANGLE = "angle"; const char* ANGLE_PREFER_NATIVE = "native"; const char* ANGLE_PREFER_NATIVE = "native"; if (mAngleDeveloperOptIn == ANGLE_PREFER_ANGLE) { if (mAngleDeveloperOptIn == ANGLE_PREFER_ANGLE) { ALOGV("User set \"Developer Options\" to force the use of ANGLE"); ALOGV("User set \"Developer Options\" to force the use of ANGLE"); mUseAngle = true; mUseAngle = YES; } else if (mAngleDeveloperOptIn == ANGLE_PREFER_NATIVE) { } else if (mAngleDeveloperOptIn == ANGLE_PREFER_NATIVE) { ALOGV("User set \"Developer Options\" to force the use of Native"); ALOGV("User set \"Developer Options\" to force the use of Native"); mUseAngle = false; mUseAngle = NO; } else { } else { // The "Developer Options" value wasn't set to force the use of ANGLE. Need to temporarily // The "Developer Options" value wasn't set to force the use of ANGLE. Need to temporarily // load ANGLE and call the updatable opt-in/out logic: // load ANGLE and call the updatable opt-in/out logic: void* featureSo = loadLibrary("feature_support"); void* featureSo = loadLibrary("feature_support"); if (featureSo) { if (featureSo) { ALOGV("loaded ANGLE's opt-in/out logic from namespace"); ALOGV("loaded ANGLE's opt-in/out logic from namespace"); mUseAngle = checkAngleRules(featureSo); mUseAngle = checkAngleRules(featureSo) ? YES : NO; dlclose(featureSo); dlclose(featureSo); featureSo = nullptr; featureSo = nullptr; } else { } else { Loading @@ -349,6 +349,13 @@ void GraphicsEnv::updateUseAngle() { void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName, void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName, const std::string developerOptIn, const int rulesFd, const std::string developerOptIn, const int rulesFd, const long rulesOffset, const long rulesLength) { const long rulesOffset, const long rulesLength) { if (mUseAngle != UNKNOWN) { // We've already figured out an answer for this app, so just return. ALOGV("Already evaluated the rules file for '%s': use ANGLE = %s", appName.c_str(), (mUseAngle == YES) ? "true" : "false"); return; } ALOGV("setting ANGLE path to '%s'", path.c_str()); ALOGV("setting ANGLE path to '%s'", path.c_str()); mAnglePath = path; mAnglePath = path; ALOGV("setting ANGLE app name to '%s'", appName.c_str()); ALOGV("setting ANGLE app name to '%s'", appName.c_str()); Loading libs/graphicsenv/IGpuService.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -27,9 +27,9 @@ class BpGpuService : public BpInterface<IGpuService> { public: public: explicit BpGpuService(const sp<IBinder>& impl) : BpInterface<IGpuService>(impl) {} explicit BpGpuService(const sp<IBinder>& impl) : BpInterface<IGpuService>(impl) {} virtual void setGpuStats(const std::string driverPackageName, virtual void setGpuStats(const std::string& driverPackageName, const std::string driverVersionName, const uint64_t driverVersionCode, const std::string& driverVersionName, const uint64_t driverVersionCode, const std::string appPackageName) { const std::string& appPackageName) { Parcel data, reply; Parcel data, reply; data.writeInterfaceToken(IGpuService::getInterfaceDescriptor()); data.writeInterfaceToken(IGpuService::getInterfaceDescriptor()); Loading Loading
cmds/installd/dexopt.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -1958,6 +1958,11 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins /* child -- drop privileges before continuing */ /* child -- drop privileges before continuing */ drop_capabilities(uid); drop_capabilities(uid); // Clear BOOTCLASSPATH. // Let dex2oat use the BCP from boot image, excluding updatable BCP // modules for AOT to avoid app recompilation after their upgrades. unsetenv("BOOTCLASSPATH"); SetDex2OatScheduling(boot_complete); SetDex2OatScheduling(boot_complete); if (flock(out_oat_fd.get(), LOCK_EX | LOCK_NB) != 0) { if (flock(out_oat_fd.get(), LOCK_EX | LOCK_NB) != 0) { PLOG(ERROR) << "flock(" << out_oat_path << ") failed"; PLOG(ERROR) << "flock(" << out_oat_path << ") failed"; Loading
cmds/installd/tests/installd_service_test.cpp +10 −8 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <stdlib.h> #include <stdlib.h> #include <string.h> #include <string.h> #include <sys/statvfs.h> #include <sys/statvfs.h> #include <sys/stat.h> #include <sys/xattr.h> #include <sys/xattr.h> #include <android-base/file.h> #include <android-base/file.h> Loading Loading @@ -70,27 +71,28 @@ static std::string get_full_path(const char* path) { static void mkdir(const char* path, uid_t owner, gid_t group, mode_t mode) { static void mkdir(const char* path, uid_t owner, gid_t group, mode_t mode) { const std::string fullPath = get_full_path(path); const std::string fullPath = get_full_path(path); ::mkdir(fullPath.c_str(), mode); EXPECT_EQ(::mkdir(fullPath.c_str(), mode), 0); ::chown(fullPath.c_str(), owner, group); EXPECT_EQ(::chown(fullPath.c_str(), owner, group), 0); ::chmod(fullPath.c_str(), mode); EXPECT_EQ(::chmod(fullPath.c_str(), mode), 0); } } static void touch(const char* path, uid_t owner, gid_t group, mode_t mode) { static void touch(const char* path, uid_t owner, gid_t group, mode_t mode) { int fd = ::open(get_full_path(path).c_str(), O_RDWR | O_CREAT, mode); int fd = ::open(get_full_path(path).c_str(), O_RDWR | O_CREAT, mode); ::fchown(fd, owner, group); EXPECT_NE(fd, -1); ::fchmod(fd, mode); EXPECT_EQ(::fchown(fd, owner, group), 0); ::close(fd); EXPECT_EQ(::fchmod(fd, mode), 0); EXPECT_EQ(::close(fd), 0); } } static int stat_gid(const char* path) { static int stat_gid(const char* path) { struct stat buf; struct stat buf; ::stat(get_full_path(path).c_str(), &buf); EXPECT_EQ(::stat(get_full_path(path).c_str(), &buf), 0); return buf.st_gid; return buf.st_gid; } } static int stat_mode(const char* path) { static int stat_mode(const char* path) { struct stat buf; struct stat buf; ::stat(get_full_path(path).c_str(), &buf); EXPECT_EQ(::stat(get_full_path(path).c_str(), &buf), 0); return buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISGID); return buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISGID); } } Loading
libs/binder/ndk/Android.bp +8 −1 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,7 @@ cc_library { cc_library { name: "libbinder_ndk", name: "libbinder_ndk", vendor_available: false, vendor_available: true, export_include_dirs: [ export_include_dirs: [ "include_ndk", "include_ndk", Loading Loading @@ -50,6 +50,13 @@ cc_library { "libandroid_runtime", "libandroid_runtime", ], ], header_libs: [ "jni_headers", ], export_header_lib_headers: [ "jni_headers", ], version_script: "libbinder_ndk.map.txt", version_script: "libbinder_ndk.map.txt", stubs: { stubs: { symbol_file: "libbinder_ndk.map.txt", symbol_file: "libbinder_ndk.map.txt", Loading
libs/graphicsenv/GraphicsEnv.cpp +15 −8 Original line number Original line Diff line number Diff line Loading @@ -156,9 +156,9 @@ void GraphicsEnv::setDriverPath(const std::string path) { mDriverPath = path; mDriverPath = path; } } void GraphicsEnv::setGpuStats(const std::string driverPackageName, void GraphicsEnv::setGpuStats(const std::string& driverPackageName, const std::string driverVersionName, const uint64_t driverVersionCode, const std::string& driverVersionName, const std::string appPackageName) { const uint64_t driverVersionCode, const std::string& appPackageName) { ATRACE_CALL(); ATRACE_CALL(); ALOGV("setGpuStats:\n" ALOGV("setGpuStats:\n" Loading Loading @@ -316,28 +316,28 @@ bool GraphicsEnv::shouldUseAngle() { return false; return false; } } return mUseAngle; return (mUseAngle == YES) ? true : false; } } void GraphicsEnv::updateUseAngle() { void GraphicsEnv::updateUseAngle() { mUseAngle = false; mUseAngle = NO; const char* ANGLE_PREFER_ANGLE = "angle"; const char* ANGLE_PREFER_ANGLE = "angle"; const char* ANGLE_PREFER_NATIVE = "native"; const char* ANGLE_PREFER_NATIVE = "native"; if (mAngleDeveloperOptIn == ANGLE_PREFER_ANGLE) { if (mAngleDeveloperOptIn == ANGLE_PREFER_ANGLE) { ALOGV("User set \"Developer Options\" to force the use of ANGLE"); ALOGV("User set \"Developer Options\" to force the use of ANGLE"); mUseAngle = true; mUseAngle = YES; } else if (mAngleDeveloperOptIn == ANGLE_PREFER_NATIVE) { } else if (mAngleDeveloperOptIn == ANGLE_PREFER_NATIVE) { ALOGV("User set \"Developer Options\" to force the use of Native"); ALOGV("User set \"Developer Options\" to force the use of Native"); mUseAngle = false; mUseAngle = NO; } else { } else { // The "Developer Options" value wasn't set to force the use of ANGLE. Need to temporarily // The "Developer Options" value wasn't set to force the use of ANGLE. Need to temporarily // load ANGLE and call the updatable opt-in/out logic: // load ANGLE and call the updatable opt-in/out logic: void* featureSo = loadLibrary("feature_support"); void* featureSo = loadLibrary("feature_support"); if (featureSo) { if (featureSo) { ALOGV("loaded ANGLE's opt-in/out logic from namespace"); ALOGV("loaded ANGLE's opt-in/out logic from namespace"); mUseAngle = checkAngleRules(featureSo); mUseAngle = checkAngleRules(featureSo) ? YES : NO; dlclose(featureSo); dlclose(featureSo); featureSo = nullptr; featureSo = nullptr; } else { } else { Loading @@ -349,6 +349,13 @@ void GraphicsEnv::updateUseAngle() { void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName, void GraphicsEnv::setAngleInfo(const std::string path, const std::string appName, const std::string developerOptIn, const int rulesFd, const std::string developerOptIn, const int rulesFd, const long rulesOffset, const long rulesLength) { const long rulesOffset, const long rulesLength) { if (mUseAngle != UNKNOWN) { // We've already figured out an answer for this app, so just return. ALOGV("Already evaluated the rules file for '%s': use ANGLE = %s", appName.c_str(), (mUseAngle == YES) ? "true" : "false"); return; } ALOGV("setting ANGLE path to '%s'", path.c_str()); ALOGV("setting ANGLE path to '%s'", path.c_str()); mAnglePath = path; mAnglePath = path; ALOGV("setting ANGLE app name to '%s'", appName.c_str()); ALOGV("setting ANGLE app name to '%s'", appName.c_str()); Loading
libs/graphicsenv/IGpuService.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -27,9 +27,9 @@ class BpGpuService : public BpInterface<IGpuService> { public: public: explicit BpGpuService(const sp<IBinder>& impl) : BpInterface<IGpuService>(impl) {} explicit BpGpuService(const sp<IBinder>& impl) : BpInterface<IGpuService>(impl) {} virtual void setGpuStats(const std::string driverPackageName, virtual void setGpuStats(const std::string& driverPackageName, const std::string driverVersionName, const uint64_t driverVersionCode, const std::string& driverVersionName, const uint64_t driverVersionCode, const std::string appPackageName) { const std::string& appPackageName) { Parcel data, reply; Parcel data, reply; data.writeInterfaceToken(IGpuService::getInterfaceDescriptor()); data.writeInterfaceToken(IGpuService::getInterfaceDescriptor()); Loading