vendredi 17 août 2018

Does Android’s volume dialog take 20 seconds to dismiss? Here’s why that happens.

Android Volume Dialog

Have you noticed that the volume dialog that appears when you press the volume buttons takes a bit too long to disappear on its own? When you first got your Android phone, the volume dialog would automatically dismiss after a few seconds without your intervention. Then, sometime in the past few days, weeks, or months, it would take a long time to go away unless you tapped on your screen. If you're experiencing this problem and it infuriates you, you're not alone.

In this article, we're going to explain what's going on and why it happens so you can either fix the problem yourself or send this article to a developer so they can get it fixed. Let's first describe exactly what the problem is so it's clear we're referring to the same problem you're facing.

The Problem

You press the volume button on your Android smartphone or tablet to change the volume, but the volume dialog that appears takes a long time to go away on its own unless you tap on the screen to make it disappear. How long does the volume dialog stay up on its own? Exactly 20 seconds.

Credits: /u/ConeCandy

A popular thread over on Reddit's /r/GooglePixel subreddit had many users chiming in that they were facing this problem. However, not everyone was having this problem. Some users stated that their volume dialogs remained on screen for only 3 seconds, which is the normal behavior. So what was causing this issue? For most users in that thread, it turns out the reason was an app called Signal Spy – though some users in that thread said that other apps were causing this behavior too.

Signal Spy - Monitor Signal Strength & Data Usage (Free+, Google Play) →

Signal Spy is an app that's popular among subscribers to Google's Project Fi service. Project Fi users love the app because it supports analyzing your current network connectivity and supports automatic switching between Sprint and T-Mobile's towers. The best part? It doesn't need root access to switch between the networks. Signal Spy uses an Accessibility Service (a service that uses Android's Accessibility APIs which are normally used for assisting users with disabilities but are also regularly used in hundreds of apps not targeted towards users with disabilities) to automatically switch between carriers by inputting dialer code shortcuts.

Signal Spy's ability to automatically switch between carriers on Project Fi is incredibly useful, but it's also the reason Android's volume dialog issue is happening. The one commonality between Signal Spy and the other apps like LastPass, Fingerprint Gestures, Zoho Vault, Amazon Assistant, and other apps which cause this problem to occur is that they employ an Accessibility Service. Going to Settings –> Accessibility and turning off each Accessibility Service one-by-one until the volume dialog issue is fixed is one way to solve this problem. Why, then, do only some apps' Accessibility Services cause this to happen? Tasker, for instance, does not face this issue and neither does our very own Navigation Gestures app. You and many others on the Google Issue Tracker may think it's a bug, but it's actually not – it's entirely by design.

The Explanation

As we discovered during development of the Navigation Gestures app, the problem arises when an Accessibility Service has the accessibilityFeedbackType set to anything other than FEEDBACK_GENERIC. When we set our Accessibility Service to use FEEDBACK_HAPTIC, the volume dialog would stay on-screen for 20 seconds. When we set it to FEEDBACK_GENERIC, the volume dialog stays on-screen for 3 seconds.

The reason this occurs is because of two methods in the volume dialog implementation in AOSP. The first method called computeFeedbackEnabled checks to see if there are any enabled Accessibility Services that are "non-generic." If true, then the boolean mFeedbackEnabled is set to true. In the second method, computeTimeoutH, is mFeedbackEnabled returns true then the volume dialog's timeout is set to 20 seconds, otherwise it is set to 3 seconds.

Android Volume Dialog

These methods were added in the Android 6.0 Marshmallow release and thus this volume dialog issue affects all Android releases since Android Marshmallow including Android Nougat, Android Oreo, and Android Pie. We're not entirely sure why these methods were added as the commit descriptions weren't clear. Regardless, it's clear that this issue is not a bug but is rather entirely by design. Unfortunately, that means there's no "fix" for the issue outside of either persuading Google to alter this decision or convince app developers to not use non-generic feedback types in their Accessibility Services.

The developers of Signal Spy have already confirmed that they have fixed the issue in their next beta release, so if you experience the issue and want to see if fixed, you should point app developers towards this article so they're aware of the problem (as many are not aware.) If a future version of Android changes this behavior, we'll let you all know. At least you're now aware of this issue and what causes it, so you figure out which apps are causing this issue for you.



from xda-developers https://ift.tt/2vTdyUW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire