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:
		
						commit
						b1c435d3a4
					
				@ -127,9 +127,7 @@ public class FDroidApp extends Application {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public void applyTheme(Activity activity) {
 | 
					    public void applyTheme(Activity activity) {
 | 
				
			||||||
        activity.setTheme(getCurThemeResId());
 | 
					        activity.setTheme(getCurThemeResId());
 | 
				
			||||||
        if (Preferences.get().preventScreenshots()) {
 | 
					        setSecureWindow(activity);
 | 
				
			||||||
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static int getCurThemeResId() {
 | 
					    public static int getCurThemeResId() {
 | 
				
			||||||
@ -147,6 +145,13 @@ public class FDroidApp extends Application {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public void applyDialogTheme(Activity activity) {
 | 
					    public void applyDialogTheme(Activity activity) {
 | 
				
			||||||
        activity.setTheme(getCurDialogThemeResId());
 | 
					        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() {
 | 
					    private static int getCurDialogThemeResId() {
 | 
				
			||||||
 | 
				
			|||||||
@ -163,6 +163,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected void onCreate(Bundle savedInstanceState) {
 | 
					    protected void onCreate(Bundle savedInstanceState) {
 | 
				
			||||||
 | 
					        ((FDroidApp) getApplication()).setSecureWindow(this);
 | 
				
			||||||
        super.onCreate(savedInstanceState);
 | 
					        super.onCreate(savedInstanceState);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // The server should not be doing anything or occupying any (noticeable) resources
 | 
					        // The server should not be doing anything or occupying any (noticeable) resources
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user