From 925e36d560f6f0bac6168891523a3457ef1ec934 Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Thu, 16 May 2024 10:10:04 +0200 Subject: [PATCH] Prevent app content from being captured in screenshots or apps view --- .changelog/1940.feature.md | 1 + .../java/com/oasisprotocol/wallet/MainActivity.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .changelog/1940.feature.md diff --git a/.changelog/1940.feature.md b/.changelog/1940.feature.md new file mode 100644 index 0000000000..a1ca090b62 --- /dev/null +++ b/.changelog/1940.feature.md @@ -0,0 +1 @@ +Prevent app content from being captured in screenshots or apps view diff --git a/android/app/src/main/java/com/oasisprotocol/wallet/MainActivity.java b/android/app/src/main/java/com/oasisprotocol/wallet/MainActivity.java index 2872d1467f..ac667dde47 100644 --- a/android/app/src/main/java/com/oasisprotocol/wallet/MainActivity.java +++ b/android/app/src/main/java/com/oasisprotocol/wallet/MainActivity.java @@ -1,5 +1,16 @@ package com.oasisprotocol.wallet; +import android.os.Bundle; +import android.view.WindowManager; import com.getcapacitor.BridgeActivity; -public class MainActivity extends BridgeActivity {} +public class MainActivity extends BridgeActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Set secure flag to prevent app content from being captured in screenshots or recent apps view + getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, + WindowManager.LayoutParams.FLAG_SECURE); + } +}