diff --git a/res/values/strings.xml b/res/values/strings.xml
index 747614df0f..d57c71c72e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -686,7 +686,7 @@
Disable local encryption of messages and keys
Screen security
Automatically complete key exchanges for new sessions or for existing sessions with the same identity key
- Disable screen security to allow screen shots
+ Block screenshots in the recents list and inside the app
Forget passphrase from memory after some interval
Timeout passphrase
Select passphrase timeout
diff --git a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java
index c86cf5c63b..6c503bd7e5 100644
--- a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java
+++ b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java
@@ -217,8 +217,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
pushSmsCategory.removePreference(defaultPreference);
}
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 &&
- advancedCategory != null &&
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH &&
+ advancedCategory != null &&
screenSecurityPreference != null)
{
advancedCategory.removePreference(screenSecurityPreference);
diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java
index 072bf79497..cad315e353 100644
--- a/src/org/thoughtcrime/securesms/ConversationActivity.java
+++ b/src/org/thoughtcrime/securesms/ConversationActivity.java
@@ -690,6 +690,14 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
drawables.recycle();
calculateCharactersRemaining();
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ if (TextSecurePreferences.isScreenSecurityEnabled(this)) {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ } else {
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ }
+ }
}
private void initializeMmsEnabledCheck() {
@@ -753,10 +761,6 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
});
registerForContextMenu(sendButton);
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && TextSecurePreferences.isScreenSecurityEnabled(this)) {
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
- }
}
private void initializeReceivers() {
diff --git a/src/org/thoughtcrime/securesms/ConversationListActivity.java b/src/org/thoughtcrime/securesms/ConversationListActivity.java
index fb249560c7..a446582863 100644
--- a/src/org/thoughtcrime/securesms/ConversationListActivity.java
+++ b/src/org/thoughtcrime/securesms/ConversationListActivity.java
@@ -86,6 +86,7 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
dynamicLanguage.onResume(this);
initializeDefaultMessengerCheck();
+ initializeSecurity();
}
@Override
@@ -279,11 +280,6 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
}
private void initializeResources() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && TextSecurePreferences.isScreenSecurityEnabled(this)) {
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
- WindowManager.LayoutParams.FLAG_SECURE);
- }
-
this.drawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
this.drawerList = (ListView)findViewById(R.id.left_drawer);
this.masterSecret = getIntent().getParcelableExtra("master_secret");
@@ -303,6 +299,16 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
}
}
+ private void initializeSecurity() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ if (TextSecurePreferences.isScreenSecurityEnabled(this)) {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ } else {
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ }
+ }
+ }
+
class DrawerToggle extends ActionBarDrawerToggle {
public DrawerToggle(Activity activity, DrawerLayout drawerLayout,
diff --git a/src/org/thoughtcrime/securesms/ShareActivity.java b/src/org/thoughtcrime/securesms/ShareActivity.java
index 869ca07d0a..875e934e6b 100644
--- a/src/org/thoughtcrime/securesms/ShareActivity.java
+++ b/src/org/thoughtcrime/securesms/ShareActivity.java
@@ -72,6 +72,7 @@ public class ShareActivity extends PassphraseRequiredSherlockFragmentActivity
dynamicTheme.onResume(this);
dynamicLanguage.onResume(this);
getSupportActionBar().setTitle(R.string.ShareActivity_share_with);
+ initializeSecurity();
}
@Override
@@ -132,11 +133,6 @@ public class ShareActivity extends PassphraseRequiredSherlockFragmentActivity
}
private void initializeResources() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && TextSecurePreferences.isScreenSecurityEnabled(this)) {
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
- WindowManager.LayoutParams.FLAG_SECURE);
- }
-
this.masterSecret = getIntent().getParcelableExtra(MASTER_SECRET_EXTRA);
this.fragment = (ShareFragment)this.getSupportFragmentManager()
@@ -145,6 +141,16 @@ public class ShareActivity extends PassphraseRequiredSherlockFragmentActivity
this.fragment.setMasterSecret(masterSecret);
}
+ private void initializeSecurity() {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ if (TextSecurePreferences.isScreenSecurityEnabled(this)) {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ } else {
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ }
+ }
+ }
+
private Intent getBaseShareIntent(final Class> target) {
final Intent intent = new Intent(this, target);
final Intent originalIntent = getIntent();