", "()V");
256 | if (method_fileDescriptor_init == NULL) {
257 | LOGE("Can't find FileDescriptor.init");
258 | return -1;
259 | }
260 | return 0;
261 | }
262 |
263 |
264 | static const char *classPathName = "jackpal/androidterm2/Exec";
265 |
266 | static JNINativeMethod method_table[] = {
267 | { "createSubprocess", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I)Ljava/io/FileDescriptor;",
268 | (void*) android_os_Exec_createSubProcess },
269 | { "setPtyWindowSize", "(Ljava/io/FileDescriptor;IIII)V",
270 | (void*) android_os_Exec_setPtyWindowSize},
271 | { "waitFor", "(I)I",
272 | (void*) android_os_Exec_waitFor},
273 | { "close", "(Ljava/io/FileDescriptor;)V",
274 | (void*) android_os_Exec_close}
275 | };
276 |
277 | /*
278 | * Register several native methods for one class.
279 | */
280 | static int registerNativeMethods(JNIEnv* env, const char* className,
281 | JNINativeMethod* gMethods, int numMethods)
282 | {
283 | jclass clazz;
284 |
285 | clazz = env->FindClass(className);
286 | if (clazz == NULL) {
287 | LOGE("Native registration unable to find class '%s'", className);
288 | return JNI_FALSE;
289 | }
290 | if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
291 | LOGE("RegisterNatives failed for '%s'", className);
292 | return JNI_FALSE;
293 | }
294 |
295 | return JNI_TRUE;
296 | }
297 |
298 | /*
299 | * Register native methods for all classes we know about.
300 | *
301 | * returns JNI_TRUE on success.
302 | */
303 | static int registerNatives(JNIEnv* env)
304 | {
305 | if (!registerNativeMethods(env, classPathName, method_table,
306 | sizeof(method_table) / sizeof(method_table[0]))) {
307 | return JNI_FALSE;
308 | }
309 |
310 | return JNI_TRUE;
311 | }
312 |
313 |
314 | // ----------------------------------------------------------------------------
315 |
316 | /*
317 | * This is called by the VM when the shared library is first loaded.
318 | */
319 |
320 | typedef union {
321 | JNIEnv* env;
322 | void* venv;
323 | } UnionJNIEnvToVoid;
324 |
325 | jint JNI_OnLoad(JavaVM* vm, void* reserved) {
326 | UnionJNIEnvToVoid uenv;
327 | uenv.venv = NULL;
328 | jint result = -1;
329 | JNIEnv* env = NULL;
330 |
331 | LOGI("JNI_OnLoad");
332 |
333 | if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
334 | LOGE("ERROR: GetEnv failed");
335 | goto bail;
336 | }
337 | env = uenv.env;
338 |
339 | if ((result = register_FileDescriptor(env)) < 0) {
340 | LOGE("ERROR: registerFileDescriptor failed");
341 | goto bail;
342 | }
343 |
344 | if (registerNatives(env) != JNI_TRUE) {
345 | LOGE("ERROR: registerNatives failed");
346 | goto bail;
347 | }
348 |
349 | result = JNI_VERSION_1_4;
350 |
351 | bail:
352 | return result;
353 | }
354 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/app_terminal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_AndroidTerm/c6c01efece222a72e5fd541cd741948f22495dab/res/drawable-hdpi/app_terminal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/atari_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_AndroidTerm/c6c01efece222a72e5fd541cd741948f22495dab/res/drawable-hdpi/atari_small.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/app_terminal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_AndroidTerm/c6c01efece222a72e5fd541cd741948f22495dab/res/drawable-mdpi/app_terminal.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/atari_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_AndroidTerm/c6c01efece222a72e5fd541cd741948f22495dab/res/drawable-mdpi/atari_small.png
--------------------------------------------------------------------------------
/res/drawable/atari_small_notice.txt:
--------------------------------------------------------------------------------
1 | COMMENT Copyright (c) 1999, Thomas A. Fine
2 | COMMENT
3 | COMMENT License to copy, modify, and distribute for both commercial and
4 | COMMENT non-commercial use is herby granted, provided this notice
5 | COMMENT is preserved.
6 | COMMENT
7 | COMMENT Email to my last name at head.cfa.harvard.edu
8 | COMMENT http://hea-www.harvard.edu/~fine/
9 | COMMENT
10 | COMMENT Produced with bdfedit, a tcl/tk font editing program
11 | COMMENT written by Thomas A. Fine
--------------------------------------------------------------------------------
/res/layout/term_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
23 |
24 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
30 |
--------------------------------------------------------------------------------
/res/values-de/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | - Statuszeile zeigen
21 | - Statuszeile verbergen
22 |
23 |
24 |
25 | - Permanenter Cursor
26 | - Blinkender Cursor
27 |
28 |
29 |
30 | - Rechteck
31 | - Unterstrichen
32 | - Vertikaler Balken
33 |
34 |
35 |
36 | - 4x8 Pixel
37 | - 6 Punkte
38 | - 7 Punkte
39 | - 8 Punkte
40 | - 9 Punkte
41 | - 10 Punkte
42 | - 12 Punkte
43 | - 14 Punkte
44 | - 16 Punkte
45 | - 20 Punkte
46 |
47 |
48 |
49 | - Schwarzer Text auf weiss
50 | - Weisser Text auf schwarz
51 | - Weisser Text auf blau
52 | - Grüner Text auf schwarz
53 | - Oranger Text auf schwarz
54 | - Roter Text auf schwarz
55 |
56 |
57 |
58 | - Trackball
59 | - \@ Taste
60 | - Linke Alt-Taste
61 | - Rechte Alt-Taste
62 | - Lauter
63 | - Leiser
64 |
65 |
66 |
67 | - Zeichen-basiert
68 | - Wort-basiert
69 |
70 |
71 |
--------------------------------------------------------------------------------
/res/values-de/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 | Terminal Emulator
19 | Einstellungen
20 | Zurücksetzen
21 | Email an
22 | Spezialtasten
23 | Tastatur an/aus
24 |
25 | Text bearbeiten
26 | Alles kopieren
27 | Einfügen
28 |
29 |
30 | Bildschirm
31 |
32 | Statuszeile
33 | Die Statuszeile anzeigen/verbergen.
34 | Statuszeile
35 |
36 | Aussehen Cursor
37 | Das Aussehen des Cursors auswählen.
38 | Aussehen Cursor
39 |
40 | Cursor-Blinken
41 | Die Art auswählen, wie der Cursor blinken soll.
42 | Cursor-Blinken
43 |
44 | Text
45 |
46 | Schriftgröße
47 | Die Zeichengröße in Punkten auswählen.
48 | Schriftgröße
49 |
50 | Farben
51 | Die Textfarben auswählen.
52 | Textfarbe
53 |
54 | Tastatur
55 |
56 | Steuerungstaste
57 | Die Steuerungstaste auswählen.
58 | Steuerungstaste
59 |
60 | Eingabemethode
61 | Die Eingabemethode für die Soft-Tastatur auswählen.
62 | Eingabemethode
63 |
64 | Shell
65 | Shell
66 | Die zu verwendene Shell auswählen.
67 | Shell
68 |
69 | Startkommando
70 | Kommando eingeben, dass beim Start an die Shell gesendet wird.
71 | Startkommando
72 |
73 |
--------------------------------------------------------------------------------
/res/values-fr/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | - Afficher la barre de statut
21 | - Masquer la barre de statut
22 |
23 |
24 |
25 | - Curseur non clignotant
26 | - Curseur clignotant
27 |
28 |
29 |
30 | - Rectangle
31 | - Souligné
32 | - Barre verticale
33 |
34 |
35 |
36 | - Texte noir sur blanc
37 | - Texte blanc sur noir
38 | - Texte blanc sur bleu
39 | - Texte vert sur noir
40 | - Texte orange sur noir
41 | - Texte rouge sur noir
42 |
43 |
44 |
45 | - Trackball
46 | - Touche \@
47 | - Touche Alt gauche
48 | - Touche Alt droite
49 | - Touche Vol Haut
50 | - Touche Vol Bas
51 |
52 |
53 |
54 | - Par caractère
55 | - Par mot
56 |
57 |
58 |
--------------------------------------------------------------------------------
/res/values-fr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 | Terminal Emulator
19 | Préférences
20 | RàZ terminal
21 | Envoyer par e-mail
22 | Touches spéciales
23 | Afficher/Masquer Clavier
24 |
25 | Modifier le texte
26 | Tout copier
27 | Coller
28 |
29 |
30 | Écran
31 |
32 | Barre de statut
33 | Afficher/Masquer la barre de statut
34 | Barre de statut
35 |
36 | Style du curseur
37 | Choisir le style du curseur
38 | Style du curseur
39 |
40 | Clignotement curseur
41 | Choisir si le curseur doit clignoter
42 | Clignotement curseur
43 |
44 | Texte
45 |
46 | Taille police
47 | Choisir la taille de la police de caractères en points
48 | Taille de la police
49 |
50 | Couleurs
51 | Choisir la couleur du texte
52 | Couleur du texte
53 |
54 | Clavier
55 |
56 | Touche CTRL
57 | Choisir quelle touche utiliser pour control (CTRL)
58 | Touche CTRL
59 |
60 | Méthode d\'entrée
61 | Choisir la méthode d\'entrée du clavier virtuel
62 | Méthode d\'entrée
63 |
64 | Shell
65 | Ligne de commande
66 | Régler la ligne de commande du shell
67 | Shell
68 |
69 | Commande initiale
70 | Envoyée au shell au démarrage
71 | Commande initiale
72 |
73 |
--------------------------------------------------------------------------------
/res/values-it/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | - Mostra status bar
21 | - Nascondi status bar
22 |
23 |
24 |
25 | - Cursore non lampeggiante
26 | - Cursore lampeggiante
27 |
28 |
29 |
30 | - Rettangolo
31 | - Underline
32 | - Barra verticale
33 |
34 |
35 |
36 | - 4 x 8 pixels
37 | - 6 pt
38 | - 7 pt
39 | - 8 pt
40 | - 9 pt
41 | - 10 pt
42 | - 12 pt
43 | - 14 pt
44 | - 16 pt
45 | - 20 pt
46 |
47 |
48 |
49 | - Testo nero su bianco
50 | - Testo bianco su nero
51 | - Testo bianco su blu
52 | - Testo verde su nero
53 | - Testo ambra su nero
54 | - Testo rosso su nero
55 |
56 |
57 |
58 | - Trackball
59 | - Tasto \@
60 | - Tasto Alt sin.
61 | - Tasto Alt des.
62 | - Pulsante Vol +
63 | - Pulsante Vol -
64 |
65 |
66 |
67 | - Character-based
68 | - Word-based
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/res/values-it/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 | Emulatore Terminale
19 | Preferenze
20 | Resetta term
21 | Invia Email
22 | Combinazione tasti
23 | Attiva/disattiva keyboard
24 |
25 | Modifica testo
26 | Copia tutto
27 | Incolla
28 |
29 |
30 | Schermo
31 |
32 | Status bar
33 | Mostra/nascondi status bar.
34 | Status bar
35 |
36 | Stile cursore
37 | Scegli lo stile del cursore.
38 | Stile cursore
39 |
40 | Lampeggio cursore
41 | Scegli lampeggio cursore.
42 | Lampeggio cursore
43 |
44 | Testo
45 |
46 | Dimensione carattere
47 | Scegli l\'altezza dei caratteri in punti.
48 | Dimensione carattere
49 |
50 | Colori
51 | Scegli il colore del testo.
52 | Colore testo
53 |
54 | Tastierra
55 |
56 | Tasto control
57 | Scegli tasto control.
58 | Tasto control
59 |
60 | Metodo inserimento
61 | Scegli il metodo di inserimento per la tastiera virtuale.
62 | Metodo inserimento
63 |
64 | Shell
65 | Linea di comando
66 | Specifica la shell.
67 | Shell
68 |
69 | Comando iniziale
70 | Inviato alla shell al suo avvio.
71 | Comando iniziale
72 |
73 |
74 |
--------------------------------------------------------------------------------
/res/values-ja/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | - ステータスバーを表示する
21 | - ステータスバーを隠す
22 |
23 |
24 |
25 | - 点滅しないカーソル
26 | - 点滅するカーソル
27 |
28 |
29 |
30 | - 四角
31 | - 下線
32 | - 縦線
33 |
34 |
35 |
36 | - 4 x 8ピクセル
37 | - 6 pt
38 | - 7 pt
39 | - 8 pt
40 | - 9 pt
41 | - 10 pt
42 | - 12 pt
43 | - 14 pt
44 | - 16 pt
45 | - 20 pt
46 |
47 |
48 |
49 | - 白背景に黒字
50 | - 黒背景に白字
51 | - 青背景に白字
52 | - 黒背景に緑字
53 | - 黒背景にアンバー字
54 | - 黒背景に赤字
55 |
56 |
57 |
58 | - トラックボール
59 | - \@キー
60 | - 左Altキー
61 | - 右Altキー
62 | - ボリュームアップ
63 | - ボリュームダウン
64 |
65 |
66 |
67 | - 文字ベース
68 | - 単語ベース
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/res/values-ja/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 | 端末エミュレータ
19 | 設定
20 | 端末をリセット
21 | メール送信
22 | 特殊キー
23 | ソフトキーボード
24 |
25 | テキスト編集
26 | すべてコピー
27 | 貼付け
28 |
29 |
30 | スクリーン
31 |
32 | ステータスバー
33 | ステータスバーの表示/非表示
34 | ステータスバー
35 |
36 | カーソルのスタイル
37 | カーソルスタイルの選択
38 | カーソルスタイル
39 |
40 | カーソルの点滅
41 | カーソルの点滅を選択
42 | カーソルの点滅
43 |
44 | テキスト
45 |
46 | フォントサイズ
47 | 文字の高さと大きさを選択
48 | Font size
49 |
50 | 色
51 | 文字の色を選択
52 | 文字の色
53 |
54 | キーボード
55 |
56 | コントロールキー
57 | コントロールキーを選択
58 | コントロールキー
59 |
60 | インプットメソッド
61 | ソフトキーボードのインプットメソッドを選択
62 | インプットメソッド
63 |
64 | シェル
65 | コマンドライン
66 | コマンドラインシェルを指定
67 | シェル
68 |
69 | 初期コマンド
70 | 開始時、シェルにコマンドを送信する
71 | 初期コマンド
72 |
73 |
74 |
--------------------------------------------------------------------------------
/res/values-ru/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | - Показывать
21 | - Скрывать
22 |
23 |
24 |
25 | - 4 x 8 пикселей
26 | - 6 pt
27 | - 7 pt
28 | - 8 pt
29 | - 9 pt
30 | - 10 pt
31 | - 12 pt
32 | - 14 pt
33 | - 16 pt
34 | - 20 pt
35 |
36 |
37 |
38 | - Чёрный на белом
39 | - Белый на чёрном
40 | - Белый на синем
41 | - Зелёный на чёрном
42 | - Жёлтый на чёрном
43 | - Красный на чёрном
44 |
45 |
46 |
47 | - Jog ball
48 | - Клавиша \@
49 | - Левый Alt
50 | - Правый Alt
51 | - Громкость вверх
52 | - Громкость вниз
53 |
54 |
55 |
56 | - По знакам
57 | - По словам
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/res/values-ru/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 | Эмулятор Терминала
19 | Настройки
20 | Сбросить терм.
21 | Отправит Email
22 | Специальные клавиши
23 | Экранная клавиатура
24 | Изменить
25 | Копировать всё
26 | Вставить
27 | Экран
28 | Статус бар
29 | Показать/Скрыть статус бар.
30 | Статус бар
31 | Текст
32 | Размер шрифта
33 | Выберите размер шрифта.
34 | Размер шрифта
35 | Цвета
36 | Выберите цвет текста.
37 | Цвет текста
38 | Клавиатура
39 | Клавиша Control
40 | Выберите что будет клавишей Control.
41 | Клавиша Control
42 | Способ ввода
43 | Выберите способ ввода для экранной клавиатуры.
44 | Способ ввода
45 | Командная оболочка
46 | Командная строка
47 | Укажите строку обращения к командной оболочки.
48 | Оболочка
49 | Команды запуска
50 | Передаются облочке при запуске терминала.
51 | Команды запуска
52 |
53 |
--------------------------------------------------------------------------------
/res/values-zh-rCN/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 | 终端模拟器
19 | 首选项
20 | 重置终端
21 | 发送电子邮件到...
22 | 特殊键
23 | 打开/关闭软键盘
24 |
25 | 编辑文本
26 | 全部复制
27 | 粘贴
28 |
29 |
30 | 屏幕
31 |
32 | 状态栏
33 | 显示/隐藏状态栏。
34 | 状态栏
35 |
36 | 光标样式
37 | 选择光标样式
38 | 光标样式
39 |
40 | 光标闪烁
41 | 选择光标闪烁模式
42 | 光标闪烁
43 |
44 | 文本
45 |
46 | 文本大小
47 | 选择文本大小
48 | 文本大小
49 |
50 | 颜色
51 | 选择文本颜色
52 | 文本颜色
53 |
54 | 键盘
55 |
56 | Ctrl 键
57 | 设置 Ctrl 键
58 | Ctrl 键
59 |
60 | 输入方式
61 | 选择输入方式或软键盘
62 | 输入方式
63 |
64 | Shell
65 | 命令行
66 | 指定命令行使用的 Shell
67 | Shell
68 |
69 | 初始命令
70 | 启动 Shell 时自动执行的命令
71 | 初始命令
72 |
73 |
74 |
--------------------------------------------------------------------------------
/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | - Show status bar
21 | - Hide status bar
22 |
23 |
24 |
25 |
26 | - 1
27 | - 0
28 |
29 |
30 |
31 | - Non-blinking cursor
32 | - Blinking cursor
33 |
34 |
35 |
36 |
37 | - 0
38 | - 1
39 |
40 |
41 |
42 | - Rectangle
43 | - Underline
44 | - Vertical bar
45 |
46 |
47 |
48 |
49 | - 0
50 | - 1
51 | - 2
52 |
53 |
54 |
55 | - 4 x 8 pixels
56 | - 6 pt
57 | - 7 pt
58 | - 8 pt
59 | - 9 pt
60 | - 10 pt
61 | - 12 pt
62 | - 14 pt
63 | - 16 pt
64 | - 20 pt
65 |
66 |
67 |
68 |
69 | - 0
70 | - 6
71 | - 7
72 | - 8
73 | - 9
74 | - 10
75 | - 12
76 | - 14
77 | - 16
78 | - 20
79 |
80 |
81 |
82 | - Black text on white
83 | - White text on black
84 | - White text on blue
85 | - Green text on black
86 | - Amber text on black
87 | - Red text on black
88 |
89 |
90 |
91 |
92 | - 0
93 | - 1
94 | - 2
95 | - 3
96 | - 4
97 | - 5
98 |
99 |
100 |
101 | - Jog ball
102 | - \@ key
103 | - Left Alt key
104 | - Right Alt key
105 | - Vol Up key
106 | - Vol Down key
107 |
108 |
109 |
110 |
111 | - 0
112 | - 1
113 | - 2
114 | - 3
115 | - 4
116 | - 5
117 |
118 |
119 |
120 | - Character-based
121 | - Word-based
122 |
123 |
124 |
125 |
126 | - 0
127 | - 1
128 |
129 |
130 |
--------------------------------------------------------------------------------
/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 | Terminal Emulator
19 | Preferences
20 | Reset term
21 | Email to
22 | Special keys
23 | Toggle soft keyboard
24 |
25 | Edit text
26 | Select text
27 | Copy all
28 | Paste
29 |
30 |
31 | Screen
32 |
33 | Status bar
34 | Show/hide status bar.
35 | Status bar
36 |
37 | Cursor style
38 | Choose cursor style.
39 | Cursor style
40 |
41 | Cursor blink
42 | Choose cursor blink.
43 | Cursor blink
44 |
45 | Text
46 |
47 | Font size
48 | Choose character height in points.
49 | Font size
50 |
51 | Colors
52 | Choose text color.
53 | Text color
54 |
55 | Keyboard
56 |
57 | Control key
58 | Choose control key.
59 | Control key
60 |
61 | Input method
62 | Choose input method for soft keyboard.
63 | Input method
64 |
65 | Shell
66 | Command line
67 | Specify the shell command line.
68 | Shell
69 |
70 | Initial command
71 | Sent to the shell when it starts.
72 | Initial Command
73 |
74 |
75 | 0
76 | 0
77 | 0
78 | 10
79 | 2
80 | 0
81 | 0
82 | /system/bin/sh -
83 | export PATH=/data/local/bin:$PATH
84 |
85 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/res/xml/preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
20 |
22 |
23 |
31 |
32 |
33 |
52 |
53 |
54 |
55 |
57 |
58 |
66 |
67 |
75 |
76 |
77 |
78 |
80 |
81 |
89 |
90 |
98 |
99 |
100 |
101 |
103 |
104 |
110 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/src/jackpal/androidterm/Exec.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package jackpal.androidterm2;
18 |
19 | import java.io.FileDescriptor;
20 |
21 | /**
22 | * Utility methods for creating and managing a subprocess.
23 | *
24 | * Note: The native methods access a package-private
25 | * java.io.FileDescriptor field to get and set the raw Linux
26 | * file descriptor. This might break if the implementation of
27 | * java.io.FileDescriptor is changed.
28 | */
29 |
30 | public class Exec
31 | {
32 | static {
33 | System.loadLibrary("androidterm2");
34 | }
35 |
36 | /**
37 | * Create a subprocess. Differs from java.lang.ProcessBuilder in
38 | * that a pty is used to communicate with the subprocess.
39 | *
40 | * Callers are responsible for calling Exec.close() on the returned
41 | * file descriptor.
42 | *
43 | * @param cmd The command to execute
44 | * @param arg0 The first argument to the command, may be null
45 | * @param arg1 the second argument to the command, may be null
46 | * @param processId A one-element array to which the process ID of the
47 | * started process will be written.
48 | * @return the file descriptor of the started process.
49 | *
50 | */
51 | public static native FileDescriptor createSubprocess(
52 | String cmd, String arg0, String arg1, int[] processId);
53 |
54 | /**
55 | * Set the widow size for a given pty. Allows programs
56 | * connected to the pty learn how large their screen is.
57 | */
58 | public static native void setPtyWindowSize(FileDescriptor fd,
59 | int row, int col, int xpixel, int ypixel);
60 |
61 | /**
62 | * Causes the calling thread to wait for the process associated with the
63 | * receiver to finish executing.
64 | *
65 | * @return The exit value of the Process being waited on
66 | *
67 | */
68 | public static native int waitFor(int processId);
69 |
70 | /**
71 | * Close a given file descriptor.
72 | */
73 | public static native void close(FileDescriptor fd);
74 | }
75 |
76 |
--------------------------------------------------------------------------------
/src/jackpal/androidterm/TermPreferences.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package jackpal.androidterm2;
18 |
19 | import android.os.Bundle;
20 | import android.preference.PreferenceActivity;
21 |
22 | public class TermPreferences extends PreferenceActivity {
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 |
28 | // Load the preferences from an XML resource
29 | addPreferencesFromResource(R.xml.preferences);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------