Подтвердить что ты не робот

Oreo (API 26) - drawOverlay + рисовать по строке состояния

В android oreo я больше не могу использовать WindowManager.LayoutParams.TYPE_SYSTEM_ERROR и вместо этого должен использовать WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY. Недостатком является то, что этот режим не нарисовывает панель состояния.

Есть ли все-таки, чтобы достичь старого поведения и иметь возможность нарисовать панель состояния? У меня есть приложение боковой панели, и до сих пор я разрешал пользователю иметь триггерные области поверх экрана, и теперь это не работает, потому что строка состояния перекрывает осязаемую область сверху...

Меня интересует любое решение, даже если оно используется только для некоторых устройств, например, для корневых устройств... Как я считаю, для этой проблемы нет нормального решения, потому что система Android не позволяет этого больше, как указано в docs (https://developer.android.com/about/versions/oreo/android-8.0-changes.html#o-apps). Тем не менее, это не обязательно означает, что альтернативного решения нет...

4b9b3361

Ответ 1

В документах указано, что флаг устарел для несистемных приложений. Вы пытались сделать приложение системным приложением?

Эта константа устарела для API уровня 26. для несистемных приложений.

Вот как с 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

К сожалению, это уже невозможно...

Разработчики, которые используют эту функцию, открыли bug отчеты Android’s Issue Tracker (#260787 and #36574245) в знак протеста против изменения и попросили альтернативу API, но Googler прокомментировал tracker со следующим утверждением:

Статус: Wont Fix (Предполагаемое поведение)

Мы продолжили работу с командой разработчиков продуктов и инженерии и получили предложение о том, что разработчики могут использовать SHOW_WHEN_LOCKED для показа когда устройство заблокировано, но намеренно уже невозможно для отображения по экрану блокировки/над оттенком уведомления

и для этого есть только решение, которое вы установили для своей цели sdk как 25

Ответ 3

Я боюсь, что вы не можете сделать это в orroid oreo, так как Google остановила поддержку для того, чтобы нарисовать линию уведомлений до даты. Возможно, в будущем они могут подумать о том, чтобы реализовать это, так как многие разработчики протестуют против этого.

Подробнее см. ниже:

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/