Screenlock doesn`t disable home key

oliverpa77 shared this problem 5 years ago
Not a Problem

Screenlock doesn`t disable the phones home key (all others are locked, like volume up/down, menu key, back key,...) so basically when I use Locus screen lock and put the phone away almost all the time I accidentally use the home key and the phone minimized locus and returns to the home screen :-(

Comments (26)

photo
0

Hi Oliver,


unfortunately it`s not problem of Locus. Android system do not allow to handle Home key button. Or at least, with quite a lot of searching I wasn`t able to find any way to do it, sorry ...

photo
2

Oh, I thought it was possible because I googled before asking and found a few stackoverflow links quoting code like this...


@override


public void onAttachedToWindow()


{


this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);


super.onAttachedToWindow();


}


Don`t know if that solves it though - never developed for android ;-)

photo
0

hmm nice. Seems that by some reactions on StackOverwflow, this solution works, but have one big issue. This have to be called just before activity (screen) is visible, I cannot change it dynamically when you enable "lock" in Locus


(after a while) - tested on Android 4.0.4 and it do not work with soft keys at all. I`m worried that such unofficial solution should do much more damage then good


is it really so bad with Home key?

photo
0

I was testing this on my ZTE Blade (A2.2) and noticed something else.


When I activate the screen lock thru the stand-by/pwr button, there is a period (5...10s) during which all buttons (home, menu, back and volume controls) turn the screen on.


After this period the phone is properly locked, only the stand-by button activates it.


So I have to be careful when I put the phone into its case!


Could the period be the same time that it takes to disable GPS?

photo
0

hmm Stebu don`t know, but I think that it have nothing to do with Locus. Or some Locus settings affect this behaviour.


also sorry Oliver, but for now I have to deny some work on this "issue", as I have no clear way, how to solve this. Android system do not allow to simply overwrite handling of home button and all possibilities work in very weird way ...

photo
1

Hi, I found a great app for this: Xposed additions which is part of the Xposed framework. This app allows you to override any of your phones keys with different actions for click, long press, double click...

I've used this to override the home screen when the screen is turned off. Great solution!

You do need a rooted phone though...

photo
1

Hello Oliver,


as you wrote "you need a rooted phone". So such solution is some dirty hack, that I do not want to add into Locus, sorry.

photo
1

Eh? You already said a long time ago that you won't include this in Locus. What I explained in my previous post is a way to get the desired result without the need for you to do anything. The app I mentioned works independently of Locus but can be used to solve a locus issue. Not that everyone will see the current home button behaviour as an issue as users are different with different needs. I just wanted to help those that have the same issue I had.

photo
1

Ah, sorry.


I though that you want from me, to include mentioned "xposed framework" directly to Locus. Now I finally understand. 3rd party app that do, what Locus can't. Perfect, thanks for information and sorry for my miss-understanding.

photo
1

No, no, that would be overkill for many users...

Just wanted to share a trick :-)

No harm done, have a great day!

photo
1

Hi, how is the state of this problem? It would be really nice if it’s planed for implementation.


I'm new here and I have the same problem. But I'm influenced much harder because I use Locus at rain. And for this usage locus is complete useless on the most capacitive touchscreen devices with the old button bar because the rain always activate the home button.

I have search for an application based solution for locking the home screen because you have trouble to find a way without root permissions and without reboot.


And here it is: https://github.com/shaobin0604/Android-HomeKey-Locker

It works fine on Android 4.4.4. Could you implement this in locus?


Unfortunately I can't use it outside of locus by calling an external app, because this solution is based on a dialog overlay, and does not work across applications. That means it has to be implemented in Locus.


https://github.com/shaobin0604/Android-HomeKey-Locker/blob/master/HomeLockerLib/src/main/java/io/github/homelocker/lib/HomeKeyLocker.java


I have read a little bit about the current workload of the locus developer.

I'm employed as a java developer and I need this locking feature for my rainy holidays in Scotland.

Could an addon create an invisible dialog on the locus main screen to lock the home button?

If the current addon integration does support this, then I would try to create an addon to get this feature as soon as possible.

Unfortunanly I have no experience in android development, it could take a while for me to create an locus addon.

But according to http://forum.locusmap.eu/index.php?topic=530.0 I have to ask Menion anyway to get access to the API.


Or is it possible for the pro owners to build an own locus version? Maybe that could be a little bit easier for a quick solution.


Please tell me how I could support you to get this feature ASAP into locus.

photo
1

Hello Falco,


I've marked this as a "not a problem", becuase there is currently not a simple solution.


Solution you mention is quite nice, but has one major negative.


It require new additional permission:

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>


Locus already has quite a lot of permissions and I'm now really careful about adding some more new.


Also in this case, it helps only on a software buttons, so it won't work on all devices.


About add-on: currently there is no need to use any API or make this as an add-on for a Locus. You only needs to create a fully transparent dialog that will cover whole Locus. So you may try already existing sample app that may works for this purpose.

photo
1

Thanks for your quick response.


I understand the problem with the permissions. And I also figured out that the most outdoor devices don't use capacitive home buttons anymore.

But for all exiting devices with capacitve hardware buttons (most of then are not water proof anyway) it is still a problem at rain. The most popular waterproof device with capacitve home button is the motorola defy. But it's much more painfull to have one of this expensive special outdoor devices with capacitive home buttons


If you have such a device, then its quite hard to use locus under wet conditions. Because it can occur during navigating and you will lose your map and after locus is closed you can't click on the locus icon anymore because you have a wet touchscreen :(

After you find a dry place to get your touchscreen dry you could use it only some minutes until the home button is activated again and you start all over.


So far about the influenced user and the level of influence.


"it helps only on a software buttons, so it won't work on all devices." According to the guy which find this work around, it's vice versa. It does only work on devices with a real button bar (even if it is a capazitive button bar) and does not work on the pure software button bar which is displayed on the screen.

But the point is, that more and more new indoor devices does get a software button bar like nexus.


Lets talk about we could find a solution for users with capacitive hardware button bar, even if it could not controlled over the locus unlock action.


1. What did you mean with "dialog that will cover whole Locus"? You should still be able to unlock the locus screen lock by swipe, I guess that wouldn't work if you have a invisible dialog that will cover locus, it should be an dialog with 0 width and 0 hight, isn't it? Or did I miss understand you?


2. Did you mean the sample app from github? I'm not sure how I could use it, because an app which use this solution have to be active. I guess it is not possible to make a transparent application to see my locus track throw an external application.


To be more exact, the goal is to see my locus track on map with locked touchscreen and locked button bar to prevent water activated touchscreen actions.

photo
2

Hmm

you have android with 4.4+ version? Because in this case, Locus is now able to hide top system bar and also bottom software buttons. In this case "lock screen" works perfectly, because on screen is nothing that should interupt this lock. Suggest to try it.


If you say it works by author opposite then I wrote, then I probably incorrectly understand it's point. It's possible :).


1. "dialog that cover Locus" is what I thought that this solution do.


2. It's still possible to create application that will be just a transparent dialog. But I'm worried it may cause some troubles in Locus, because in this case, Locus will not be in foreground, but behing other "invisible" application. To be true, hard to say now how it will works.


So best solution should be combination of current screen lock and full screen mode on Android 4.4+.

photo
1

very nice to have such quick responses, thank you very much.


But sorry for the miss understanding.

Yes I have Android 4.4.4 but I didn't have a software button bar. I have hardware buttons which can't be hidden, thease buttons are not displayed on my lcd these are separated as button bar.


But this full screen solution is the point for software button users like nexus and all other new indoor devices. These users doesn't have the screen lock bug, they could just use full screen mode.


1) the solution is to have an open dialog, but this should not cover the application because you may want to have touch events. For locus the swipe event should work in locked state. Author use width=0px and hight=0px to achieve this.


2) I guess a new application does close the application in background? But if not, than it will be perfect. I would create an app which could be started by locus. To close it I implement a close swipe. On usage i could just swipe over the screen and everything is fine :)


Did you know a demo of transparent applications? I would try to see that locus is still visible in background and does still update UI elements in background.

photo
1

Thanks a lot for the tip with the transparent application. I really doesn't except that you could do this on a mobile operating system.


It work great and without delay of the locus UI. I will share my app with sources after I have implemented the swipe unlock at the weekend. This little app will do the whole locus screen lock feature + home key lock.

photo
1

And here it is:

apk and src are attached as zip. Just install the apk if you trust me, otherwise you could compile it by your own.

photo
1

thanks!!!

photo
1

Zip file is currupted @Falco.

photo
1

Here is a new upload

photo
1

How to disable home key Sir?

photo
1

Just execut the TouchLock app, it will but an invisible system overlay, which can't be overriden by Homekey launcher execution.

This did work with Android 4. I'm not sure about 5 and 6, my old Devy doesn't support 5 or 6. And my new S4 mini does not need this because of an hardware home button.

photo
1

Hi Sir..Good Evening....


I need your help Sir...

How to disable notification pannel bar because i create pattern lock app sir..

i used "getWindow().addFlags(WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY);" but in this code no using so please help me sir...

please give source code sir...

photo
1

You can't disable touch on this bar, but you can hide it. It's an application setting. You find it related to fullscreen. Transluent mode is related to it.

photo
photo
1

Nice and fast work Falco, congratulations ;)