|
|
|
@ -13,7 +13,6 @@ import android.os.IBinder;
|
|
|
|
|
import android.support.annotation.Nullable;
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.Random;
|
|
|
|
@ -74,7 +73,6 @@ public class ShellService extends Service {
|
|
|
|
|
|
|
|
|
|
if (this.mProcessThread != null) {
|
|
|
|
|
Log.w("adx", "process isn't null,service won't start");
|
|
|
|
|
Toast.makeText((Context)this, (CharSequence)"process isn't null,service won't start", Toast.LENGTH_SHORT).show();
|
|
|
|
|
return Service.START_NOT_STICKY;
|
|
|
|
|
} else if (intent != null) {
|
|
|
|
|
Bundle extras = intent.getExtras();
|
|
|
|
@ -104,13 +102,13 @@ public class ShellService extends Service {
|
|
|
|
|
// Log.e("adx", ExceptionsKt.stackTraceToString((Throwable)var7));
|
|
|
|
|
logger.warning(ex.getMessage());
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
Toast.makeText((Context)this, (CharSequence)ex.getMessage(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
// Toast.makeText((Context)this, (CharSequence)ex.getMessage(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
this.stopSelf();
|
|
|
|
|
return Service.START_NOT_STICKY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.warning("Service has been started");
|
|
|
|
|
Toast.makeText((Context)this, (CharSequence)"已启动frp服务", Toast.LENGTH_SHORT).show();
|
|
|
|
|
// Toast.makeText((Context)this, (CharSequence)"已启动frp服务", Toast.LENGTH_SHORT).show();
|
|
|
|
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
|
|
|
|
this.startForeground(1, this.showNotification());
|
|
|
|
|
}
|
|
|
|
@ -119,19 +117,23 @@ public class ShellService extends Service {
|
|
|
|
|
} else {
|
|
|
|
|
fileName = "Error:filename unknown!!!";
|
|
|
|
|
Log.e("adx", fileName);
|
|
|
|
|
Toast.makeText((Context)this, (CharSequence)fileName, Toast.LENGTH_SHORT).show();
|
|
|
|
|
// Toast.makeText((Context)this, (CharSequence)fileName, Toast.LENGTH_SHORT).show();
|
|
|
|
|
this.stopSelf();
|
|
|
|
|
return Service.START_NOT_STICKY;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onDestroy() {
|
|
|
|
|
if (mProcessThread != null) {
|
|
|
|
|
mProcessThread.interrupt();
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
if (mProcessThread != null) {
|
|
|
|
|
mProcessThread.interrupt();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.warning("Service has been stopped");
|
|
|
|
|
Toast.makeText((Context)this, (CharSequence)"已关闭frp服务", Toast.LENGTH_SHORT).show();
|
|
|
|
|
logger.warning("Service has been stopped");
|
|
|
|
|
// Toast.makeText((Context)this, (CharSequence)"已关闭frp服务", Toast.LENGTH_SHORT).show();
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private final void runCommand(String command, String[] envp, File dir) {
|
|
|
|
|