Since the Google Pixel 2 and Google Pixel 2 XL smartphones were announced, we've been looking into ways to customize features on the phone beyond its Google-imposed limitations. One of the first features we started looking into is Active Edge, Google's take on the HTC U11's squeezable frame functions. By default, Active Edge only allows you to squeeze your phone to launch Google Assistant or silence incoming calls, and we discovered that there wasn't going to be a clean solution to remapping Active Edge to do whatever you want. Just as predicted, though, workarounds to remap the squeeze function on the Google Pixel 2 have been found—here's how it's done.

Google hardcoded SystemUI to only allow squeeze to work when the current assistant app is set to Google Assistant. That means that developers would have to use a combination of an Accessibility Service and reading system logs in order to detect when the user squeezes their phone so they can hide Google Assistant and instead perform a user-defined action. That's exactly what the latest update to Button Mapper by XDA Recognized Developer flar2 does.

We've covered the Button Mapper application in the past, but for those of you who aren't familiar it's an application that lets you remap nearly any key on your device to perform whatever action you want. It's a bit of an oversimplification to describe it that way because the app also has a ton of other features that you should definitely check out.

In any case, the latest update to version 0.53 brings the ability to remap the squeeze function on the Google Pixel 2 and Pixel 2 XL. This particular feature will be available for free, though keep in mind that some of the other features in the app require a paid license.

The video demonstration above was provided to us by flar2, so he skips over some of the setup steps in order to just show off the new feature. If you're looking to replicate this on your brand new Google Pixel 2 or Pixel 2 XL, we'll provide a tutorial below for you to follow.


How to Remap Squeeze/Active Edge Feature on the Google Pixel 2

The first thing you'll need to do is download Button Mapper from either XDA Labs or the Google Play Store.

[appbox xda flar2.homebutton]

Button Mapper: Remap your keys Developer: flar2
Price: Free
3.4
Download

Please take note that the version you are downloading is version 0.53 because older versions do not have the ability to remap Active Edge. Next, make sure that Active Edge is actually enabled on your phone. Once you've confirmed those two things, follow these steps:

  1. Open the Button Mapper application. Read through the setup pages as they explain what Button Mapper can and cannot do.
  2. At the bottom, you should see a tiny bar (called a snackbar) which asks you to enable Button Mapper's Accessibility Service. Tap Go and it will take you to the Accessibility Service page for Button Mapper.
  3. Enable Button Mapper's Accessibility Service.
  4. You should automatically be returned to the Button Mapper app. Under the Buttons header you should see an option for Active Edge. Select it.
  5. Tap Customize.
  6. The app will ask you to connect your phone to your computer and run a script. In order to do this, we need to setup the Android Debug Bridge.
  7. If you haven't already, go to Settings --> System --> About Phone and tap on the "Build Number" 7 times. You'll see a pop-up telling you that you are now a developer.
  8. Go back and in Settings --> System there should now be a Developer Options category. Enter this—it may ask for your pin/password.
  9. Scroll down and find USB Debugging. Enable it.
  10. Follow the steps in this previous tutorial to set up ADB on your particular computer's operating system (you can skip the "Phone Setup" part since you've already enabled USB Debugging).
  11. Open up a command prompt or terminal (depending on your OS) and enter the following command: adb shell sh /data/data/flar2.homebutton/keyevent.sh
  12. This will run a short script which will grant the Button Mapper application android.permission.READ_LOGS. It needs this permission to read system logs, which we will explain why in further detail below. You'll only ever have to grant this permission once unless you uninstall the app or factory reset your phone.
  13. Button Mapper will ask you to restart the application. Tap the button to let it restart the app.
  14. Once you're back in the app, tap on "Active Edge" again under the Buttons header. You can now select Customize and choose the action you want! Congrats, you've now remapped the Google Pixel 2 squeeze feature!

Explanation

Okay, a bit of a disclaimer here. This isn't truly remapping Active Edge, but hopefully it's so fast you won't ever notice Google Assistant popping up when squeezing your phone. What Button Mapper is doing is using an Accessibility Service to detect when Google Assistant is about to pop up, then it reads the system logs while filtering for something called "ElmyraService."

We discussed in our previous article how ElmyraService represents the Active Edge service so by filtering system logs for lines related to it, Button Mapper knows exactly when you squeeze your phone. As I said, it's not a perfect solution by any means because it's a fairly hacky method involving granting sensitive permissions (READ_LOGS), could potentially cause some slowdowns due to the nature of Accessibility Services, and it could even be patched by Google in a future update (all they would have to do is not write logs).

Flar2 says that he's been using it for the past day and it has been working well for him. Right now the only issue is avoiding having Google Assistant pop up when you squeeze, and to achieve that he forces the device to go to the home screen before launching the user-defined action. He added an experimental option in Button Mapper to stay in the current app without kicking you back to the home screen, but he says it isn't 100% consistent yet.

Still, this is the best (and for now, only) solution out there to take control of the squeezable frame on your Google Pixel 2 or Google Pixel 2 XL. With Button Mapper, you can make Active Edge do actions like open the camera, torch, web browser, or much more. The possibilities are endless, and what you choose depends entirely on your personal preference.