user3141401
user3141401

Reputation: 37

Draw view over call screen on oreo device

I am trying to show popup view (like truecaller) on the incoming call screen. It is working fine on an emulator for oreo and all the devices till nougat, in both cases locked and unlocked. But on One Plus 5t (oreo) it is just working while the device is unlocked. When the device is locked, view is just behind the incoming call screen.

I am trying to add a view using service by given LayoutParams

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            AppLog.showLog(CLASS_TAG, "Device is oreo");
            params1 = new WindowManager.LayoutParams(
                    WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.WRAP_CONTENT,
                    WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
                    PixelFormat.TRANSPARENT);
        } else {
            AppLog.showLog(CLASS_TAG, "Device is less than oreo");
            params1 = new WindowManager.LayoutParams(
                    WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.WRAP_CONTENT,
                    WindowManager.LayoutParams.TYPE_SYSTEM_ALERT | WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
                    PixelFormat.TRANSPARENT);
        }
        params1.gravity = Gravity.CENTER_VERTICAL;

with

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

Is there anything I am missing?? Please help...

Upvotes: 1

Views: 712

Answers (1)

Pavan K
Pavan K

Reputation: 1

It's no longer possible to draw over the lockscreen and other important UI elements (status bar, etc) Google removed this feature in Android O.

Source: https://issuetracker.google.com/issues/36574245

Upvotes: 0

Related Questions