Merge branch '1277-fix-screenshot-prevention' into 'master'

Make sure FLAG_SECURE is set on all activities when activated

Closes #1277

See merge request fdroid/fdroidclient!627
This commit is contained in:
Hans-Christoph Steiner 2018-01-15 15:27:44 +00:00
commit b1c435d3a4
2 changed files with 9 additions and 3 deletions

View File

@ -127,9 +127,7 @@ public class FDroidApp extends Application {
public void applyTheme(Activity activity) {
activity.setTheme(getCurThemeResId());
if (Preferences.get().preventScreenshots()) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
setSecureWindow(activity);
}
public static int getCurThemeResId() {
@ -147,6 +145,13 @@ public class FDroidApp extends Application {
public void applyDialogTheme(Activity activity) {
activity.setTheme(getCurDialogThemeResId());
setSecureWindow(activity);
}
public void setSecureWindow(Activity activity) {
if (Preferences.get().preventScreenshots()) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
}
private static int getCurDialogThemeResId() {

View File

@ -163,6 +163,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
((FDroidApp) getApplication()).setSecureWindow(this);
super.onCreate(savedInstanceState);
// The server should not be doing anything or occupying any (noticeable) resources