abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorjuloo2015-08-04 21:07:28 +0200
committerjuloo2015-08-04 21:07:28 +0200
commitbee433462665d72ce4eec3cc4a084665ab92c73c (patch)
tree1703d310020f0cb9918bd0b4e4948be907807f98
parent40885f5760f59cb2511d1d2b829507f483354282 (diff)
downloadunexpected-keyboard-bee433462665d72ce4eec3cc4a084665ab92c73c.tar.gz
unexpected-keyboard-bee433462665d72ce4eec3cc4a084665ab92c73c.zip
logcat.py
-rw-r--r--AndroidManifest.xml7
-rwxr-xr-xlogcat.py60
-rw-r--r--res/layout/input.xml1
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java12
4 files changed, 78 insertions, 2 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f3462fb..5dde156 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2,13 +2,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="juloo.keyboard2"
android:versionCode="1"
- android:versionName="1.0">
+ android:versionName="1.0"
+ android:hardwareAccelerated="false">
<uses-sdk android:minSdkVersion="1"
android:targetSdkVersion="22" />
<application android:label="@string/app_name"
- android:icon="@drawable/ic_launcher">
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:hardwareAccelerated="false">
<service android:name="Keyboard2"
android:label="@string/app_name"
diff --git a/logcat.py b/logcat.py
new file mode 100755
index 0000000..8a12490
--- /dev/null
+++ b/logcat.py
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+# **************************************************************************** #
+# #
+# ::: :::::::: #
+# logcat.py :+: :+: :+: #
+# +:+ +:+ +:+ #
+# By: juloo <juloo@student.42.fr> +#+ +:+ +#+ #
+# +#+#+#+#+#+ +#+ #
+# Created: 2015/08/04 18:31:55 by juloo #+# #+# #
+# Updated: 2015/08/04 20:10:14 by juloo ### ########.fr #
+# #
+# **************************************************************************** #
+
+from subprocess import Popen, PIPE
+from sys import argv, stdout, exit
+import re
+
+if len(argv) <= 1:
+ print("\033[31mNot enougth argument\033[39m")
+ print("Usage: %s <app name (package name)>" % argv[0])
+ exit()
+
+prefixReg = re.compile('[^:]+\(\s*([0-9]+)\):.*')
+startAppReg = re.compile('[^:]+: Start proc ([^ ]+)[^:]+:\s*pid\s*=\s*([0-9]+)\s*.*')
+
+app_name = argv[1]
+pids = []
+
+Popen("adb logcat -c".split()).wait()
+
+cmd = Popen("adb shell ps".split(), stdout=PIPE)
+for l in cmd.stdout:
+ if app_name in l:
+ pids.append(int(l.split()[1]))
+
+if len(pids) <= 0:
+ stdout.write("\033[91mApp not started. Waiting")
+else:
+ stdout.write("\033[32mApplication pid:")
+ for p in pids:
+ stdout.write(" %d" % p)
+stdout.write("\033[39m\n")
+stdout.flush()
+
+cmd = Popen("adb logcat".split(), stdout=PIPE)
+for l in iter(cmd.stdout.readline, ""):
+ m = startAppReg.match(l)
+ if m != None and app_name in m.group(1):
+ pid = int(m.group(2))
+ if pid not in pids:
+ pids.append(pid)
+ stdout.write("\033[32mApplication started. pid:")
+ for p in pids:
+ stdout.write(" %d" % p)
+ stdout.write("\033[39m\n")
+ stdout.flush()
+ m = prefixReg.match(l)
+ if m != None and int(m.group(1)) in pids:
+ stdout.write(l)
+ stdout.flush()
diff --git a/res/layout/input.xml b/res/layout/input.xml
index c3fe863..98c390c 100644
--- a/res/layout/input.xml
+++ b/res/layout/input.xml
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<juloo.keyboard2.Keyboard2View xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/bg"
+ android:hardwareAccelerated="false"
/>
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index d3d03cd..1c22a01 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -38,6 +38,18 @@ public class Keyboard2 extends InputMethodService
{
if (getCurrentInputConnection() == null)
return ;
+ // DEBUG
+ if (_inputView.isHardwareAccelerated())
+ log("LOL isHardwareAccelerated");
+ String k = "Key ";
+ if ((flags & KeyValue.FLAG_CTRL) != 0)
+ k += "Ctrl-";
+ if ((flags & KeyValue.FLAG_ALT) != 0)
+ k += "Alt-";
+ if ((flags & KeyValue.FLAG_SHIFT) != 0)
+ k += "Shift-";
+ log(k + key.getName());
+ // -
if (key.getEventCode() == KeyValue.EVENT_CONFIG)
{
// TODO improve this shit