mirror of
https://github.com/termux/termux-app
synced 2024-06-18 07:07:08 +00:00
Fix review findings
This commit is contained in:
parent
e3c8598462
commit
e5299dbb9b
|
@ -8,7 +8,6 @@ import android.app.Service;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
|
@ -365,11 +364,13 @@ public final class TermuxService extends Service implements AppShell.AppShellCli
|
|||
return;
|
||||
}
|
||||
|
||||
int gracePeriod = IntentUtils.getIntegerExtraIfSet(intent, TERMUX_SERVICE.EXTRA_TERMINATE_GRACE_PERIOD, 5000);
|
||||
String shellName = IntentUtils.getStringExtraIfSet(intent, TERMUX_SERVICE.EXTRA_SHELL_NAME, null);
|
||||
if (shellName == null) {
|
||||
Logger.logError(LOG_TAG, "Ignoring intent since it did not contain explicit shell name");
|
||||
return;
|
||||
}
|
||||
|
||||
Uri executableUri = intent.getData();
|
||||
String executable = UriUtils.getUriFilePathWithFragment(executableUri);
|
||||
String shellName = ShellUtils.getExecutableBasename(executable);
|
||||
int gracePeriod = IntentUtils.getIntegerExtraIfSet(intent, TERMUX_SERVICE.EXTRA_TERMINATE_GRACE_PERIOD, 5000);
|
||||
AppShell appShell = getTermuxTaskForShellName(shellName);
|
||||
if (appShell != null) {
|
||||
appShell.terminateIfExecuting(getApplicationContext(), gracePeriod, true);
|
||||
|
|
|
@ -993,8 +993,8 @@ public final class TermuxConstants {
|
|||
/** Intent action to execute command with TERMUX_SERVICE */
|
||||
public static final String ACTION_SERVICE_EXECUTE = TERMUX_PACKAGE_NAME + ".service_execute"; // Default: "com.termux.service_execute"
|
||||
|
||||
/** Intent action to execute command with TERMUX_SERVICE */
|
||||
public static final String ACTION_SERVICE_STOP = TERMUX_PACKAGE_NAME + ".service_execution_stop"; // Default: "com.termux.service_execute"
|
||||
/** Intent action to stop command execution with TERMUX_SERVICE */
|
||||
public static final String ACTION_SERVICE_STOP = TERMUX_PACKAGE_NAME + ".service_execution_stop"; // Default: "com.termux.service_execution_stop"
|
||||
|
||||
/** Uri scheme for paths sent via intent to TERMUX_SERVICE */
|
||||
public static final String URI_SCHEME_SERVICE_EXECUTE = TERMUX_PACKAGE_NAME + ".file"; // Default: "com.termux.file"
|
||||
|
@ -1051,7 +1051,7 @@ public final class TermuxConstants {
|
|||
public static final String EXTRA_RESULT_FILES_SUFFIX = TERMUX_PACKAGE_NAME + ".execute.result_files_suffix"; // Default: "com.termux.execute.result_files_suffix"
|
||||
/** Intent {@code long} extra for graceperiod between SIGTERM and SIGKILL
|
||||
* for the TERMUX_SERVICE.ACTION_SERVICE_STOP intent */
|
||||
public static final String EXTRA_TERMINATE_GRACE_PERIOD = TERMUX_PACKAGE_NAME + ".execute.stop.delay";
|
||||
public static final String EXTRA_TERMINATE_GRACE_PERIOD = TERMUX_PACKAGE_NAME + ".execute.stop.delay"; // Default: "com.termux.execute.stop.delay"
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user