Skip to content

Commit

Permalink
Add Hide screen content in recent apps
Browse files Browse the repository at this point in the history
  • Loading branch information
AsemLab committed Oct 2, 2024
1 parent a1c0519 commit f82e8c6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/src/main/java/com/asemlab/samples/ui/BiometricActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.view.WindowManager
import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.activity.result.contract.ActivityResultContracts
Expand Down Expand Up @@ -97,4 +98,16 @@ class BiometricActivity : AppCompatActivity() {
}
}
}

// TODO Hide screen content in recent apps screen
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (hasFocus) {
// Remove when back to activity
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
} else {
// TODO Prevent screenshot
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
}
}
}

0 comments on commit f82e8c6

Please sign in to comment.