Google Pixel 2’s Squeeze is Hardcoded to Only Launch Assistant, Making Remapping Difficult

Google Pixel 2’s Squeeze is Hardcoded to Only Launch Assistant, Making Remapping Difficult

Update 10/20/17: a workaround, using a method described in this article, has been found. See this article for more details and a full tutorial on how to use it.

When we first learned about the Google Pixel 2 and Pixel 2 XL’s squeezable frame, we hoped that it would be customizable. Our own source told us that the squeezable frame would only be able to launch Google Assistant or to silence incoming calls, and unfortunately that’s all you can do on the live build that is now shipping out to customers. This is disappointing especially in light of the fact that the HTC U11 offers more customization for its squeeze feature than Google does, though Google may include more features in a software update like HTC did.

Still, the lack of official customization hasn’t deterred us in the past. We quickly figured out that the Samsung Galaxy S8‘s dedicated Bixby button could be remapped. Although, the initial method we covered was quickly patched by Samsung but that just led developers to find different (and arguably more inefficient) ways around those restrictions.

It seems that we’ll be facing a similar situation with the Google Pixel 2’s Active Edge feature, unfortunately. Our initial attempts at remapping the squeeze function are proving to be difficult. Here’s the current state of thought on remapping the Pixel 2’s squeeze function.


Active Edge is Hardcoded to Only Launch Google Assistant

The very first thing we tried to do is to change the default Assistant application on the Pixel 2 to see if Active Edge would launch an app of our choice. I downloaded AutoVoice onto my phone which lets you replace Assistant with a fully Tasker-integrated voice assistant.

AutoVoice
AutoVoice
Developer: joaomgcd
Price: Free+

Unfortunately what happens is that changing the default assistant app immediately removes the squeeze feature to launch the assistant app. Squeezing the frame now does nothing.

My next thought was to see what is going in the settings tables to see if there’s an option to manually specify the component (package/class name). That way, I could change it to launch another assistant app without going through the settings app. Unfortunately, there’s no such setting available.

We then checked to see what happens in logcat to find out if it might give us some clues as to what happens when the device detects a squeeze gesture. This is what we found:Google Pixel 2 Squeeze

“Elmyra” is presumably the codename for the Pixel 2’s Active Edge feature, which we corroborated through tearing down the SystemUIGoogle.apk previously. We can see here that when the service detects a squeeze gesture, it performs a LaunchOpa action. It checks for two flags: mIsGestureEnabled and mIsOpaEnabled. The former is clearly checking to see if Active Edge is actually enabled in settings, while the latter we had to look up.

XDA Recognized Contributor Quinny899 looked for mIsOpaEnabled in SystemUI and found the following code:

Google Pixel 2 Active Edge Squeeze

This is the function that returns a boolean value denoted by mIsOpaEnabled. It checks if Settings.Secure.Assistant (the preference that holds the current Assistant component) is set to com.google.android.googlequicksearchbox/com.google.android.voiceinteraction.GsaVoiceInteractionService which is the component for Google Assistant.

Since we changed the Assistant to AutoVoice (component: com.joaomgcd.autovoice/com.joaomgcd.autovoice .activity.ActivityGetVoice), it fails this check and thus squeeze does nothing. In essence, Google hardcoded the squeeze function to only open the current assistant app if that assistant is Google Assistant.


What else can be done?

We have a few things we’ll be trying. The first is to see if it’s possible to read data from the Elmyra service to see when the user is squeezing the phone, but that may require some permissions that a user-app can’t be granted.

The option that most developers may be thinking of is one we want to avoid: detecting when Google Assistant is open and then launching a user-defined activity or task. It’s easy to detect Google Assistant (I made a quick Tasker app that lets you control the volume level of Assistant separately from the device’s media volume) but it either relies on an Accessibility Service or Usage Statistics, which can lag the device.

Furthermore, using this method means you can’t use Google Assistant anymore since the service can’t differentiate between how it was launched (was it from a squeeze gesture, hotword detection, or long press of the home button?) That’s not a problem for a lot of Samsung Galaxy users because Bixby wasn’t that useful initially, but for many Google Assistant has become a fairly useful way to perform quick actions or web searches.

One possible fix to the above limitation is to detect when Google Assistant is open and then grab a logcat while filtering for “Elmyra”, but that would require the user to grant an application the DUMP permission via ADB. This isn’t ideal, and it doesn’t solve the performance issues either.

Oh, by the way, we did check to see if the squeeze gesture sends a KeyEvent that can be intercepted (much like how Bixby did before it was patched), but unfortunately it does not.

So there you have it—the current status of remapping Active Edge on the Google Pixel 2 and Pixel 2 XL. The cleanest remap solutions won’t work, and so we’re left with potentially only dirty, hacky workarounds. We hope that Google opens up Active Edge for third-party developers, but who knows if that would ever happen.

Discuss This Story

Want more posts like this delivered to your inbox? Enter your email to be subscribed to our newsletter.

READ THIS NEXT