Skip to content

Commit

Permalink
Merge branch 'master' into dvhhVariant
Browse files Browse the repository at this point in the history
Conflicts:
	term/src/main/java/jackpal/androidterm/TermViewFlipper.java
	term/src/main/java/jackpal/androidterm/util/TermSettings.java
	term/src/main/res/values/defaults.xml
	term/src/main/res/values/strings.xml
	term/src/main/res/xml/preferences.xml
  • Loading branch information
dvhh committed Apr 16, 2015
2 parents 65e9138 + 3b80483 commit 29fef60
Show file tree
Hide file tree
Showing 20 changed files with 278 additions and 315 deletions.
4 changes: 2 additions & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#Terminal Emulator for Android

*Note:* Terminal Emulator for Android development is complete. I am not
accepting pull requests any more.

Terminal Emulator for Android is a terminal emulator for communicating with the
built-in Android shell. It emulates a reasonably large subset of Digital
Equipment Corporation VT-100 terminal codes, so that programs like "vi", "Emacs"
Expand Down Expand Up @@ -27,9 +30,3 @@ before emailing or adding an issue. Thanks!
Please see the
[Recent Updates](http://github.com/jackpal/Android-Terminal-Emulator/wiki/Recent-Updates)
page for recent updates.

Note: Terminal Emulator for Android development is complete. I am still
accepting new language translations and bug fixes, but I am not accepting new
features. See [Wrapping up Development on Terminal Emulator for Android]
(https://github.com/jackpal/Android-Terminal-Emulator/wiki/Wrapping-up-Development-on-Android-Terminal-Emulator)
for details of the wrapping-up process.
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
task wrapper (type:Wrapper) {
gradleVersion = '2.2.1'
distributionUrl = 'https://services.gradle.org/distributions/gradle-2.2.1-all.zip'
}

buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
}
}

Expand All @@ -13,3 +20,12 @@ allprojects {
jcenter()
}
}

subprojects {
def androidHome

if ((androidHome = System.env.'ANDROID_HOME')
&& (androidHome = androidHome as File).exists()
&& androidHome.canWrite())
apply plugin: 'android-sdk-manager'
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewParent;
import android.view.inputmethod.BaseInputConnection;
import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.CorrectionInfo;
Expand Down Expand Up @@ -1123,7 +1122,7 @@ private void sendMouseEventCode(MotionEvent e, int button_code) {
x > 255-32 || y > 255-32;
//Log.d(TAG, "mouse button "+x+","+y+","+button_code+",oob="+out_of_bounds);
if(button_code < 0 || button_code > 255-32) {
Log.e(TAG, "mouse button_code out of range: " + button_code);
Log.e(TAG, "mouse button_code out of range: "+button_code);
return;
}
if(!out_of_bounds) {
Expand Down Expand Up @@ -1495,8 +1494,8 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
}

private void updateSize(int w, int h) {
mColumns = Math.max(1, (int) Math.floor(((float) w) / mCharacterWidth));
mVisibleColumns = Math.max(1, (int) Math.floor(((float) mVisibleWidth) / mCharacterWidth));
mColumns = Math.max(1, (int) (((float) w) / mCharacterWidth));
mVisibleColumns = Math.max(1, (int) (((float) mVisibleWidth) / mCharacterWidth));

mTopOfScreenMargin = mTextRenderer.getTopMargin();
mRows = Math.max(1, (h - mTopOfScreenMargin) / mCharacterHeight);
Expand All @@ -1520,18 +1519,9 @@ public void updateSize(boolean force) {
//Need to clear saved links on each display refresh
mLinkLayer.clear();
if (mKnownSize) {

int w = getWidth() - getPaddingLeft() -getPaddingRight();
int h = getHeight() -getPaddingTop() -getPaddingBottom();
ViewParent parent=getParent();
while(parent instanceof View) {
w -= ((View) parent).getPaddingLeft() + ((View) parent).getPaddingRight();
h -= ((View) parent).getPaddingTop() + ((View) parent).getPaddingBottom();
parent = ((View)parent).getParent();
}

//Log.w("Term", "(" + w + ", " + h + ")");

int w = getWidth();
int h = getHeight();
// Log.w("Term", "(" + w + ", " + h + ")");
if (force || w != mVisibleWidth || h != mVisibleHeight) {
mVisibleWidth = w;
mVisibleHeight = h;
Expand Down Expand Up @@ -1747,5 +1737,4 @@ public String getURLat(float x, float y)
else
return null;
}

}
4 changes: 2 additions & 2 deletions term/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jackpal.androidterm"
android:versionName="1.0.69"
android:versionCode="70"
android:versionName="1.0.70"
android:versionCode="71"
android:installLocation="auto">
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
Expand Down
16 changes: 15 additions & 1 deletion term/src/main/java/jackpal/androidterm/BoundSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import android.text.TextUtils;
import jackpal.androidterm.util.TermSettings;

public class BoundSession extends GenericTermSession {
class BoundSession extends GenericTermSession {
private final String issuerTitle;

private boolean fullyInitialized;

BoundSession(ParcelFileDescriptor ptmxFd, TermSettings settings, String issuerTitle) {
super(ptmxFd, settings, true);

Expand All @@ -24,4 +26,16 @@ public String getTitle() {
? issuerTitle
: issuerTitle + " — " + extraTitle;
}

@Override
public void initializeEmulator(int columns, int rows) {
super.initializeEmulator(columns, rows);

fullyInitialized = true;
}

@Override
boolean isFailFast() {
return !fullyInitialized;
}
}
84 changes: 2 additions & 82 deletions term/src/main/java/jackpal/androidterm/Exec.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,88 +36,8 @@ public class Exec
System.loadLibrary("jackpal-androidterm5");
}

private static Field descriptorField;
static native void setPtyWindowSizeInternal(int fd, int row, int col, int xpixel, int ypixel) throws IOException;

private static void cacheDescField() throws NoSuchFieldException {
if (descriptorField != null)
return;

descriptorField = FileDescriptor.class.getDeclaredField("descriptor");
descriptorField.setAccessible(true);
}

private static int getIntFd(ParcelFileDescriptor parcelFd) throws IOException {
if (Build.VERSION.SDK_INT >= 12)
return FdHelperHoneycomb.getFd(parcelFd);
else {
try {
cacheDescField();

return descriptorField.getInt(parcelFd.getFileDescriptor());
} catch (Exception e) {
throw new IOException("Unable to obtain file descriptor on this OS version: " + e.getMessage());
}
}
}

/**
* Set the widow size for a given pty. Allows programs
* connected to the pty learn how large their screen is.
*/
public static void setPtyWindowSize(ParcelFileDescriptor fd, int row, int col, int xpixel, int ypixel) {
// If the tty goes away too quickly, this may get called after it's descriptor is closed
if (!fd.getFileDescriptor().valid())
return;

try {
setPtyWindowSizeInternal(getIntFd(fd), row, col, xpixel, ypixel);
} catch (IOException e) {
// pretend that everything is ok...
Log.e("exec", "Failed to set window size due to " + e.getMessage());
}
}

/**
* Set or clear UTF-8 mode for a given pty. Used by the terminal driver
* to implement correct erase behavior in cooked mode (Linux >= 2.6.4).
*/
public static void setPtyUTF8Mode(ParcelFileDescriptor fd, boolean utf8Mode) {
// If the tty goes away too quickly, this may get called after it's descriptor is closed
if (!fd.getFileDescriptor().valid())
return;

try {
setPtyUTF8ModeInternal(getIntFd(fd), utf8Mode);
} catch (IOException e) {
// pretend that everything is ok...
Log.e("exec", "Failed to set UTF mode due to " + e.getMessage());
}
}

/**
* Close a given file descriptor.
*/
public static void close(ParcelFileDescriptor fd) {
try {
fd.close();
} catch (IOException e) {
// ok
}
}

/**
* Send SIGHUP to a process group, SIGHUP notifies a terminal client, that the terminal have been disconnected,
* and usually results in client's death, unless it's process is a daemon or have been somehow else detached
* from the terminal (for example, by the "nohup" utility).
*/
public static void hangupProcessGroup(int processId) {
TermExec.sendSignal(-processId, 1);
}

private static native void setPtyWindowSizeInternal(int fd, int row, int col, int xpixel, int ypixel)
throws IOException;

private static native void setPtyUTF8ModeInternal(int fd, boolean utf8Mode)
throws IOException;
static native void setPtyUTF8ModeInternal(int fd, boolean utf8Mode) throws IOException;
}

Loading

0 comments on commit 29fef60

Please sign in to comment.