├── .gitignore ├── Android.mk ├── AndroidManifest.xml ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── README.md ├── README.txt ├── default.properties ├── docs ├── Building.txt └── Market Icon.psd ├── jni ├── Android.mk └── termExec.cpp ├── res ├── drawable-hdpi │ ├── app_terminal.png │ └── atari_small.png ├── drawable-mdpi │ ├── app_terminal.png │ └── atari_small.png ├── drawable │ └── atari_small_notice.txt ├── layout │ └── term_activity.xml ├── menu │ └── main.xml ├── values-de │ ├── arrays.xml │ └── strings.xml ├── values-fr │ ├── arrays.xml │ └── strings.xml ├── values-it │ ├── arrays.xml │ └── strings.xml ├── values-ja │ ├── arrays.xml │ └── strings.xml ├── values-ru │ ├── arrays.xml │ └── strings.xml ├── values-zh-rCN │ └── strings.xml ├── values │ ├── arrays.xml │ ├── attrs.xml │ ├── strings.xml │ └── styles.xml └── xml │ └── preferences.xml └── src └── jackpal └── androidterm ├── Exec.java ├── Term.java └── TermPreferences.java /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | gen/ 3 | libs/ 4 | obj/ 5 | .classpath 6 | .project 7 | .settings/ 8 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 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 | # This makefile shows how to build a shared library and an activity that 18 | # bundles the shared library and calls it using JNI. 19 | 20 | TOP_LOCAL_PATH:= $(call my-dir) 21 | 22 | # Build activity 23 | 24 | LOCAL_PATH:= $(call my-dir) 25 | include $(CLEAR_VARS) 26 | 27 | LOCAL_MODULE_TAGS := optional 28 | 29 | LOCAL_SRC_FILES := $(call all-subdir-java-files) 30 | 31 | LOCAL_PACKAGE_NAME := AndroidTerm 32 | 33 | LOCAL_OVERRIDES_PACKAGES := Term 34 | 35 | LOCAL_REQUIRED_MODULES := libandroidterm2 36 | 37 | include $(BUILD_PACKAGE) 38 | 39 | # ============================================================ 40 | 41 | # Also build all of the sub-targets under this one: the shared library. 42 | include $(call all-makefiles-under,$(LOCAL_PATH)) 43 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_AndroidTerm/c6c01efece222a72e5fd541cd741948f22495dab/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2005-2008, 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 | 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | 13 | 14 | Apache License 15 | Version 2.0, January 2004 16 | http://www.apache.org/licenses/ 17 | 18 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 19 | 20 | 1. Definitions. 21 | 22 | "License" shall mean the terms and conditions for use, reproduction, 23 | and distribution as defined by Sections 1 through 9 of this document. 24 | 25 | "Licensor" shall mean the copyright owner or entity authorized by 26 | the copyright owner that is granting the License. 27 | 28 | "Legal Entity" shall mean the union of the acting entity and all 29 | other entities that control, are controlled by, or are under common 30 | control with that entity. For the purposes of this definition, 31 | "control" means (i) the power, direct or indirect, to cause the 32 | direction or management of such entity, whether by contract or 33 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 34 | outstanding shares, or (iii) beneficial ownership of such entity. 35 | 36 | "You" (or "Your") shall mean an individual or Legal Entity 37 | exercising permissions granted by this License. 38 | 39 | "Source" form shall mean the preferred form for making modifications, 40 | including but not limited to software source code, documentation 41 | source, and configuration files. 42 | 43 | "Object" form shall mean any form resulting from mechanical 44 | transformation or translation of a Source form, including but 45 | not limited to compiled object code, generated documentation, 46 | and conversions to other media types. 47 | 48 | "Work" shall mean the work of authorship, whether in Source or 49 | Object form, made available under the License, as indicated by a 50 | copyright notice that is included in or attached to the work 51 | (an example is provided in the Appendix below). 52 | 53 | "Derivative Works" shall mean any work, whether in Source or Object 54 | form, that is based on (or derived from) the Work and for which the 55 | editorial revisions, annotations, elaborations, or other modifications 56 | represent, as a whole, an original work of authorship. For the purposes 57 | of this License, Derivative Works shall not include works that remain 58 | separable from, or merely link (or bind by name) to the interfaces of, 59 | the Work and Derivative Works thereof. 60 | 61 | "Contribution" shall mean any work of authorship, including 62 | the original version of the Work and any modifications or additions 63 | to that Work or Derivative Works thereof, that is intentionally 64 | submitted to Licensor for inclusion in the Work by the copyright owner 65 | or by an individual or Legal Entity authorized to submit on behalf of 66 | the copyright owner. For the purposes of this definition, "submitted" 67 | means any form of electronic, verbal, or written communication sent 68 | to the Licensor or its representatives, including but not limited to 69 | communication on electronic mailing lists, source code control systems, 70 | and issue tracking systems that are managed by, or on behalf of, the 71 | Licensor for the purpose of discussing and improving the Work, but 72 | excluding communication that is conspicuously marked or otherwise 73 | designated in writing by the copyright owner as "Not a Contribution." 74 | 75 | "Contributor" shall mean Licensor and any individual or Legal Entity 76 | on behalf of whom a Contribution has been received by Licensor and 77 | subsequently incorporated within the Work. 78 | 79 | 2. Grant of Copyright License. Subject to the terms and conditions of 80 | this License, each Contributor hereby grants to You a perpetual, 81 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 82 | copyright license to reproduce, prepare Derivative Works of, 83 | publicly display, publicly perform, sublicense, and distribute the 84 | Work and such Derivative Works in Source or Object form. 85 | 86 | 3. Grant of Patent License. Subject to the terms and conditions of 87 | this License, each Contributor hereby grants to You a perpetual, 88 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 89 | (except as stated in this section) patent license to make, have made, 90 | use, offer to sell, sell, import, and otherwise transfer the Work, 91 | where such license applies only to those patent claims licensable 92 | by such Contributor that are necessarily infringed by their 93 | Contribution(s) alone or by combination of their Contribution(s) 94 | with the Work to which such Contribution(s) was submitted. If You 95 | institute patent litigation against any entity (including a 96 | cross-claim or counterclaim in a lawsuit) alleging that the Work 97 | or a Contribution incorporated within the Work constitutes direct 98 | or contributory patent infringement, then any patent licenses 99 | granted to You under this License for that Work shall terminate 100 | as of the date such litigation is filed. 101 | 102 | 4. Redistribution. You may reproduce and distribute copies of the 103 | Work or Derivative Works thereof in any medium, with or without 104 | modifications, and in Source or Object form, provided that You 105 | meet the following conditions: 106 | 107 | (a) You must give any other recipients of the Work or 108 | Derivative Works a copy of this License; and 109 | 110 | (b) You must cause any modified files to carry prominent notices 111 | stating that You changed the files; and 112 | 113 | (c) You must retain, in the Source form of any Derivative Works 114 | that You distribute, all copyright, patent, trademark, and 115 | attribution notices from the Source form of the Work, 116 | excluding those notices that do not pertain to any part of 117 | the Derivative Works; and 118 | 119 | (d) If the Work includes a "NOTICE" text file as part of its 120 | distribution, then any Derivative Works that You distribute must 121 | include a readable copy of the attribution notices contained 122 | within such NOTICE file, excluding those notices that do not 123 | pertain to any part of the Derivative Works, in at least one 124 | of the following places: within a NOTICE text file distributed 125 | as part of the Derivative Works; within the Source form or 126 | documentation, if provided along with the Derivative Works; or, 127 | within a display generated by the Derivative Works, if and 128 | wherever such third-party notices normally appear. The contents 129 | of the NOTICE file are for informational purposes only and 130 | do not modify the License. You may add Your own attribution 131 | notices within Derivative Works that You distribute, alongside 132 | or as an addendum to the NOTICE text from the Work, provided 133 | that such additional attribution notices cannot be construed 134 | as modifying the License. 135 | 136 | You may add Your own copyright statement to Your modifications and 137 | may provide additional or different license terms and conditions 138 | for use, reproduction, or distribution of Your modifications, or 139 | for any such Derivative Works as a whole, provided Your use, 140 | reproduction, and distribution of the Work otherwise complies with 141 | the conditions stated in this License. 142 | 143 | 5. Submission of Contributions. Unless You explicitly state otherwise, 144 | any Contribution intentionally submitted for inclusion in the Work 145 | by You to the Licensor shall be under the terms and conditions of 146 | this License, without any additional terms or conditions. 147 | Notwithstanding the above, nothing herein shall supersede or modify 148 | the terms of any separate license agreement you may have executed 149 | with Licensor regarding such Contributions. 150 | 151 | 6. Trademarks. This License does not grant permission to use the trade 152 | names, trademarks, service marks, or product names of the Licensor, 153 | except as required for reasonable and customary use in describing the 154 | origin of the Work and reproducing the content of the NOTICE file. 155 | 156 | 7. Disclaimer of Warranty. Unless required by applicable law or 157 | agreed to in writing, Licensor provides the Work (and each 158 | Contributor provides its Contributions) on an "AS IS" BASIS, 159 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 160 | implied, including, without limitation, any warranties or conditions 161 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 162 | PARTICULAR PURPOSE. You are solely responsible for determining the 163 | appropriateness of using or redistributing the Work and assume any 164 | risks associated with Your exercise of permissions under this License. 165 | 166 | 8. Limitation of Liability. In no event and under no legal theory, 167 | whether in tort (including negligence), contract, or otherwise, 168 | unless required by applicable law (such as deliberate and grossly 169 | negligent acts) or agreed to in writing, shall any Contributor be 170 | liable to You for damages, including any direct, indirect, special, 171 | incidental, or consequential damages of any character arising as a 172 | result of this License or out of the use or inability to use the 173 | Work (including but not limited to damages for loss of goodwill, 174 | work stoppage, computer failure or malfunction, or any and all 175 | other commercial damages or losses), even if such Contributor 176 | has been advised of the possibility of such damages. 177 | 178 | 9. Accepting Warranty or Additional Liability. While redistributing 179 | the Work or Derivative Works thereof, You may choose to offer, 180 | and charge a fee for, acceptance of support, warranty, indemnity, 181 | or other liability obligations and/or rights consistent with this 182 | License. However, in accepting such obligations, You may act only 183 | on Your own behalf and on Your sole responsibility, not on behalf 184 | of any other Contributor, and only if You agree to indemnify, 185 | defend, and hold each Contributor harmless for any liability 186 | incurred by, or claims asserted against, such Contributor by reason 187 | of your accepting any such warranty or additional liability. 188 | 189 | END OF TERMS AND CONDITIONS 190 | 191 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Android Terminal Emulator 2 | 3 | Android Terminal Emulator is a terminal emulator for communicating with the built-in Android shell. Emulates a reasonably large subset of Digital Equipment Corporation VT-100 terminal codes, so that programs like "vi", "Emacs" and "NetHack" will display properly. 4 | 5 | This code is based on the "Term" application which is included in the Android source code release. It's provided as a separate project for the convenience of developers who do not want to deal with installing and building the whole Android source tree. 6 | 7 | Although this program does not include a built-in ssh client, it can be used with command-line-based ssh tools such as dropbear. 8 | 9 | Got questions? Please check out the [FAQ](http://github.com/jackpal/Android-Terminal-Emulator/wiki/Frequently-Asked-Questions) before emailing or adding an issue. Thanks! 10 | 11 | Please see the [Recent Updates](http://github.com/jackpal/Android-Terminal-Emulator/wiki/Recent-Updates) 12 | page for recent updates. -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | This is an Android Terminal emulator. It enables you to access your Android 2 | device's built-in command-line shell. 3 | 4 | This terminal emulator emulates Digital Equipment Corporation VT-100 terminal 5 | escape codes. It is designed to be used with command-line programs and 6 | curses-based applications like vi, emacs, nethack, and dropbear ssh. 7 | 8 | Features: 9 | 10 | + Connects to your Android device's built-in command-line shell. 11 | + Comprehensive VT100 terminal emulation. 12 | + Supports a range of font sizes 13 | + Supports several choices of text and background color. 14 | + 1000-line transcript buffer. 15 | + Can send transcript as an email message. 16 | 17 | FAQ: 18 | 19 | + What can I do with this? 20 | 21 | A you can run and control command-line applications on your Android device. 22 | 23 | + Why would I want to do that? 24 | 25 | For fun! There are a wealth of Linux utility programs that can be made to work 26 | on Android, and this terminal emulator provides a good way of interacting with 27 | them. 28 | 29 | + Does this application give me "root" access? 30 | 31 | No, it doesn't. It runs as an ordinary application, with no special access 32 | rights. 33 | 34 | + How can I build this? 35 | Build instructions can be found in the docs directory. 36 | -------------------------------------------------------------------------------- /default.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "build.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-4 12 | -------------------------------------------------------------------------------- /docs/Building.txt: -------------------------------------------------------------------------------- 1 | Obtain the Software Needed to Build Android Term 2 | ------------------------------------------------ 3 | 4 | Android is built using the Android SDK r08 or newer and the Android NDK r5 or newer. 5 | You can downlaod them from: 6 | 7 | http://developer.android.com/sdk 8 | 9 | You will also need Eclipse 3.4 or newer, Java version, available from: 10 | 11 | http://eclipse.org 12 | 13 | After you install the SDK and the NDK, please build some of the samples that 14 | come with the NDK in order to get a feel for using the SDK and the NDK. 15 | 16 | Building Android Term 17 | --------------------- 18 | 19 | There are three parts to building Android Term: 20 | 21 | 1) Build the shared library 22 | 2) Create the Eclipse Project for the Application 23 | 3) Build the Java apk. 24 | 25 | Build the shared library: 26 | 27 | cd 28 | /ndk-build 29 | 30 | (Be sure to use the actual pathnames from your system. For example, 31 | on my system I actually type the following: 32 | 33 | cd ~/code/androidterm 34 | ../android-ndk-r5/ndk-build 35 | 36 | This should chug away for a while and ultimately produce the file 37 | 38 | libs/armeabi/libandroidterm.so 39 | 40 | Create the Eclipse project: 41 | 42 | Start Eclipse 43 | From the menu choose File : New Project 44 | Choose Android:Android Project as a project type 45 | Press Next 46 | Set Project Name: AndroidTerm 47 | Choose "Create project from existing source" 48 | Browse to the location of the AndroidTerm source directory. 49 | Make sure the "Android 1.6" Target Name is checked. 50 | Make sure the Min SDK Version is 4 51 | Press Finish 52 | 53 | NOTE: When you Press Finish you may get the following error 54 | 55 | Invalid project description. 56 | overlaps the location of another 57 | project: '' 58 | 59 | This seems to be due to a bug in the Android SDK, where it 60 | can't import projects that are located in the Eclipse "workspace" 61 | directory. The work-around is to move the androidterm project 62 | directory to a different location on your file system, so 63 | that it is _not_ in the Eclipse "workspace" directory. 64 | 65 | Build the Java apk: 66 | 67 | This should happen automatically once you've created the Eclipse project. 68 | 69 | -------------------------------------------------------------------------------- /docs/Market Icon.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CyanogenMod/android_packages_apps_AndroidTerm/c6c01efece222a72e5fd541cd741948f22495dab/docs/Market Icon.psd -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 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 | # This makefile supplies the rules for building a library of JNI code for 18 | # use by our example of how to bundle a shared library with an APK. 19 | 20 | LOCAL_PATH:= $(call my-dir) 21 | include $(CLEAR_VARS) 22 | 23 | LOCAL_MODULE_TAGS := optional 24 | 25 | # This is the target being built. 26 | LOCAL_MODULE:= libandroidterm2 27 | 28 | 29 | # All of the source files that we will compile. 30 | LOCAL_SRC_FILES:= \ 31 | termExec.cpp 32 | 33 | # All of the shared libraries we link against. 34 | LOCAL_SHARED_LIBRARIES := \ 35 | libutils 36 | 37 | # No static libraries. 38 | LOCAL_STATIC_LIBRARIES := 39 | 40 | # Also need the JNI headers. 41 | LOCAL_C_INCLUDES += \ 42 | $(JNI_H_INCLUDE) 43 | 44 | # No special compiler flags. 45 | LOCAL_CFLAGS += 46 | 47 | # Don't prelink this library. For more efficient code, you may want 48 | # to add this library to the prelink map and set this to true. However, 49 | # it's difficult to do this for applications that are not supplied as 50 | # part of a system image. 51 | 52 | LOCAL_PRELINK_MODULE := false 53 | 54 | include $(BUILD_SHARED_LIBRARY) 55 | -------------------------------------------------------------------------------- /jni/termExec.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 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 | /* 18 | * Copyright (C) 2007 The Android Open Source Project 19 | * 20 | * Licensed under the Apache License, Version 2.0 (the "License"); 21 | * you may not use this file except in compliance with the License. 22 | * You may obtain a copy of the License at 23 | * 24 | * http://www.apache.org/licenses/LICENSE-2.0 25 | * 26 | * Unless required by applicable law or agreed to in writing, software 27 | * distributed under the License is distributed on an "AS IS" BASIS, 28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | * See the License for the specific language governing permissions and 30 | * limitations under the License. 31 | */ 32 | 33 | #define LOG_TAG "Exec" 34 | 35 | #include "jni.h" 36 | #include 37 | 38 | #define LOGI(...) do { __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__); } while(0) 39 | #define LOGW(...) do { __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__); } while(0) 40 | #define LOGE(...) do { __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__); } while(0) 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | static jclass class_fileDescriptor; 52 | static jfieldID field_fileDescriptor_descriptor; 53 | static jmethodID method_fileDescriptor_init; 54 | 55 | typedef unsigned short char16_t; 56 | 57 | class String8 { 58 | public: 59 | String8() { 60 | mString = 0; 61 | } 62 | 63 | ~String8() { 64 | if (mString) { 65 | free(mString); 66 | } 67 | } 68 | 69 | void set(const char16_t* o, size_t numChars) { 70 | if (mString) { 71 | free(mString); 72 | } 73 | mString = (char*) malloc(numChars + 1); 74 | for (size_t i = 0; i < numChars; i++) { 75 | mString[i] = (char) o[i]; 76 | } 77 | mString[numChars] = '\0'; 78 | } 79 | 80 | const char* string() { 81 | return mString; 82 | } 83 | private: 84 | char* mString; 85 | }; 86 | 87 | static int create_subprocess(const char *cmd, const char *arg0, const char *arg1, 88 | int* pProcessId) 89 | { 90 | char *devname; 91 | int ptm; 92 | pid_t pid; 93 | 94 | ptm = open("/dev/ptmx", O_RDWR); // | O_NOCTTY); 95 | if(ptm < 0){ 96 | LOGE("[ cannot open /dev/ptmx - %s ]\n",strerror(errno)); 97 | return -1; 98 | } 99 | fcntl(ptm, F_SETFD, FD_CLOEXEC); 100 | 101 | if(grantpt(ptm) || unlockpt(ptm) || 102 | ((devname = (char*) ptsname(ptm)) == 0)){ 103 | LOGE("[ trouble with /dev/ptmx - %s ]\n", strerror(errno)); 104 | return -1; 105 | } 106 | 107 | pid = fork(); 108 | if(pid < 0) { 109 | LOGE("- fork failed: %s -\n", strerror(errno)); 110 | return -1; 111 | } 112 | 113 | if(pid == 0){ 114 | close(ptm); 115 | 116 | int pts; 117 | 118 | setsid(); 119 | 120 | pts = open(devname, O_RDWR); 121 | if(pts < 0) exit(-1); 122 | 123 | dup2(pts, 0); 124 | dup2(pts, 1); 125 | dup2(pts, 2); 126 | 127 | execl(cmd, cmd, arg0, arg1, NULL); 128 | exit(-1); 129 | } else { 130 | *pProcessId = (int) pid; 131 | return ptm; 132 | } 133 | } 134 | 135 | 136 | static jobject android_os_Exec_createSubProcess(JNIEnv *env, jobject clazz, 137 | jstring cmd, jstring arg0, jstring arg1, jintArray processIdArray) 138 | { 139 | const jchar* str = cmd ? env->GetStringCritical(cmd, 0) : 0; 140 | String8 cmd_8; 141 | if (str) { 142 | cmd_8.set(str, env->GetStringLength(cmd)); 143 | env->ReleaseStringCritical(cmd, str); 144 | } 145 | 146 | str = arg0 ? env->GetStringCritical(arg0, 0) : 0; 147 | const char* arg0Str = 0; 148 | String8 arg0_8; 149 | if (str) { 150 | arg0_8.set(str, env->GetStringLength(arg0)); 151 | env->ReleaseStringCritical(arg0, str); 152 | arg0Str = arg0_8.string(); 153 | } 154 | 155 | str = arg1 ? env->GetStringCritical(arg1, 0) : 0; 156 | const char* arg1Str = 0; 157 | String8 arg1_8; 158 | if (str) { 159 | arg1_8.set(str, env->GetStringLength(arg1)); 160 | env->ReleaseStringCritical(arg1, str); 161 | arg1Str = arg1_8.string(); 162 | } 163 | 164 | int procId; 165 | int ptm = create_subprocess(cmd_8.string(), arg0Str, arg1Str, &procId); 166 | 167 | if (processIdArray) { 168 | int procIdLen = env->GetArrayLength(processIdArray); 169 | if (procIdLen > 0) { 170 | jboolean isCopy; 171 | 172 | int* pProcId = (int*) env->GetPrimitiveArrayCritical(processIdArray, &isCopy); 173 | if (pProcId) { 174 | *pProcId = procId; 175 | env->ReleasePrimitiveArrayCritical(processIdArray, pProcId, 0); 176 | } 177 | } 178 | } 179 | 180 | jobject result = env->NewObject(class_fileDescriptor, method_fileDescriptor_init); 181 | 182 | if (!result) { 183 | LOGE("Couldn't create a FileDescriptor."); 184 | } 185 | else { 186 | env->SetIntField(result, field_fileDescriptor_descriptor, ptm); 187 | } 188 | 189 | return result; 190 | } 191 | 192 | 193 | static void android_os_Exec_setPtyWindowSize(JNIEnv *env, jobject clazz, 194 | jobject fileDescriptor, jint row, jint col, jint xpixel, jint ypixel) 195 | { 196 | int fd; 197 | struct winsize sz; 198 | 199 | fd = env->GetIntField(fileDescriptor, field_fileDescriptor_descriptor); 200 | 201 | if (env->ExceptionOccurred() != NULL) { 202 | return; 203 | } 204 | 205 | sz.ws_row = row; 206 | sz.ws_col = col; 207 | sz.ws_xpixel = xpixel; 208 | sz.ws_ypixel = ypixel; 209 | 210 | ioctl(fd, TIOCSWINSZ, &sz); 211 | } 212 | 213 | static int android_os_Exec_waitFor(JNIEnv *env, jobject clazz, 214 | jint procId) { 215 | int status; 216 | waitpid(procId, &status, 0); 217 | int result = 0; 218 | if (WIFEXITED(status)) { 219 | result = WEXITSTATUS(status); 220 | } 221 | return result; 222 | } 223 | 224 | static void android_os_Exec_close(JNIEnv *env, jobject clazz, jobject fileDescriptor) 225 | { 226 | int fd; 227 | struct winsize sz; 228 | 229 | fd = env->GetIntField(fileDescriptor, field_fileDescriptor_descriptor); 230 | 231 | if (env->ExceptionOccurred() != NULL) { 232 | return; 233 | } 234 | 235 | close(fd); 236 | } 237 | 238 | 239 | static int register_FileDescriptor(JNIEnv *env) 240 | { 241 | class_fileDescriptor = env->FindClass("java/io/FileDescriptor"); 242 | 243 | if (class_fileDescriptor == NULL) { 244 | LOGE("Can't find java/io/FileDescriptor"); 245 | return -1; 246 | } 247 | 248 | field_fileDescriptor_descriptor = env->GetFieldID(class_fileDescriptor, "descriptor", "I"); 249 | 250 | if (field_fileDescriptor_descriptor == NULL) { 251 | LOGE("Can't find FileDescriptor.descriptor"); 252 | return -1; 253 | } 254 | 255 | method_fileDescriptor_init = env->GetMethodID(class_fileDescriptor, "", "()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 | 19 | 21 | 23 | 25 | 27 | 29 | 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 | --------------------------------------------------------------------------------