I've got an Identified call app which worked very good till android 5+.
Basically I've got a BroadcastReceiver which "do his thing" when phone rings after identifying the call I add a small view.
on a new galaxy edge s6 it doesn't work when the phone is locked.
here is my related code
wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, // TYPE_PHONE
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.CENTER;
wm.addView(app.PhoneLayout, params);
app.PhoneLayout contains the layout after inflating etc..
Does anyone have any idea why such thing happen? and how am I able to fix that so that my view will be shown even when the phone is locked?
It's working fine on older devices.
Hope someone can share his thoughts on this
Related
Here's my code
val params = WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
PixelFormat.TRANSLUCENT
)
my end goal is to create a overlay that will lessen the overall brightness of the screen.
everything is working, i can tap/access all of the icon from other app.
The issue is, soft keyboard is not showing.
the device I am using is a Asus Zenfone 6 (Android 5.0)
I'm making an overlay by adding views directly to the window using WindowManager. However, I can't seem to find flags necessary to do what chathead does, which is to have the overlay on top of the soft keyboard. My overlay always gets covered by keyboard when it pops up.
this is the params I am using for my views that are added to the window
private WindowManager.LayoutParams touchableParams = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
Don't know your other requirements. I have been using this setup under Android 7.1.12 on a Google Pixel to make the overlay show on top of the soft keyboard. Hopefully this is what your are looking for.
mWindowsParams = new WindowManager.LayoutParams(
width,
height,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
I need to display my view on top of dialer application, so I was using TYPE_PHONE for this purpose which is touchable, but still on some devices like Nexus 5 dialer application of device is hiding it.
Tried using TYPE_SYSTEM_OVERLAY makes view visible on top of dialer application, but touch is not there. Any help regarding this will be great.
After lot of searching for above problem, I found solution my self. Here it is how I made view to be on top of everything inside device and also making it touchable which was not possible with TYPE_SYSTEM_OVERLAY.
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSPARENT);
params.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
wm.addView(view, params);
I am using these parameters to show an image on the screen. (this is running on a service cause of that i am using windowmanager instead of usual way- the image comes and goes continuesly)
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
PixelFormat.TRANSLUCENT
);
The Point is when I use FLAG_NOT_TOUCHABLE it allows user's touch go through the Picture, Which is fine and it is what I want. but when there is a need for text entry the keyboard keeps disappering (I want it to be there so I am able to input text even though the Picture is overlapping). this works for buttons and other input but the the keybord vanishes. How can I keep both?
changing WindowManager.LayoutParams.TYPE_PHONE to WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY solved the problem.
My android application should work in envioriment with lots of EMI. Unfortunately EMI sometimes triggers touchscreen events. Those triggers seems to be random, so it's possible to filter them out.
I want to create overlay window that receives all touchscreen events, filters them and passes to my activity's controls or system's statusbar.
I've created transparent overlay window to have something to start with:
WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
WindowManager wm = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
LayoutInflater inflater = (LayoutInflater)getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ViewGroup mTopView = (ViewGroup) inflater.inflate(R.layout.touch_filter_overlay, null);
wm.addView(mTopView, wmParams);
I think I can subclass ViewGroup to receive messages, but how can I then send processed messages to background controls?
Maybe there is another solution to my problem?
Thank you!
The false screen detection and filtering is also the responsibility of the touch screen sensor, on the electronics component.
Some touch screen sensors are using dedicated electronics filters, plus high-end filtering algorithms to reject the false touches.
That's why I suggest you change your smartphone, and find one that is EMI proof.