properly clear the flag

Signed-off-by: parneet-guraya <gurayaparneet@gmail.com>
This commit is contained in:
parneet-guraya 2024-09-09 06:09:26 +05:30
parent a8268cd7d2
commit a26562bd5d
No known key found for this signature in database
GPG key ID: 63B807C4B2A9064B
2 changed files with 10 additions and 1 deletions

View file

@ -101,7 +101,7 @@ open class BaseActivity : AppCompatActivity() {
disableKeyboardPersonalisedLearning(viewGroup) disableKeyboardPersonalisedLearning(viewGroup)
} }
if (appPreferences.isScreenSecured || appPreferences.isScreenLocked) { if (appPreferences.isScreenSecured) {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE) window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
} else { } else {
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE) window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)

View file

@ -14,6 +14,7 @@ import android.content.Context
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import android.view.WindowManager
import androidx.activity.result.ActivityResult import androidx.activity.result.ActivityResult
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
@ -49,6 +50,9 @@ class LockedActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this) NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
binding = ActivityLockedBinding.inflate(layoutInflater) binding = ActivityLockedBinding.inflate(layoutInflater)
@ -144,6 +148,11 @@ class LockedActivity : AppCompatActivity() {
} }
} }
override fun onDestroy() {
super.onDestroy()
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
}
companion object { companion object {
private val TAG = LockedActivity::class.java.simpleName private val TAG = LockedActivity::class.java.simpleName
} }