mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-07 03:05:18 +08:00
Added: termux-am-library to integrate am with Termux.
This commit is contained in:
committed by
agnostic-apollo
parent
e597ece75f
commit
4aca16326c
@@ -25,6 +25,10 @@ android {
|
||||
|
||||
implementation project(":terminal-view")
|
||||
implementation project(":termux-shared")
|
||||
|
||||
|
||||
implementation 'com.github.tareksander:termux-am-library:main-SNAPSHOT'
|
||||
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
|
@@ -3,13 +3,16 @@ package com.termux.app;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import com.termux.am.Am;
|
||||
import com.termux.shared.termux.TermuxConstants;
|
||||
import com.termux.shared.termux.crash.TermuxCrashUtils;
|
||||
import com.termux.shared.termux.settings.preferences.TermuxAppSharedPreferences;
|
||||
import com.termux.shared.logger.Logger;
|
||||
import com.termux.shared.termux.settings.properties.TermuxAppSharedProperties;
|
||||
import com.termux.shared.termux.theme.TermuxThemeUtils;
|
||||
import com.termux.shared.shell.LocalSocketListener;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TermuxApplication extends Application {
|
||||
|
||||
@@ -31,6 +34,20 @@ public class TermuxApplication extends Application {
|
||||
|
||||
// Set NightMode.APP_NIGHT_MODE
|
||||
TermuxThemeUtils.setAppNightMode(properties.getNightMode());
|
||||
|
||||
try {
|
||||
new LocalSocketListener(this, (args, out, err) -> {
|
||||
try {
|
||||
new Am(out, err, this).run(args);
|
||||
return 0;
|
||||
} catch (Exception e) {
|
||||
return 1;
|
||||
}
|
||||
}, TermuxConstants.TERMUX_PACKAGE_NAME+"://call-am", 1000);
|
||||
}
|
||||
catch (IOException e) {
|
||||
Logger.logDebug("TermuxApplication", "am socket already in use");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setLogConfig(Context context) {
|
||||
|
Reference in New Issue
Block a user