Loading adb/services.c +13 −0 Original line number Original line Diff line number Diff line Loading @@ -111,6 +111,8 @@ void restart_root_service(int fd, void *cookie) { { char buf[100]; char buf[100]; char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX]; char build_type[PROPERTY_VALUE_MAX]; char cm_version[PROPERTY_VALUE_MAX]; if (getuid() == 0) { if (getuid() == 0) { snprintf(buf, sizeof(buf), "adbd is already running as root\n"); snprintf(buf, sizeof(buf), "adbd is already running as root\n"); Loading @@ -125,6 +127,17 @@ void restart_root_service(int fd, void *cookie) return; return; } } property_get("persist.sys.root_access", value, "1"); property_get("ro.build.type", build_type, ""); property_get("ro.cm.version", cm_version, ""); if (strlen(cm_version) > 0 && strcmp(build_type, "eng") != 0 && (atoi(value) & 2) != 2) { snprintf(buf, sizeof(buf), "root access is disabled by system setting - enable in settings -> development options\n"); writex(fd, buf, strlen(buf)); adb_close(fd); return; } property_set("service.adb.root", "1"); property_set("service.adb.root", "1"); snprintf(buf, sizeof(buf), "restarting adbd as root\n"); snprintf(buf, sizeof(buf), "restarting adbd as root\n"); writex(fd, buf, strlen(buf)); writex(fd, buf, strlen(buf)); Loading Loading
adb/services.c +13 −0 Original line number Original line Diff line number Diff line Loading @@ -111,6 +111,8 @@ void restart_root_service(int fd, void *cookie) { { char buf[100]; char buf[100]; char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX]; char build_type[PROPERTY_VALUE_MAX]; char cm_version[PROPERTY_VALUE_MAX]; if (getuid() == 0) { if (getuid() == 0) { snprintf(buf, sizeof(buf), "adbd is already running as root\n"); snprintf(buf, sizeof(buf), "adbd is already running as root\n"); Loading @@ -125,6 +127,17 @@ void restart_root_service(int fd, void *cookie) return; return; } } property_get("persist.sys.root_access", value, "1"); property_get("ro.build.type", build_type, ""); property_get("ro.cm.version", cm_version, ""); if (strlen(cm_version) > 0 && strcmp(build_type, "eng") != 0 && (atoi(value) & 2) != 2) { snprintf(buf, sizeof(buf), "root access is disabled by system setting - enable in settings -> development options\n"); writex(fd, buf, strlen(buf)); adb_close(fd); return; } property_set("service.adb.root", "1"); property_set("service.adb.root", "1"); snprintf(buf, sizeof(buf), "restarting adbd as root\n"); snprintf(buf, sizeof(buf), "restarting adbd as root\n"); writex(fd, buf, strlen(buf)); writex(fd, buf, strlen(buf)); Loading