|
|
@ -39,21 +39,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
static void usage(char *progname);
|
|
|
|
static void usage(char *progname);
|
|
|
|
|
|
|
|
|
|
|
|
static android::sp<android::IBinder> getServiceAggressive() {
|
|
|
|
|
|
|
|
android::sp<android::IBinder> res;
|
|
|
|
|
|
|
|
auto sm = android::defaultServiceManager();
|
|
|
|
|
|
|
|
auto name = android::String16("vold");
|
|
|
|
|
|
|
|
for (int i = 0; i < 500; i++) {
|
|
|
|
|
|
|
|
res = sm->checkService(name);
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
|
|
|
LOG(VERBOSE) << "Waited " << (i * 10) << "ms for vold";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
usleep(10000); // 10ms
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
int sock;
|
|
|
|
int sock;
|
|
|
|
int wait;
|
|
|
|
int wait;
|
|
|
@ -61,7 +46,6 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
|
|
|
progname = argv[0];
|
|
|
|
progname = argv[0];
|
|
|
|
|
|
|
|
|
|
|
|
setenv("ANDROID_LOG_TAGS", "*:v", 1);
|
|
|
|
|
|
|
|
if (getppid() == 1) {
|
|
|
|
if (getppid() == 1) {
|
|
|
|
// If init is calling us then it's during boot and we should log to kmsg
|
|
|
|
// If init is calling us then it's during boot and we should log to kmsg
|
|
|
|
android::base::InitLogging(argv, &android::base::KernelLogger);
|
|
|
|
android::base::InitLogging(argv, &android::base::KernelLogger);
|
|
|
@ -83,7 +67,8 @@ int main(int argc, char **argv) {
|
|
|
|
std::string arg1 = argv[1];
|
|
|
|
std::string arg1 = argv[1];
|
|
|
|
std::string arg2 = argv[2];
|
|
|
|
std::string arg2 = argv[2];
|
|
|
|
|
|
|
|
|
|
|
|
android::sp<android::IBinder> binder = getServiceAggressive();
|
|
|
|
android::sp<android::IBinder> binder = android::defaultServiceManager()->getService(
|
|
|
|
|
|
|
|
android::String16("vold"));
|
|
|
|
if (!binder) {
|
|
|
|
if (!binder) {
|
|
|
|
LOG(ERROR) << "Failed to obtain vold Binder";
|
|
|
|
LOG(ERROR) << "Failed to obtain vold Binder";
|
|
|
|
exit(EINVAL);
|
|
|
|
exit(EINVAL);
|
|
|
|