Tech twist

Home » How to » How Android 13 could make back navigation more seamless

Google I/O 2022 is rapidly approaching. In just over two weeks, Google will have its largest developer conference of the year, and Android 13 will be a major topic of discussion. If you haven’t been keeping up, Google has already issued two developer previews and one beta, but the firm has been coy about many of the more significant improvements, as is customary. Google routinely announces major new Android features during I/O, and this year will be no exception.

The “predictive back navigation” mechanism, which will be fully discussed at a technical session on day 2 of I/O, will be one of the major new features. “How the future of Android will enable [developers] create predictive back navigation together with appealing animations,” the session titled “Back to the basics of System Back” will discuss.

When you hear the word “predictive,” the first thing that likely springs to mind is artificial intelligence. Google is known for developing numerous clever features, so it wouldn’t surprise you if they announced that machine learning would be used to better navigation. (They have actually experimented with utilising machine learning to improve back gesture recognition, though they haven’t spoken anything about it.) I’m afraid I can’t say for sure what will make Android 13’s “predictive back navigation” actually predictive, but I do have a notion of what those “pleasing animations” will look like, as well as some opinions on where Google is headed with this.

To provide some context, fullscreen gesture navigation was initially introduced by Google with Android 10. Android 10’s gestures replace Android’s standard 3-button navigation bar at the bottom with a thin pill that users can slide to navigate between apps, visit the recent apps overview, or return to the home screen.

Users can swipe inwards from either the left or right side of the screen to return. On both edges of the screen, there is an unseen trigger area that extends a specific distance from each side. The user-defined back sensitivity setting multiplied by the system default inset size determines the exact width of the trigger region. By placing a finger within the back gesture inset, the user can commence a back gesture, however the signal to go back will not be transmitted till the user drags their finger past a certain distance.

Google created trigger zones based on phone screen heatmaps that most people believe are ergonomic and one-handed friendly.

Due to the way many applications were constructed at the time, the change from button-based navigation to gestural navigation caused some friction at first, therefore Google supplied APIs to resolve conflicts and guidelines on how to update UI components to ensure compatibility with gestures. Most apps have been updated to operate with Android’s gestural navigation over time, therefore Google has focused on what occurs when a user wants to exit an app. Google modified what happens when a user tries to return to “launcher activities that are at the root of their tasks” in Android 12.Rather than completing the activity, the system places it in the background. This not only allows users to immediately continue the programme at a later time, but it also corresponds to how I believe many users use the back motion – to return to the home screen. Of course, it’s faster to merely swipe up to return home, but with over 3 billion Android devices in circulation, there will be plenty of people who have trained themselves to use their phones differently.

While the improvements to the activity lifetime in Android 12 lessen the number of times users have to entirely restart apps, they don’t address what I believe is another cause of friction: how the user is expected to know when returning to the app navigates up or quits it. Although the system manages the back stack between activities, individual activities can and frequently do have their own back stack that the system is unaware of. Furthermore, because apps can modify the behaviour of back navigation (as evidenced by the “are you sure you want to exit?” prompts), the system can’t forecast what will happen until it does. This, I believe, is the goal of Android 13’s new “predictive back navigation.”

I discovered that the Pixel Launcher’s Quickstep module has code hinting at a new back-to-home transition animation with the help of Kevin Barry, the developer of Nova Launcher. When swiping back, the app window will scale and follow the user’s finger as they swipe inward, in my opinion. If the user moves their finger beyond a certain distance for the back gesture to be triggered, another animation will play — the one from Android 12L, which gently animates the icon towards its home screen or app drawer destination.

Unfortunately, the Pixel Launcher is lacking a lot of code, so I can’t show you the new animation. It should, however, resemble the present swipe home gesture, with the exception of what “peeks” out from behind the user’s finger. It’s the wallpaper in the case of the swipe home gesture, and it should be a snapshot of the home screen in the case of the new back gesture (or app drawer). The user has a clearer understanding of what will happen when they finish the gesture by seeing the home screen or app drawer while they swipe back.

In order for this animation to work, Google will need to make a few adjustments to the way Android 13 handles back navigation. First and foremost, the system cannot wait for the user to swipe all the way to the trigger region before resizing and dragging the app window alongside their finger. It needs to start tracking this movement right away, which is where the system’s “back predictability progress threshold” comes into play, in my opinion. This threshold, I believe, is what the system uses to determine whether an inward swipe should be treated as a back swipe, even if it hasn’t been fully committed.This allows the system to begin animating before the user’s finger swipes out of the regular trigger area, completing the back gesture.

How apps handle back events is another thing that has to be changed. If apps continue to override back behaviour in the same manner they do now, the system will be unable to take action until the app determines what to do. However, Android 13 introduces a new API that allows apps to register back invocation callbacks. If the system detects that no handlers have been registered, it can “guess” that going back will return the user to their original location, and so play out the new back-to-home animation. If any layers have registered handlers, they will be called in the opposite order in which they were registered.As a result, Android can offer a new, more seamless back navigation experience while still allowing apps to handle bespoke navigation. That is, at least, what I believe will happen.

On builds with ro.debuggable=1, for each app Android 13 logs the value of the DISPATCH_BACK_INVOCATION_AHEAD_OF_TIME compat flag, the persist.debug.back_predictability system property, and the enableOnBackInvokedCallback Manifest attribute.

Unfortunately, because the predictive back navigation mechanism isn’t enabled by default in current Android 13 releases, I can’t say for sure how it will work or if this is the design idea underlying it. What I do know is that the new enableOnBackInvokedCallback Manifest attribute will be crucial, as it appears to be the only option for apps to choose whether or not to use the new predictive back navigation system. In code linked to requesting the “legacy” back behaviour, the framework references this flag, as well as the new compatibility flag DISPATCH BACK INVOCATION AHEAD OF TIME.We’ll have to wait and see whether apps must opt in or out of the new predictive back navigation system, and whether this applies to all Android 13 apps or just those aiming API level 33. I’m also interested in seeing how this will affect third-party launchers like Nova. Making new gestures operate seamlessly with third-party launchers hasn’t appeared to be a high priority for Google in the past, though they have shown interest in making improvements.

And that’s all about Android 13 update so far, if you need more information about the tech do check out our website and let us know your thoughts in the comment section below!

Leave a Comment

Your email address will not be published.