Hi! Is there a way to enable gesture navigation from ADB directly? Can I hide the small bar indicator at the bottom using ADB too? Note that I am using a GSI rom (AOSP)
Assistant
Yes, you can enable gesture navigation and hide the navigation bar indicator on your device running a GSI (Generic System Image) ROM based on AOSP (Android Open Source Project) using ADB (Android Debug Bridge). Below are the steps and commands you can use to achieve this:
Prerequisites
ADB Installed: Ensure that you have ADB installed on your computer. If not, you can download it from the Android SDK Platform-Tools and follow the installation instructions for your operating system.
USB Debugging Enabled: On your Android device, enable Developer Options and then USB Debugging:
Go to Settings > About phone.
Tap Build number seven times to enable Developer Options.
Go back to Settings, select Developer Options, and enable USB Debugging.
Connect Your Device: Connect your Android device to your computer via USB and ensure that ADB recognizes it by running:
bash
adb devices
You should see your device listed. If prompted on your device, authorize the computer for USB debugging.
1. Enable Gesture Navigation
Gesture navigation replaces the traditional 3-button navigation with swipe gestures, providing a more immersive experience.
Command to Enable Gesture Navigation:
bash
adb shell settings put secure system_navigation_keys_enabled 0
Alternative Commands (Depending on Android Version):
For some versions, you might need to use:
bash
adb shell settings put secure navigation_mode 2
Or:
bash
adb shell settings put secure gesture_navigation_enabled 1
Explanation:
system_navigation_keys_enabled 0: Disables the traditional navigation keys, enabling gesture navigation.
navigation_mode 2: Sets the navigation mode to gestures (values may vary based on Android versions).
gesture_navigation_enabled 1: Specifically enables gesture navigation if supported.
Note: The exact setting key (system_navigation_keys_enabled, navigation_mode, or gesture_navigation_enabled) may vary depending on the specific AOSP version or custom ROM you are using. If one command doesn't work, try the others.
2. Hide the Navigation Bar Indicator
The navigation bar indicator is the small bar or handle at the bottom of the screen that indicates gesture navigation is active. To hide it, you can enable immersive mode using ADB.
Command to Hide Navigation Bar Indicator:
bash
adb shell settings put global policy_control immersive.navigation=*
Alternative Commands:
To hide both the status bar and navigation bar:
bash
adb shell settings put global policy_control immersive.full=*
To make immersive mode apply only to specific apps, replace * with the package name, e.g., com.example.app.
Explanation:
policy_control immersive.navigation=*: Forces immersive mode for navigation, hiding the navigation bar indicator across all apps.
policy_control immersive.full=*: Forces immersive mode for both status and navigation bars.
3. Apply Changes Immediately
After running the above commands, you might need to restart the System UI for changes to take effect without rebooting your device.
Command to Restart System UI:
bash
adb shell pkill -TERM com.android.systemui
Alternatively, Reboot Your Device:
bash
adb reboot
4. Reverting the Changes
If you wish to revert back to the traditional navigation or disable immersive mode, use the following commands:
Re-enable Traditional Navigation:
bash
adb shell settings put secure system_navigation_keys_enabled 1
Or, depending on the command used earlier:
bash
adb shell settings put secure navigation_mode 0
adb shell settings put secure gesture_navigation_enabled 0
Disable Immersive Mode:
bash
adb shell settings put global policy_control null
Restart System UI or Reboot:
bash
adb shell pkill -TERM com.android.systemui
Or:
bash
adb reboot
Additional Notes
Compatibility: The exact commands and settings keys can vary based on the Android version and the specific AOSP build of your GSI ROM. If one command doesn’t work, try the alternatives mentioned above.
Caution: Modifying system settings via ADB can potentially lead to unexpected behavior. It's recommended to proceed with caution and ensure you have backups or a way to restore your device if something goes wrong.
No Root Required: These commands typically do not require root access, especially on AOSP-based systems where such settings are accessible. However, some custom ROMs or specific device configurations might have restrictions.
By following the above steps, you should be able to enable gesture navigation and hide the navigation bar indicator on your AOSP-based GSI ROM using ADB.