Skip to content

Instantly share code, notes, and snippets.

@zhuowei
Created June 2, 2013 18:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zhuowei/5694367 to your computer and use it in GitHub Desktop.
Save zhuowei/5694367 to your computer and use it in GitHub Desktop.
Glass services teardown

Here are some tidbits from my Glass Services teardown (not actually an APK teardown, more like a odex teardown)

In summary: nothing groundbreaking; everything in here is known anyways.

Eye Gestures

In GlassGestureService, the service detecting winks, there's this enum:


      // $FF: synthetic field
      private static final GlassGestureService.EyeGesture[] $VALUES;
      BLINK("BLINK", 3),
      DOFF("DOFF", 6),
      DON("DON", 5),
      DOUBLE_BLINK("DOUBLE_BLINK", 4),
      DOUBLE_WINK("DOUBLE_WINK", 2),
      NO_GESTURE("NO_GESTURE", 0),
      WINK("WINK", 1);```
I'm guessing those other gestures might play a role in later updates. Doff and Don are used in on-head detection, wink is a Labs feature; haven't seen the others.

If you are writing an app, the intent to listen for is com.google.glass.action.EYE_GESTURE . There is a public API to enable/disable them in the undocumented package android.glass.GlassGestureManager . Get it via Context.getSystemService("glass_gesture")

### Head gestures

There's a head gesture service; I took a look at the corresponding listener in the Glass Home apk to tease out its capabilities:
```      GLOBAL_LOOK_UP("GLOBAL_LOOK_UP", 1),
      NO_GESTURE("NO_GESTURE", 0),
      NUDGE("NUDGE", 3),
      RELATIVE_LOOK_UP("RELATIVE_LOOK_UP", 2);```
And those are just the public ones; There's also a HeadNodOnceDetector in the code; not sure if it's used.

Relative look up is used to wake up the Glass, nudge is used to put the glass to sleep. Any unconsumed events are pushed out via the com.google.glass.LOG_HEAD_GESTURE intent (extra string "gesture")

### Touchpad gestures
```   LONG_TAP("LONG_TAP", 0),
   SWIPE_DOWN("SWIPE_DOWN", 1),
   SWIPE_LEFT("SWIPE_LEFT", 2),
   SWIPE_RIGHT("SWIPE_RIGHT", 3),
   SWIPE_UP("SWIPE_UP", 4),
   TAP("TAP", 5),
   THREE_LONG_TAP("THREE_LONG_TAP", 6),
   THREE_TAP("THREE_TAP", 7),
   TWO_LONG_TAP("TWO_LONG_TAP", 8),
   TWO_SWIPE_DOWN("TWO_SWIPE_DOWN", 9),
   TWO_SWIPE_LEFT("TWO_SWIPE_LEFT", 10),
   TWO_SWIPE_RIGHT("TWO_SWIPE_RIGHT", 11),
   TWO_SWIPE_UP("TWO_SWIPE_UP", 12),
   TWO_TAP("TWO_TAP", 13);```
Most of these are already used by the framework when the screen's on (back button, bug report, etc)

When the screen is off, these are dispatched by com.google.glass.action.TOUCH_GESTURE with extra "gesture".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment