summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-02-19 17:29:18 -0800
committerJeff Sharkey <jsharkey@android.com>2013-02-19 18:08:35 -0800
commitef946f3ae80556ab221265c0bf1c560683ea27f6 (patch)
tree1075b9a5a6f58c8a1333aac666124f40ba40fa1f /src
parent1a4f172df720edcc97ca86838910d3be557a5225 (diff)
downloadandroid_packages_apps_Terminal-ef946f3ae80556ab221265c0bf1c560683ea27f6.tar.gz
android_packages_apps_Terminal-ef946f3ae80556ab221265c0bf1c560683ea27f6.tar.bz2
android_packages_apps_Terminal-ef946f3ae80556ab221265c0bf1c560683ea27f6.zip
Initial code for Terminal app, with JNI glue.
Change-Id: I4b2ecb2eef9bef7a8236391d19a3708751a7c71d
Diffstat (limited to 'src')
-rw-r--r--src/com/android/terminal/Terminal.java36
-rw-r--r--src/com/android/terminal/TerminalActivity.java33
2 files changed, 69 insertions, 0 deletions
diff --git a/src/com/android/terminal/Terminal.java b/src/com/android/terminal/Terminal.java
new file mode 100644
index 0000000..8b1809c
--- /dev/null
+++ b/src/com/android/terminal/Terminal.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.terminal;
+
+public class Terminal {
+ static {
+ System.loadLibrary("jni_terminal");
+ }
+
+ private final int mNativePtr;
+
+ public Terminal() {
+ mNativePtr = nativeInit(25, 80);
+ }
+
+ public int getRows() {
+ return nativeGetRows(mNativePtr);
+ }
+
+ private static native int nativeInit(int rows, int cols);
+ private static native int nativeGetRows(int ptr);
+}
diff --git a/src/com/android/terminal/TerminalActivity.java b/src/com/android/terminal/TerminalActivity.java
new file mode 100644
index 0000000..0bb73ff
--- /dev/null
+++ b/src/com/android/terminal/TerminalActivity.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.terminal;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+
+public class TerminalActivity extends Activity {
+ private static final String TAG = "Terminal";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Terminal t = new Terminal();
+ Log.d(TAG, "Rows: " + t.getRows());
+ }
+}