• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

General Cover Screen Support Campaign

Search This thread
Samsung has done it again with the proprietary meta-data and added their own requirements on using apps on the cover screen, not unlike their silly tags for VR and multi-window.

Do you use an app that wouldn't cause any privacy concerns on the cover screen? Notify the developers.

Any app that wants to run on the cover screen can add the following tag to the AndroidManifest to enable cover screen support for a designated activity

Code:
<meta-data android:name="com.samsung.android.activity.showWhenLocked" android:value="true"/>

They will also need to implement some minor detection of the current display. This is done to remain exclusively compatible with the cover widget and avoid displaying their activity above the standard lock screen.

Code:
mDisplayListener = object : DisplayListener {
    override fun onDisplayAdded(display: Int) {}
    override fun onDisplayChanged(display: Int) {
        if (display == 0)
            // Disable display above the lock screen
        else
            // Enable display above the lock screen
            // Technically irrelevant for this scenario
        }
    }
    override fun onDisplayRemoved(display: Int) {}
}

val manager = context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
manager.registerDisplayListener(mDisplayListener, Handler(Looper.getMainLooper()))

Display over the lock screen does not require "android.permission.DISABLE_KEYGUARD" because the lock screen remains enabled.

Code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
    setShowWhenLocked(true)
    setTurnScreenOn(true)
    val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
    keyguardManager.requestDismissKeyguard(this, null)
} else {
    this.window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
            WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
            WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
}

The actual code required to secure the phone would be the inverse of what is posted above, as the desired result is "normal" functionality.

Please feel free to direct any developers that want to add support and need help implementing it to this thread. I would be more than happy to help them get it up and running in an effort to expand support for cover screen compatibility.

Samsung has also limited the apps that can appear as cover screen widgets, but it will be even harder to impose these limits with more and more apps supporting cover screen functionality. Let's get Samsung to make the cover screen a feature and not a cheap novelty.
 
Last edited:

CarudiBu

Member
Aug 29, 2021
17
30
Geneva, Switzerland
It's frustrating since even if they didn't want custom apps on the front, it would be so easy for Samsung to open up cover screen widgets to any app. Even if they didn't want homescreen widgets appearing, they allow 3rd party apps to use the cover screen widget category to add them. The settings app (well, the cover screen settings are handled by the AOD app, but it seems from a UI perspective that it's part of the settings app) even supports detecting custom widgets and showing them in the list, but if it detects that it's not a system app or not Samsung Health it logs an error and doesn't show it in the list. I'll keep an eye on the AOD app and hopefully something will change, even if it's Samsung adding another package name to the allow list for another official widget as it would be an alternative to uninstalling SHealth.
 

tausift0

Member
Jun 9, 2011
25
1
Patna
Just wanted to inform that when you connect Samsung Buds then one extra widget gets available on the cover display to control it. Maybe it can be used instead of the SHealth.
 

tausift0

Member
Jun 9, 2011
25
1
Patna
I want to help but I am not a dev so I will continue sharing any ideas I can come up with.
Samsung has a feature call Dual Messagers through which we can have 2 copies of whatsapp installed. And people are able to install 2 copies of other apps too using that. Can we have 2 SHealth the same way?
Here is the link I found on xda on that:
 

CarudiBu

Member
Aug 29, 2021
17
30
Geneva, Switzerland
Just wanted to inform that when you connect Samsung Buds then one extra widget gets available on the cover display to control it. Maybe it can be used instead of the SHealth.
Unfortunately, the Galaxy Buds 2 Plugin package name can't be used to add a custom widget because the settings app checks whether the apps providing widgets are either system apps or signed with the platform key, with the exception of Samsung Health, before they are shown in the list.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    Samsung has done it again with the proprietary meta-data and added their own requirements on using apps on the cover screen, not unlike their silly tags for VR and multi-window.

    Do you use an app that wouldn't cause any privacy concerns on the cover screen? Notify the developers.

    Any app that wants to run on the cover screen can add the following tag to the AndroidManifest to enable cover screen support for a designated activity

    Code:
    <meta-data android:name="com.samsung.android.activity.showWhenLocked" android:value="true"/>

    They will also need to implement some minor detection of the current display. This is done to remain exclusively compatible with the cover widget and avoid displaying their activity above the standard lock screen.

    Code:
    mDisplayListener = object : DisplayListener {
        override fun onDisplayAdded(display: Int) {}
        override fun onDisplayChanged(display: Int) {
            if (display == 0)
                // Disable display above the lock screen
            else
                // Enable display above the lock screen
                // Technically irrelevant for this scenario
            }
        }
        override fun onDisplayRemoved(display: Int) {}
    }
    
    val manager = context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
    manager.registerDisplayListener(mDisplayListener, Handler(Looper.getMainLooper()))

    Display over the lock screen does not require "android.permission.DISABLE_KEYGUARD" because the lock screen remains enabled.

    Code:
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
        setShowWhenLocked(true)
        setTurnScreenOn(true)
        val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
        keyguardManager.requestDismissKeyguard(this, null)
    } else {
        this.window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
                WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
    }

    The actual code required to secure the phone would be the inverse of what is posted above, as the desired result is "normal" functionality.

    Please feel free to direct any developers that want to add support and need help implementing it to this thread. I would be more than happy to help them get it up and running in an effort to expand support for cover screen compatibility.

    Samsung has also limited the apps that can appear as cover screen widgets, but it will be even harder to impose these limits with more and more apps supporting cover screen functionality. Let's get Samsung to make the cover screen a feature and not a cheap novelty.
    1
    Did you happen to keep a log of the error?
    Error probably wasn't quite the right word. It logs 'Disallowed Tile' for every widget it finds that doesn't meet the criteria.