web-dev-qa-db-fra.com

Oreo (API 26) - drawOverlay + draw over barre d'état

Dans Android oreo, je ne peux plus utiliser WindowManager.LayoutParams.TYPE_SYSTEM_ERROR et dois plutôt utiliser WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY. L'inconvénient est que ce mode ne dessine pas sur la barre d'état.

Y a-t-il un moyen d'obtenir l'ancien comportement et de pouvoir également tirer sur la barre d'état? J'ai une application dans la barre latérale et jusqu'à présent, j'autorisais également l'utilisateur à avoir des zones de déclenchement en haut de l'écran, ce qui ne fonctionne plus maintenant, car la barre d'état recouvre maintenant la région tactile au dessus ...

N'importe quelle solution m'intéresse, même si ce n'est que pour certains appareils, comme les appareils enracinés, par exemple ... Comme je pense qu'il n'existe pas de solution normale à ce problème car le système Android ne le permet plus, comme indiqué dans la documentation ( https://developer.Android.com/about/versions/oreo/Android-8.0-changes.html#o-apps ). Néanmoins, cela ne signifie pas nécessairement qu'il n'y a pas de solution alternative ...

15
prom85

La documentation indique que l'indicateur est obsolète pour les applications non-système. Avez-vous essayé de faire de l'application une application système?

Cette constante était obsolète dans l'API de niveau 26. pour applications non-système .

Voici comment avec ES File Explorer:

Configure ES File Explorer by doing the following steps:
    Launch ES File Explorer.
    Select Menu and choose Settings.
    Under Settings, enable the options for Up to root and Root Explorer. A message will appear, requiring you to confirm your action. You will also need to confirm Superuser access.
    Enable Mount File System.
    Go back to the app’s main menu.
Get a copy of the APK (Android Package) of the app that you want to save as a system file by doing the following steps (skip to step 3 if you already have the app’s APK file):
    Install an app from the Google Play Store. For this guide, we will be using the app BioRhythms as an example.
    Launch ES File Explorer and navigate to /data/app.
    Locate the APK file that you want to install as a system app. If you don’t know the APK’s filename, simply go to the Google Play Store link of your chosen app. View the link and take note of the words after “?id=”. This will be your APK’s filename. For instance, the BioRhythms app link is https://play.google.com/store/apps/details?id=app.biorhythms. The BioRhythms’ APK is app.biorhythms-1.apk.
Create a backup of the chosen APK by copying it to the phone’s SD Card.
After creating a backup, long tap on the APK file and a menu will appear. Choose Cut. A blue arrow will appear at the bottom of the screen.
Go back to the main menu and navigate to /system/app/.
Drag the little arrow at the bottom of the screen. It will bring up the icon of the APK file.
Tap the APK file and it will be transferred to /system/app/.
Find the APK file in /system/app/. Press and hold it and a menu will appear.
Select Properties on the menu. The dialog properties will show up.
Tap Change and it will show the permissions dialog box.
Check the boxes for the following permissions in the dialog box:
    User: Read and Write
    Group: Read
    Other: Read
Select OK once the required settings have been made.
Reboot your device.
2
sfratini

Malheureusement, ce n'est plus possible ... 

Les développeurs qui utilisent cette fonctionnalité ont ouvert des rapports bug sur Android’s Issue Tracker (#260787 and #36574245) pour protester contre le changement et demander une alternative API, mais un googleur a commenté la tracker avec la déclaration suivante:

Statut: Non corrigé (comportement souhaité)

Nous avons fait un suivi auprès du produit et de l'équipe technique et avons suggéré aux développeurs d'utiliser les activités SHOW_WHEN_LOCKED pour afficher lorsque le périphérique est verrouillé, mais que cela ne soit intentionnellement plus possible afficher sur l'écran de verrouillage/sur l'ombre de la notification

et il n'y a qu'une solution pour cela que vous fixiez votre cible sdk à 25

2
chandrakant sharma

Je crains que vous ne puissiez pas le faire dans Android oreo, car Google a arrêté le support pour que cela passe par la ligne de notification jusqu'à la date. Peut-être qu’à l’avenir ils penseront peut-être à mettre cela en œuvre, car de nombreux développeurs protestent contre cela. 

Pour plus de détails, visitez les liens ci-dessous:

https://www.androidauthority.com/Android-o-draw-over-system-763178/

https://www.reddit.com/r/Android/comments/64ffk1/Android_o_is_breaking_apps_that_overlay_on_top_of/

0
M.Saad Lakhan