Remap the Pixel 2 squeeze function with Button Mapper
There are a few caveats thoughBy David Matthews
Some would say the squeeze function on the HTC U11 and Pixel 2 are gimmicks. However, one could argue that being able to simply squeeze the phone to illicit some response or action could be quite useful. The U11 allows you to remap the squeeze function to different actions while the Pixel 2 only allows you to silence calls or open the Google Assistant. Fortunately, XDA has found an app called Button Mapper that lets you remap the squeeze feature on the Pixel 2 phones.
Button Mapper changes the squeeze function to do many things such as launching the flashlight, going back to the home screen, turning on Do Not Disturb or opening your favorite app. However, XDA also points out that Button Mapper doesn't literally remap the button but in fact intercepts the instruction to launch the Google Assistant and issues another command instead.
Button Mapper developer, Flar2, says the main issue is having the Assistant pop once the phone is squeezed. To get around that, he forces the phone to go back to the home screen before issuing the user-defined action.
Yes, it's basically a hack but for those who eschew security for convenience, it may be a plausible workaround. As a further caveat, it does involve granting sensitive permissions, could cause slowdowns and could be patched by Google. If you're okay with those caveats, see the steps below:
- Open the Button Mapper application. Read through the setup pages as they explain what Button Mapper can and cannot do.
- 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.
- Enable Button Mapper's Accessibility Service.
- You should automatically be returned to the Button Mapper app. Under the Buttons header, you should see an option for Active Edge. Select it.
- Tap Customize.
- The app will ask you to connect your phone to your computer and run a script. In order to do this, we need to set up the Android Debug Bridge.
- If you haven't already, go to Settings -> System -> About Phone and tap on the "Build Number" seven times. You'll see a pop-up telling you that you are now a developer.
- Go back and in Settings -> System there should now be a Developer Options category. Enter this---it may ask for your PIN/password.
- Scroll down and find USB Debugging. Enable it.
- 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).
- 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
- 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). You'll only ever have to grant this permission once unless you uninstall the app or factory reset your phone.
- Button Mapper will ask you to restart the application. Tap the button to let it restart the app.
- 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!