Oreo (API 26) - drawOverlay + draw over status bar - android

In android oreo, I can't use WindowManager.LayoutParams.TYPE_SYSTEM_ERROR anymore and must use WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY instead. The drawback is, that this mode does not draw over the statusbar.
Is there anyway to achieve the old behaviour and be able to draw over the statusbar as well? I've a sidebar app and until now, I allowed the user to have trigger areas on top of the screen as well, which does not work anymore now, because the status bar is overlapping the touchable region on top now...
I'm interested in ANY solution, even if it's only for some devices, like rooted devices for example... As I think there is not normal solution for this problem because the android system does not allow this anymore as stated in the docs (https://developer.android.com/about/versions/oreo/android-8.0-changes.html#o-apps). Still, this does not necessary mean that there is no alternative solution...

Unfortunately, this is no longer possible...
Developers that utilize this feature have opened bug reports on Android’s Issue Tracker (#260787 and #36574245) to protest the change and ask for an alternative API, but a Googler commented on the tracker with the following statement:
Status: Won’t Fix (Intended Behavior)
We have followed up with the product and engineering team and got suggestion that developers can use SHOW_WHEN_LOCKED activities to show
when the device is locked, but it is intentionally no longer possible
to show over the lockscreen / over the notification shade
and there is only solution for this that you set your target sdk as 25

The docs says that the flag is deprecated for non-system apps. Have you tried making the app a system app?
This constant was deprecated in API level 26. for non-system apps.
Here is how with 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.

I m afraid you cant do that in android oreo as google stopped support for that to draw over notification line till date. May be in future they might think to implement that too as many developers are protesting against that.
For more details visit links below:
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/

Related

How to create a system app for custom ROM

We have a custom ROM for a device we are making and what I want to do is make our own custom Settings app to replace the settings app that comes already built in android.
I cant really find any documentation on how to even create a system app. It does not appear you can create it in Android Studio, I tried looking on the AOSP site and didnt find anything there related to creating system apps. The few things I did find were on here where you would put android:sharedUserId="android.uid.system" in your manifest and then has to be signed with the same key as the ROM but after that I cant find anything.
The settings app I want to create would need access to the framework.jar to be able to use the hidden framework API's.
Does anyone have any information or know where I can find this information on how to go about actually creating a system app?
You may want to research how to make a Device Tree Overlay (dto). Basically it is your code, reformatting the base code, into what you want. https://source.android.com/devices/architecture/dto?hl=en
Since you said you use Gradle, you should put first build you apk and put them in you vender folder, and next important thing is to create a mk/bp file to tell the Android build system how to deal with this pre-built apk.
P.S. If you system app highly depends on Android hidden api, make sure you have the right version of framework.jar in you Android Studio project, or, as what I alway did, create apps directly in AOSP, in this case, you can just check the code structure of the original Settings app in AOSP
this tutorial may help you.

Access to the path resources.apk.bk is denied

When using Visual Studio 2017 and building a Xamarin project for Android I get the following error:
access to the path resources.apk.bk is denied
I've been getting this error for over 4 years and I know it's related to McAfee Enterprise but I still can't seem to fix it and the web has been no help. Every once in a while I take some time out and try again to fix it. Persistence paid off and I finally found the fix shown below.
You have to exclude resources.apk.bk from McAfee Enterprise OnAccess scanning but the trick is to configure it properly and the method is confusing.
I struggled with this because I kept adding resources.apk.bk to the "On-Demand" exclusions but that won't work, you have to add it to the "On-Access" exclusions.
There are 2 ways to fix it. If you have permission to configure your own McAfee client then I provide instructions below. Otherwise you have to have your McAfee administrator fix it which I show below as well.
McAfee Admin Instructions:
This step should be performed on the McAfee Enterprise server by your McAfee Enterprise Admin. Add resources.apk.bk to the "On-Access" exclusions, make sure they know it's for "On-Access" and not "On-Demand".
Fix you can do yourself if you have permission
Right-Click on the McAfee icon in your task bar and click on "McAfee Endpoint Security".
Assuming it's password protected, login with the admin password.
In the green bar near the top click the text "Threat Prevention"
Click "Show Advanced" button on the right
Click "On-Access Scan" on the left
Scroll down a little further until you see the Exclusions box
Click Add
within the top input box type in resources.apk.bk then click "Ok"
Click "Apply" at the top right.
You should now be able to rebuild your Xamarin Forms Android project without receiving the error.
NOTE!
Keep in mind, if you configure your McAfee yourself, depending on how your McAfee Enterprise is setup your configuration may be overwritten at any moment, because most McAfee Enterprise setups overwrite your own configurations every 5 minutes because they want to make sure everyone is applying a policy that management requires.

Re-add Cyanogenmod's CustomTile after it was manually removed

I'm toying with a very simple app that just adds a quick settings tile using Cyanogenmod CustomTile API.
Everything works (my app's code closely resembles the CM SDK sample app), except for a single scenario. The problem is, once I've manually removed the tile I can't find any way to add it back.
I've tapped "edit tiles" and deleted my app's tile. Now calls to CMStatusBarManager.publishTile don't seem to have any effect (I've surely tried to restart the app) and the only tiles listed for manual addition are the system ones. Uninstalling the app and re-installing it works, but I want to handle this scenario in somewhat more user-friendly fashion.
It would be best if I only could register the tile to be listed along the system ones in "edit tiles" mode, but I guess there's no API for this at the moment. Another acceptable solution is a way to re-add the tile (I'll just show a warning that tile was removed and a button to re-add it).
The question is specifically about CyanogenMod 12.1 and 13. Right now I don't care about any upcoming Android N stuff — I just want to make a user-level application specifically for CM-based ROMs of a certain phone have a feature and be on par with stock ROM.

How to remove 'unremovable' consoles from eclipse

I don't work with android all the time, sometimes I am working with a server/client app and I need to check the console output of both. What I used to be able to do was pressing the little blue monitor button on the console view to toggle between the two. But now it also have other 3 irremovable consoles(DDMS, OpenGL Trace View, Android) that I don't use, not even when developing for android. What I want to know is how to permanently remove those 3 console views. I don't want to have separated eclipse installations nor having to install/uninstall plugins whenever I am not developing for android.
I am prepared to delete/modify plugin source files, however I don't even know what I would be looking for
You don't have to modify .
1)Go to "windows->open perspective" and choose it for yourself
2) Or go to windows->show perspective select as it suits you.

Is this a built in drawable?

In this linked image , I see the button on the right quite often in a lot of apps. On my Moto Droid, it is used extensively in the settings app. It is also used as the default AlertDialog icon. Can I use this via a android.r.drawable?
The icon is built-in with the Android development, you can access the image by using R.drawable.ic_dialog_menu_generic
While it may be possible to use it via android.R.drawable, you may want to find the image in the resources that come with your SDK ($ANDROID_HOME/platforms/$VERSION/data/res, where $ANDROID_HOME is where you have the SDK installed and $VERSION is a relevant Android API level). So, per Mr. Forloney's answer, you'll find that in, say, drawable-hdpi/ic_dialog_menu_generic.png in the aforementioned directory. Then, copy that image into your project. While it will add 5K to your project size, it will mean that the icon does not change based upon OEM or Android changes.

Categories

Resources