How-To Series: Removing Items from the “OK Glass” Menu

22 Flares 22 Flares ×

OK GlassThis post was originally featured on the Pristine Engineering Blog.

Why would we want to remove items from the “ok glass” menu? We want users to ‘live’ exclusively in our applications to avoid unwarranted actions such as taking a picture, recording a video, or placing an accidental call. For our company, Pristine, Glass is an enterprise appliance, not a personal device. Glass needs to be completely locked down and Google-free to protect the privacy of patients and respect the policies of the hospitals we serve.

Intro to Rooted Glass

We were excited about Google’s release of the Glass Development Kit (GDK) because of the ability to insert launchers into the “ok glass” menu. However, we still faced the problem of competing applications. This evokes strong concerns here at Pristine because we don’t want a nurse in need of immediate doctor assistance being distracted by the “get directions to” feature of glass. In that moment, the clinician needs the help our apps provide and nothing else. Consequently, we decided to explore the option of removing items from the “ok glass” menu, so we rooted a couple of our devices and this is what we found.

What You Need

Walkthrough

These are the steps I used on my Mac and Windows VM in Parallels.

  • Make sure your Glass device is connected
  • Enable root via adb
$ adb root
  • Remount your devices /system directory as read/write
$ adb shell mount -o rw,remount /system
  • Pull GlassHome.apk off device
$ adb pull /system/app/GlassHome.apk <your own directory>

# navigate to your directory
$ cd <your own directory>
  • Decompile GlassHome.apk using apktool
$ apktool -f decode GlassHome.apk ./glass_home_decode
$ cd glass_home_decode
  • Open the file (relative to glass_home_decode)

         ./smali/com/google/glass/home/voice/menu/HomeMenuItems.smali

and delete the following lines below. Note that there will be some lines in between these. Just delete these lines below as they are responsible for physically adding items into the menu. Use the .line XXX as a guide.

.line 480

.local v1, mainMenuItems:Ljava/util/List; ,"Ljava/util/List<Lcom/google/glass/voice/menu/VoiceMenuItem;>;"

invoke-static {}, Lcom/google/glass/home/voice/menu/HomeMenuItems;->newGoogleItem()Lcom/google/glass/voice/menu/VoiceMenuItem;

move-result-object v4

invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

.line 481

invoke-static {}, Lcom/google/glass/home/voice/menu/HomeMenuItems;->newTakePhotoItem()Lcom/google/glass/voice/menu/VoiceMenuItem;

move-result-object v4

invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

.line 482

invoke-static {}, Lcom/google/glass/home/voice/menu/HomeMenuItems;->newRecordVideoItem()Lcom/google/glass/voice/menu/VoiceMenuItem;

move-result-object v4

invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

.line 483

invoke-static {}, Lcom/google/glass/home/voice/menu/HomeMenuItems;->newNavigationItem()Lcom/google/glass/voice/menu/VoiceMenuItem;

move-result-object v4

invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

.line 484

invoke-static {}, Lcom/google/glass/home/voice/menu/HomeMenuItems;->newSendMessageItem()Lcom/google/glass/voice/menu/VoiceMenuItem;

move-result-object v4

invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

.line 488

invoke-static {}, Lcom/google/glass/home/voice/menu/HomeMenuItems;->newCallItem()Lcom/google/glass/voice/menu/VoiceMenuItem;

move-result-object v4

invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

.line 491

invoke-static {}, Lcom/google/glass/home/voice/menu/HomeMenuItems;->newVideoCallItem()Lcom/google/glass/voice/menu/VoiceMenuItem;

move-result-object v4

invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

.line 495

invoke-static {v1, p0}, Lcom/google/glass/home/voice/menu/HomeMenuItems;->addMirrorCommands(Ljava/util/List;Landroid/content/Context;)V

  • Save the file and rebuild the apk
# navigate up one directory
$ cd ..

# rebuild the apk with apktool
$ apktool build glass_home_decode GlassHomeModified.apk
  • Transfer certificate information from original GlassHome.apk to GlassHomeModified.apk. Open both apks in 7-Zip and drag the highlighted files below to GlassHomeModified.apk (Edit: You need to drag the AndroidManifest.xml from original apk to new application)Transfer screen picture
  • Push new apk to device and restart
$ adb push GlassHomeModified.apk /system/app/GlassHome.apk
$ adb reboot
  • You can remount your system as read-only again.
adb shell mount -o ro,remount /system  

Wrapping up

If done correctly, you should see all the default options and mirror API commands gone. If you don’t have any additional GDK app content inserted into the “ok glass” menu you might only see a blank screen on the “ok glass” menu. At Pristine, we then deploy our solutions onto the device and find only our applications in the menu. Take a look.

Pristine okay glass screen

The enterprise app market for Glass is exciting, and enterprises will need to lock down Glass. Removing the primary menu items from “ok glass” is just the beginning and we’ll continue to investigate further. If you would like to try out our version of GlassHome, feel free to download it and let us know what you think.

Aaron Alaniz

Google Glass/Android Client Developer at Pristine

More Posts - Website - Twitter - Facebook

22 Flares Facebook 7 Twitter 13 Google+ 2 LinkedIn 0 StumbleUpon 0 Reddit 0 Pin It Share 0 Buffer 0 22 Flares ×
22 Flares Facebook 7 Twitter 13 Google+ 2 LinkedIn 0 StumbleUpon 0 Reddit 0 Pin It Share 0 Buffer 0 22 Flares ×