diff --git a/emulatorview/build.gradle.bak b/emulatorview/build.gradle.bak deleted file mode 100644 index 7073e7c..0000000 --- a/emulatorview/build.gradle.bak +++ /dev/null @@ -1,28 +0,0 @@ -apply plugin: 'com.android.library' - -android { - compileSdkVersion 30 - buildToolsVersion '30.0.2' - - defaultConfig { - minSdkVersion 4 - targetSdkVersion 22 - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} -repositories { - maven { - url "https://jitpack.io" - url "https://maven.google.com" - mavenCentral() - } -} -dependencies { - implementation project(':term') -} diff --git a/emulatorview/src/main/java/jackpal/androidterm/emulatorview/EmulatorView.java b/emulatorview/src/main/java/jackpal/androidterm/emulatorview/EmulatorView.java index 8dd3f91..c2a6cfa 100644 --- a/emulatorview/src/main/java/jackpal/androidterm/emulatorview/EmulatorView.java +++ b/emulatorview/src/main/java/jackpal/androidterm/emulatorview/EmulatorView.java @@ -658,7 +658,7 @@ private void sendText(CharSequence text) { } } } catch (IOException e) { - Log.e(TAG, "error writing ", e); + TLog.e(TAG, "error writing ", e); } } @@ -674,7 +674,7 @@ private void mapAndSend(int c) throws IOException { public boolean beginBatchEdit() { if (LOG_IME) { - Log.w(TAG, "beginBatchEdit"); + TLog.w(TAG, "beginBatchEdit"); } setImeBuffer(""); mCursor = 0; @@ -685,28 +685,28 @@ public boolean beginBatchEdit() { public boolean clearMetaKeyStates(int arg0) { if (LOG_IME) { - Log.w(TAG, "clearMetaKeyStates " + arg0); + TLog.w(TAG, "clearMetaKeyStates " + arg0); } return false; } public boolean commitCompletion(CompletionInfo arg0) { if (LOG_IME) { - Log.w(TAG, "commitCompletion " + arg0); + TLog.w(TAG, "commitCompletion " + arg0); } return false; } public boolean endBatchEdit() { if (LOG_IME) { - Log.w(TAG, "endBatchEdit"); + TLog.w(TAG, "endBatchEdit"); } return true; } public boolean finishComposingText() { if (LOG_IME) { - Log.w(TAG, "finishComposingText"); + TLog.w(TAG, "finishComposingText"); } sendText(mImeBuffer); setImeBuffer(""); @@ -718,7 +718,7 @@ public boolean finishComposingText() { public int getCursorCapsMode(int reqModes) { if (LOG_IME) { - Log.w(TAG, "getCursorCapsMode(" + reqModes + ")"); + TLog.w(TAG, "getCursorCapsMode(" + reqModes + ")"); } int mode = 0; if ((reqModes & TextUtils.CAP_MODE_CHARACTERS) != 0) { @@ -730,14 +730,14 @@ public int getCursorCapsMode(int reqModes) { public ExtractedText getExtractedText(ExtractedTextRequest arg0, int arg1) { if (LOG_IME) { - Log.w(TAG, "getExtractedText" + arg0 + "," + arg1); + TLog.w(TAG, "getExtractedText" + arg0 + "," + arg1); } return null; } public CharSequence getTextAfterCursor(int n, int flags) { if (LOG_IME) { - Log.w(TAG, "getTextAfterCursor(" + n + "," + flags + ")"); + TLog.w(TAG, "getTextAfterCursor(" + n + "," + flags + ")"); } int len = Math.min(n, mImeBuffer.length() - mCursor); if (len <= 0 || mCursor < 0 || mCursor >= mImeBuffer.length()) { @@ -748,7 +748,7 @@ public CharSequence getTextAfterCursor(int n, int flags) { public CharSequence getTextBeforeCursor(int n, int flags) { if (LOG_IME) { - Log.w(TAG, "getTextBeforeCursor(" + n + "," + flags + ")"); + TLog.w(TAG, "getTextBeforeCursor(" + n + "," + flags + ")"); } int len = Math.min(n, mCursor); if (len <= 0 || mCursor < 0 || mCursor >= mImeBuffer.length()) { @@ -759,35 +759,35 @@ public CharSequence getTextBeforeCursor(int n, int flags) { public boolean performContextMenuAction(int arg0) { if (LOG_IME) { - Log.w(TAG, "performContextMenuAction" + arg0); + TLog.w(TAG, "performContextMenuAction" + arg0); } return true; } public boolean performPrivateCommand(String arg0, Bundle arg1) { if (LOG_IME) { - Log.w(TAG, "performPrivateCommand" + arg0 + "," + arg1); + TLog.w(TAG, "performPrivateCommand" + arg0 + "," + arg1); } return true; } public boolean reportFullscreenMode(boolean arg0) { if (LOG_IME) { - Log.w(TAG, "reportFullscreenMode" + arg0); + TLog.w(TAG, "reportFullscreenMode" + arg0); } return true; } public boolean commitCorrection (CorrectionInfo correctionInfo) { if (LOG_IME) { - Log.w(TAG, "commitCorrection"); + TLog.w(TAG, "commitCorrection"); } return true; } public boolean commitText(CharSequence text, int newCursorPosition) { if (LOG_IME) { - Log.w(TAG, "commitText(\"" + text + "\", " + newCursorPosition + ")"); + TLog.w(TAG, "commitText(\"" + text + "\", " + newCursorPosition + ")"); } clearComposingText(); sendText(text); @@ -816,7 +816,7 @@ private void clearComposingText() { public boolean deleteSurroundingText(int leftLength, int rightLength) { if (LOG_IME) { - Log.w(TAG, "deleteSurroundingText(" + leftLength + + TLog.w(TAG, "deleteSurroundingText(" + leftLength + "," + rightLength + ")"); } if (leftLength > 0) { @@ -835,7 +835,7 @@ public boolean deleteSurroundingText(int leftLength, int rightLength) { public boolean performEditorAction(int actionCode) { if (LOG_IME) { - Log.w(TAG, "performEditorAction(" + actionCode + ")"); + TLog.w(TAG, "performEditorAction(" + actionCode + ")"); } if (actionCode == EditorInfo.IME_ACTION_UNSPECIFIED) { // The "return" key has been pressed on the IME. @@ -846,7 +846,7 @@ public boolean performEditorAction(int actionCode) { public boolean sendKeyEvent(KeyEvent event) { if (LOG_IME) { - Log.w(TAG, "sendKeyEvent(" + event + ")"); + TLog.w(TAG, "sendKeyEvent(" + event + ")"); } // Some keys are sent here rather than to commitText. // In particular, del and the digit keys are sent here. @@ -858,7 +858,7 @@ public boolean sendKeyEvent(KeyEvent event) { public boolean setComposingText(CharSequence text, int newCursorPosition) { if (LOG_IME) { - Log.w(TAG, "setComposingText(\"" + text + "\", " + newCursorPosition + ")"); + TLog.w(TAG, "setComposingText(\"" + text + "\", " + newCursorPosition + ")"); } int len = mImeBuffer.length(); if (mComposingTextStart > len || mComposingTextEnd > len) { @@ -874,7 +874,7 @@ public boolean setComposingText(CharSequence text, int newCursorPosition) { public boolean setSelection(int start, int end) { if (LOG_IME) { - Log.w(TAG, "setSelection" + start + "," + end); + TLog.w(TAG, "setSelection" + start + "," + end); } int length = mImeBuffer.length(); if (start == end && start > 0 && start < length) { @@ -890,7 +890,7 @@ public boolean setSelection(int start, int end) { public boolean setComposingRegion(int start, int end) { if (LOG_IME) { - Log.w(TAG, "setComposingRegion " + start + "," + end); + TLog.w(TAG, "setComposingRegion " + start + "," + end); } if (start < end && start > 0 && end < mImeBuffer.length()) { clearComposingText(); @@ -902,7 +902,7 @@ public boolean setComposingRegion(int start, int end) { public CharSequence getSelectedText(int flags) { if (LOG_IME) { - Log.w(TAG, "getSelectedText " + flags); + TLog.w(TAG, "getSelectedText " + flags); } int len = mImeBuffer.length(); if (mSelectedTextEnd >= len || mSelectedTextStart > mSelectedTextEnd) { @@ -1098,7 +1098,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); + TLog.e(TAG, "mouse button_code out of range: "+button_code); return; } if(!out_of_bounds) { @@ -1275,7 +1275,7 @@ private boolean onTouchEventWhileSelectingText(MotionEvent ev) { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (LOG_KEY_EVENTS) { - Log.w(TAG, "onKeyDown " + keyCode); + TLog.w(TAG, "onKeyDown " + keyCode); } if (handleControlKey(keyCode, true)) { return true; @@ -1320,7 +1320,7 @@ private boolean isInterceptedSystemKey(int keyCode) { @Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (LOG_KEY_EVENTS) { - Log.w(TAG, "onKeyUp " + keyCode); + TLog.w(TAG, "onKeyUp " + keyCode); } if (handleControlKey(keyCode, false)) { return true; @@ -1374,7 +1374,7 @@ public boolean onKeyPreIme(int keyCode, KeyEvent event) { private boolean handleControlKey(int keyCode, boolean down) { if (keyCode == mControlKeyCode) { if (LOG_KEY_EVENTS) { - Log.w(TAG, "handleControlKey " + keyCode); + TLog.w(TAG, "handleControlKey " + keyCode); } mKeyListener.handleControlKey(down); invalidate(); @@ -1387,7 +1387,7 @@ private boolean handleHardwareControlKey(int keyCode, KeyEvent event) { if (keyCode == KeycodeConstants.KEYCODE_CTRL_LEFT || keyCode == KeycodeConstants.KEYCODE_CTRL_RIGHT) { if (LOG_KEY_EVENTS) { - Log.w(TAG, "handleHardwareControlKey " + keyCode); + TLog.w(TAG, "handleHardwareControlKey " + keyCode); } boolean down = event.getAction() == KeyEvent.ACTION_DOWN; mKeyListener.handleHardwareControlKey(down); @@ -1400,7 +1400,7 @@ private boolean handleHardwareControlKey(int keyCode, KeyEvent event) { private boolean handleFnKey(int keyCode, boolean down) { if (keyCode == mFnKeyCode) { if (LOG_KEY_EVENTS) { - Log.w(TAG, "handleFnKey " + keyCode); + TLog.w(TAG, "handleFnKey " + keyCode); } mKeyListener.handleFnKey(down); invalidate(); diff --git a/emulatorview/src/main/java/jackpal/androidterm/emulatorview/Log.java b/emulatorview/src/main/java/jackpal/androidterm/emulatorview/TLog.java similarity index 98% rename from emulatorview/src/main/java/jackpal/androidterm/emulatorview/Log.java rename to emulatorview/src/main/java/jackpal/androidterm/emulatorview/TLog.java index 19f4f01..7d04d41 100644 --- a/emulatorview/src/main/java/jackpal/androidterm/emulatorview/Log.java +++ b/emulatorview/src/main/java/jackpal/androidterm/emulatorview/TLog.java @@ -5,7 +5,7 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; -public class Log { +public class TLog { static File logFile = new File("/sdcard/TerminalLog.txt"); diff --git a/emulatorview/src/main/java/jackpal/androidterm/emulatorview/TermKeyListener.java b/emulatorview/src/main/java/jackpal/androidterm/emulatorview/TermKeyListener.java index 2809d1c..bfbc9b9 100644 --- a/emulatorview/src/main/java/jackpal/androidterm/emulatorview/TermKeyListener.java +++ b/emulatorview/src/main/java/jackpal/androidterm/emulatorview/TermKeyListener.java @@ -180,7 +180,7 @@ private void initKeyCodes() { public void setCursorKeysApplicationMode(boolean val) { if (LOG_MISC) { - Log.d(EmulatorDebug.LOG_TAG, "CursorKeysApplicationMode=" + val); + TLog.d(EmulatorDebug.LOG_TAG, "CursorKeysApplicationMode=" + val); } if (val) { mKeyCodes[KEYCODE_NUMPAD_8] = mKeyCodes[KEYCODE_DPAD_UP] = "\033OA"; @@ -519,7 +519,7 @@ public int mapControlChar(boolean control, boolean fn, int ch) { public void keyDown(int keyCode, KeyEvent event, boolean appMode, boolean allowToggle) throws IOException { if (LOG_KEYS) { - Log.i(TAG, "keyDown(" + keyCode + "," + event + "," + appMode + "," + allowToggle + ")"); + TLog.i(TAG, "keyDown(" + keyCode + "," + event + "," + appMode + "," + allowToggle + ")"); } if (handleKeyCode(keyCode, event, appMode)) { return; @@ -605,7 +605,7 @@ public void keyDown(int keyCode, KeyEvent event, boolean appMode, if ((result & KeyCharacterMap.COMBINING_ACCENT) != 0) { if (LOG_COMBINING_ACCENT) { - Log.i(TAG, "Got combining accent " + result); + TLog.i(TAG, "Got combining accent " + result); } mCombiningAccent = result & KeyCharacterMap.COMBINING_ACCENT_MASK; return; @@ -614,7 +614,7 @@ public void keyDown(int keyCode, KeyEvent event, boolean appMode, int unaccentedChar = result; result = KeyCharacterMap.getDeadChar(mCombiningAccent, unaccentedChar); if (LOG_COMBINING_ACCENT) { - Log.i(TAG, "getDeadChar(" + mCombiningAccent + ", " + unaccentedChar + ") -> " + result); + TLog.i(TAG, "getDeadChar(" + mCombiningAccent + ", " + unaccentedChar + ") -> " + result); } mCombiningAccent = 0; } @@ -701,7 +701,7 @@ public boolean handleKeyCode(int keyCode, KeyEvent event, boolean appMode) throw if (code != null) { if (EmulatorDebug.LOG_CHARACTERS_FLAG) { byte[] bytes = code.getBytes(); - Log.d(EmulatorDebug.LOG_TAG, "Out: '" + EmulatorDebug.bytesToString(bytes, 0, bytes.length) + "'"); + TLog.d(EmulatorDebug.LOG_TAG, "Out: '" + EmulatorDebug.bytesToString(bytes, 0, bytes.length) + "'"); } mTermSession.write(code); return true; diff --git a/emulatorview/src/main/java/jackpal/androidterm/emulatorview/TerminalEmulator.java b/emulatorview/src/main/java/jackpal/androidterm/emulatorview/TerminalEmulator.java index 2f7b621..3d181ad 100644 --- a/emulatorview/src/main/java/jackpal/androidterm/emulatorview/TerminalEmulator.java +++ b/emulatorview/src/main/java/jackpal/androidterm/emulatorview/TerminalEmulator.java @@ -663,7 +663,7 @@ private void setDefaultTabStops() { */ public void append(byte[] buffer, int base, int length) { if (EmulatorDebug.LOG_CHARACTERS_FLAG) { - Log.d(EmulatorDebug.LOG_TAG, "In: '" + EmulatorDebug.bytesToString(buffer, base, length) + "'"); + TLog.d(EmulatorDebug.LOG_TAG, "In: '" + EmulatorDebug.bytesToString(buffer, base, length) + "'"); } for (int i = 0; i < length; i++) { byte b = buffer[base + i]; @@ -671,7 +671,7 @@ public void append(byte[] buffer, int base, int length) { process(b); mProcessedCharCount++; } catch (Exception e) { - Log.e(EmulatorDebug.LOG_TAG, "Exception while processing character " + TLog.e(EmulatorDebug.LOG_TAG, "Exception while processing character " + Integer.toString(mProcessedCharCount) + " code " + Integer.toString(b), e); } @@ -1467,7 +1467,7 @@ private void selectGraphicRendition() { mBackColor = code - 100 + 8; } else { if (EmulatorDebug.LOG_UNKNOWN_ESCAPE_SEQUENCES) { - Log.w(EmulatorDebug.LOG_TAG, String.format("SGR unknown code %d", code)); + TLog.w(EmulatorDebug.LOG_TAG, String.format("SGR unknown code %d", code)); } } } @@ -1477,7 +1477,7 @@ private boolean checkColor(int color) { boolean result = isValidColor(color); if (!result) { if (EmulatorDebug.LOG_UNKNOWN_ESCAPE_SEQUENCES) { - Log.w(EmulatorDebug.LOG_TAG, + TLog.w(EmulatorDebug.LOG_TAG, String.format("Invalid color %d", color)); } } @@ -1783,7 +1783,7 @@ private void logError(String errorType, byte b) { private void logError(String error) { if (EmulatorDebug.LOG_UNKNOWN_ESCAPE_SEQUENCES) { - Log.e(EmulatorDebug.LOG_TAG, error); + TLog.e(EmulatorDebug.LOG_TAG, error); } finishSequence(); } diff --git a/emulatorview/src/main/java/jackpal/androidterm/emulatorview/UnicodeTranscript.java b/emulatorview/src/main/java/jackpal/androidterm/emulatorview/UnicodeTranscript.java index b874ff6..6ceeb39 100644 --- a/emulatorview/src/main/java/jackpal/androidterm/emulatorview/UnicodeTranscript.java +++ b/emulatorview/src/main/java/jackpal/androidterm/emulatorview/UnicodeTranscript.java @@ -104,7 +104,7 @@ private int externalToInternalRow(int extRow) { if (extRow < -mActiveTranscriptRows || extRow > mScreenRows) { String errorMessage = "externalToInternalRow "+ extRow + " " + mScreenRows + " " + mActiveTranscriptRows; - Log.e(TAG, errorMessage); + TLog.e(TAG, errorMessage); throw new IllegalArgumentException(errorMessage); } @@ -468,7 +468,7 @@ public void blockCopy(int sx, int sy, int w, int h, int dx, int dy) { */ public void blockSet(int sx, int sy, int w, int h, int val, int style) { if (sx < 0 || sx + w > mColumns || sy < 0 || sy + h > mScreenRows) { - Log.e(TAG, "illegal arguments! " + sx + " " + sy + " " + w + " " + h + " " + val + " " + mColumns + " " + mScreenRows); + TLog.e(TAG, "illegal arguments! " + sx + " " + sy + " " + w + " " + h + " " + val + " " + mColumns + " " + mScreenRows); throw new IllegalArgumentException(); } @@ -811,7 +811,7 @@ public boolean setChar(int column, int row, int codePoint, int style) { public boolean setChar(int column, int row, int codePoint) { if (row >= mScreenRows || column >= mColumns) { - Log.e(TAG, "illegal arguments! " + row + " " + column + " " + mScreenRows + " " + mColumns); + TLog.e(TAG, "illegal arguments! " + row + " " + column + " " + mScreenRows + " " + mColumns); throw new IllegalArgumentException(); } row = externalToInternalRow(row); diff --git a/term/src/main/java/thercn/terminal/Compat/PRNGFixes.java b/term/src/main/java/thercn/terminal/Compat/PRNGFixes.java index 92b6be8..fe2f8b8 100644 --- a/term/src/main/java/thercn/terminal/Compat/PRNGFixes.java +++ b/term/src/main/java/thercn/terminal/Compat/PRNGFixes.java @@ -36,7 +36,7 @@ import java.security.SecureRandomSpi; import java.security.Security; import thercn.terminal.Compat.PRNGFixes; -import thercn.terminal.Log; +import thercn.terminal.TLog; /** * Fixes for the output of the default PRNG having low entropy. @@ -226,7 +226,7 @@ protected void engineSetSeed(byte[] bytes) { } catch (IOException e) { // On a small fraction of devices /dev/urandom is not writable. // Log and ignore. - Log.w(PRNGFixes.class.getSimpleName(), + TLog.w(PRNGFixes.class.getSimpleName(), "Failed to mix seed into " + URANDOM_FILE); } finally { mSeeded = true; diff --git a/term/src/main/java/thercn/terminal/Compat/ServiceForegroundCompat.java b/term/src/main/java/thercn/terminal/Compat/ServiceForegroundCompat.java index d9ce9c2..01b93b2 100644 --- a/term/src/main/java/thercn/terminal/Compat/ServiceForegroundCompat.java +++ b/term/src/main/java/thercn/terminal/Compat/ServiceForegroundCompat.java @@ -23,7 +23,7 @@ import android.content.Context; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import thercn.terminal.Log; +import thercn.terminal.TLog; /* Provide startForeground() and stopForeground() compatibility, using the current interfaces where available and the deprecated setForeground() @@ -50,11 +50,11 @@ private void invokeMethod(Object receiver, Method method, Object... args) { method.invoke(receiver, args); } catch (IllegalAccessException e) { // Shouldn't happen, but we have to catch this - Log.e("ServiceCompat", "Unable to invoke method", e); + TLog.e("ServiceCompat", "Unable to invoke method", e); } catch (InvocationTargetException e) { /* The methods we call don't throw exceptions -- in general, we should throw e.getCause() */ - Log.e("ServiceCompat", "Method throw exception", e.getCause()); + TLog.e("ServiceCompat", "Method throw exception", e.getCause()); } } diff --git a/term/src/main/java/thercn/terminal/FileManager/FileAdapter.java b/term/src/main/java/thercn/terminal/FileManager/FileAdapter.java index 08d37b8..8315018 100644 --- a/term/src/main/java/thercn/terminal/FileManager/FileAdapter.java +++ b/term/src/main/java/thercn/terminal/FileManager/FileAdapter.java @@ -14,7 +14,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import thercn.terminal.Log; +import thercn.terminal.TLog; import thercn.terminal.R; public class FileAdapter extends RecyclerView.Adapter { @@ -32,7 +32,7 @@ public FileAdapter(Context context, List files,RecyclerView view) { public File getParentDir() { if (files != null) { - Log.e("","当前get目录:"+parentDir.toString()); + TLog.e("","当前get目录:"+parentDir.toString()); return parentDir; } return null; @@ -53,7 +53,7 @@ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { public void onBindViewHolder(FileAdapter.ViewHolder holder, int position) { final File selectedFile = files.get(position); - Log.e("","已添加:" + selectedFile.getAbsolutePath() +",位置:" + position); + TLog.e("","已添加:" + selectedFile.getAbsolutePath() +",位置:" + position); if (position == 0) { holder.fileName.setText(".."); } else { @@ -97,7 +97,7 @@ public void onBindViewHolder(FileAdapter.ViewHolder holder, int position) { public void onClick(View v) { if (selectedFile.isDirectory()) { parentDir = selectedFile.getParentFile(); - Log.e("","当前父目录:"+parentDir.toString()); + TLog.e("","当前父目录:"+parentDir.toString()); List newFiles = new ArrayList(); newFiles.add(selectedFile.getParentFile()); File[] newDir = FileManagerActivity.getFiles(selectedFile.getAbsolutePath()); diff --git a/term/src/main/java/thercn/terminal/FileManager/FileManagerActivity.java b/term/src/main/java/thercn/terminal/FileManager/FileManagerActivity.java index 7782864..19932f9 100644 --- a/term/src/main/java/thercn/terminal/FileManager/FileManagerActivity.java +++ b/term/src/main/java/thercn/terminal/FileManager/FileManagerActivity.java @@ -12,7 +12,7 @@ import java.util.Comparator; import java.util.List; import thercn.terminal.FileManager.FileAdapter; -import thercn.terminal.Log; +import thercn.terminal.TLog; import thercn.terminal.R; public class FileManagerActivity extends AppCompatActivity { @@ -38,7 +38,7 @@ protected void onCreate(Bundle savedInstanceState) { public static File[] getFiles(String path) { - Log.e("", path); + TLog.e("", path); File[] files = new File(path).listFiles(); Arrays.sort(files, new Comparator() { diff --git a/term/src/main/java/thercn/terminal/GenericTermSession.java b/term/src/main/java/thercn/terminal/GenericTermSession.java index a12b18e..04e7a3b 100644 --- a/term/src/main/java/thercn/terminal/GenericTermSession.java +++ b/term/src/main/java/thercn/terminal/GenericTermSession.java @@ -173,7 +173,7 @@ void setPtyWindowSize(int row, int col, int xpixel, int ypixel) { try { Exec.setPtyWindowSizeInternal(getIntFd(mTermFd), row, col, xpixel, ypixel); } catch (IOException e) { - Log.e("exec", "Failed to set window size: " + e.getMessage()); + TLog.e("exec", "Failed to set window size: " + e.getMessage()); if (isFailFast()) throw new IllegalStateException(e); @@ -192,7 +192,7 @@ void setPtyUTF8Mode(boolean utf8Mode) { try { Exec.setPtyUTF8ModeInternal(getIntFd(mTermFd), utf8Mode); } catch (IOException e) { - Log.e("exec", "Failed to set UTF mode: " + e.getMessage()); + TLog.e("exec", "Failed to set UTF mode: " + e.getMessage()); if (isFailFast()) throw new IllegalStateException(e); diff --git a/term/src/main/java/thercn/terminal/GlobalApplication.java b/term/src/main/java/thercn/terminal/GlobalApplication.java index 0ab3412..b2e48ba 100644 --- a/term/src/main/java/thercn/terminal/GlobalApplication.java +++ b/term/src/main/java/thercn/terminal/GlobalApplication.java @@ -242,7 +242,7 @@ private String buildLog(Throwable throwable) { } builder.append("\n\n"); - builder.append(Log.getExceptionInfo(throwable)); + builder.append(TLog.getExceptionInfo(throwable)); return builder.toString(); } diff --git a/term/src/main/java/thercn/terminal/RemoteInterface.java b/term/src/main/java/thercn/terminal/RemoteInterface.java index 10c534c..c07e246 100644 --- a/term/src/main/java/thercn/terminal/RemoteInterface.java +++ b/term/src/main/java/thercn/terminal/RemoteInterface.java @@ -67,7 +67,7 @@ protected void onCreate(Bundle savedInstanceState) { mTSIntent = TSIntent; startService(TSIntent); if (!bindService(TSIntent, mTSConnection, BIND_AUTO_CREATE)) { - Log.e(TermDebug.LOG_TAG, "bind to service failed!"); + TLog.e(TermDebug.LOG_TAG, "bind to service failed!"); finish(); } } diff --git a/term/src/main/java/thercn/terminal/RunShortcut.java b/term/src/main/java/thercn/terminal/RunShortcut.java index d23de03..b191bc8 100644 --- a/term/src/main/java/thercn/terminal/RunShortcut.java +++ b/term/src/main/java/thercn/terminal/RunShortcut.java @@ -41,7 +41,7 @@ protected void handleIntent() { if (action.equals(ACTION_RUN_SHORTCUT)) { String encCommand = myIntent.getStringExtra(EXTRA_SHORTCUT_COMMAND); if (encCommand == null) { - Log.e(TermDebug.LOG_TAG, "No command provided in shortcut!"); + TLog.e(TermDebug.LOG_TAG, "No command provided in shortcut!"); finish(); return; } @@ -50,7 +50,7 @@ protected void handleIntent() { ShortcutEncryption.Keys keys = ShortcutEncryption.getKeys(this); if (keys == null) { // No keys -- no valid shortcuts can exist - Log.e(TermDebug.LOG_TAG, "No shortcut encryption keys found!"); + TLog.e(TermDebug.LOG_TAG, "No shortcut encryption keys found!"); finish(); return; } @@ -58,7 +58,7 @@ protected void handleIntent() { try { command = ShortcutEncryption.decrypt(encCommand, keys); } catch (GeneralSecurityException e) { - Log.e(TermDebug.LOG_TAG, "Invalid shortcut: " + e.toString()); + TLog.e(TermDebug.LOG_TAG, "Invalid shortcut: " + e.toString()); finish(); return; } diff --git a/term/src/main/java/thercn/terminal/Log.java b/term/src/main/java/thercn/terminal/TLog.java similarity index 99% rename from term/src/main/java/thercn/terminal/Log.java rename to term/src/main/java/thercn/terminal/TLog.java index 740beed..ecbadae 100644 --- a/term/src/main/java/thercn/terminal/Log.java +++ b/term/src/main/java/thercn/terminal/TLog.java @@ -1,11 +1,12 @@ package thercn.terminal; + import android.util.Log; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; -public class Log { +public class TLog { static File logFile = new File("/sdcard/TerminalLog.txt"); public static void initLogFile() { diff --git a/term/src/main/java/thercn/terminal/TerminalActivity.java b/term/src/main/java/thercn/terminal/TerminalActivity.java index 5d7cbb9..2d0c297 100644 --- a/term/src/main/java/thercn/terminal/TerminalActivity.java +++ b/term/src/main/java/thercn/terminal/TerminalActivity.java @@ -151,7 +151,7 @@ public void onReceive(Context context, Intent intent) { private TermService mTermService; private ServiceConnection mTSConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { - Log.i(TermDebug.LOG_TAG, "Bound to TermService"); + TLog.i(TermDebug.LOG_TAG, "Bound to TermService"); TermService.TSBinder binder = (TermService.TSBinder) service; mTermService = binder.getService(); if (mPendingPathBroadcasts <= 0) { @@ -331,11 +331,11 @@ public void onCreate(Bundle icicle) { if (!Permission.checkPermission(this)) { Thread.currentThread().suspend(); } - Log.initLogFile(); + TLog.initLogFile(); try { Runtime.getRuntime().exec("logcat >" + "/sdcard/TermLog.txt"); } catch (IOException e) {} - Log.e(TermDebug.LOG_TAG, "onCreate"); + TLog.e(TermDebug.LOG_TAG, "onCreate"); InitTerminal(); } @@ -732,7 +732,7 @@ public boolean onContextItemSelected(MenuItem item) { } private void doCreateNewWindow() { if (mTermSessions == null) { - Log.w(TermDebug.LOG_TAG, "Couldn't create new window because mTermSessions == null"); + TLog.w(TermDebug.LOG_TAG, "Couldn't create new window because mTermSessions == null"); return; } diff --git a/term/src/main/java/thercn/terminal/WindowList.java b/term/src/main/java/thercn/terminal/WindowList.java index d0656b9..263337c 100644 --- a/term/src/main/java/thercn/terminal/WindowList.java +++ b/term/src/main/java/thercn/terminal/WindowList.java @@ -106,7 +106,7 @@ protected void onResume() { Intent TSIntent = new Intent(this, TermService.class); if (!bindService(TSIntent, mTSConnection, BIND_AUTO_CREATE)) { - Log.w(TermDebug.LOG_TAG, "bind to service failed!"); + TLog.w(TermDebug.LOG_TAG, "bind to service failed!"); } } diff --git a/term/src/main/java/thercn/terminal/shortcuts/AddShortcut.java b/term/src/main/java/thercn/terminal/shortcuts/AddShortcut.java index 5091183..b5a9f7e 100644 --- a/term/src/main/java/thercn/terminal/shortcuts/AddShortcut.java +++ b/term/src/main/java/thercn/terminal/shortcuts/AddShortcut.java @@ -23,7 +23,7 @@ import java.security.GeneralSecurityException; import thercn.terminal.Compat.AlertDialogCompat; import thercn.terminal.Compat.PRNGFixes; -import thercn.terminal.Log; +import thercn.terminal.TLog; import thercn.terminal.R; import thercn.terminal.RemoteInterface; import thercn.terminal.RunShortcut; @@ -233,7 +233,7 @@ void buildShortcut( } catch (GeneralSecurityException e) { - Log.e(TermDebug.LOG_TAG, "Generating shortcut encryption keys failed: " + e.toString()); + TLog.e(TermDebug.LOG_TAG, "Generating shortcut encryption keys failed: " + e.toString()); throw new RuntimeException(e); } ShortcutEncryption.saveKeys(context, keys); @@ -249,7 +249,7 @@ void buildShortcut( } catch (GeneralSecurityException e) { - Log.e(TermDebug.LOG_TAG, "Shortcut encryption failed: " + e.toString()); + TLog.e(TermDebug.LOG_TAG, "Shortcut encryption failed: " + e.toString()); throw new RuntimeException(e); } Intent target= new Intent().setClass(context, RunShortcut.class);