Reword the very confusing screen security setting

This commit is contained in:
Veeti Paananen 2014-04-14 03:55:20 +03:00 committed by Moxie Marlinspike
parent d51adab76b
commit bd889d8fa9
5 changed files with 33 additions and 17 deletions

View File

@ -686,7 +686,7 @@
<string name="preferences__disable_local_encryption_of_messages_and_keys">Disable local encryption of messages and keys</string> <string name="preferences__disable_local_encryption_of_messages_and_keys">Disable local encryption of messages and keys</string>
<string name="preferences__screen_security">Screen security</string> <string name="preferences__screen_security">Screen security</string>
<string name="preferences__automatically_complete_key_exchanges_for_new_sessions_or_for_existing_sessions_with_the_same_identity_key">Automatically complete key exchanges for new sessions or for existing sessions with the same identity key</string> <string name="preferences__automatically_complete_key_exchanges_for_new_sessions_or_for_existing_sessions_with_the_same_identity_key">Automatically complete key exchanges for new sessions or for existing sessions with the same identity key</string>
<string name="preferences__disable_screen_security_to_allow_screen_shots">Disable screen security to allow screen shots</string> <string name="preferences__disable_screen_security_to_allow_screen_shots">Block screenshots in the recents list and inside the app</string>
<string name="preferences__forget_passphrase_from_memory_after_some_interval">Forget passphrase from memory after some interval</string> <string name="preferences__forget_passphrase_from_memory_after_some_interval">Forget passphrase from memory after some interval</string>
<string name="preferences__timeout_passphrase">Timeout passphrase</string> <string name="preferences__timeout_passphrase">Timeout passphrase</string>
<string name="preferences__pref_timeout_interval_dialogtitle">Select passphrase timeout</string> <string name="preferences__pref_timeout_interval_dialogtitle">Select passphrase timeout</string>

View File

@ -217,7 +217,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
pushSmsCategory.removePreference(defaultPreference); pushSmsCategory.removePreference(defaultPreference);
} }
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 && if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH &&
advancedCategory != null && advancedCategory != null &&
screenSecurityPreference != null) screenSecurityPreference != null)
{ {

View File

@ -690,6 +690,14 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
drawables.recycle(); drawables.recycle();
calculateCharactersRemaining(); 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() { private void initializeMmsEnabledCheck() {
@ -753,10 +761,6 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
}); });
registerForContextMenu(sendButton); 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() { private void initializeReceivers() {

View File

@ -86,6 +86,7 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
dynamicLanguage.onResume(this); dynamicLanguage.onResume(this);
initializeDefaultMessengerCheck(); initializeDefaultMessengerCheck();
initializeSecurity();
} }
@Override @Override
@ -279,11 +280,6 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
} }
private void initializeResources() { 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.drawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
this.drawerList = (ListView)findViewById(R.id.left_drawer); this.drawerList = (ListView)findViewById(R.id.left_drawer);
this.masterSecret = getIntent().getParcelableExtra("master_secret"); 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 { class DrawerToggle extends ActionBarDrawerToggle {
public DrawerToggle(Activity activity, DrawerLayout drawerLayout, public DrawerToggle(Activity activity, DrawerLayout drawerLayout,

View File

@ -72,6 +72,7 @@ public class ShareActivity extends PassphraseRequiredSherlockFragmentActivity
dynamicTheme.onResume(this); dynamicTheme.onResume(this);
dynamicLanguage.onResume(this); dynamicLanguage.onResume(this);
getSupportActionBar().setTitle(R.string.ShareActivity_share_with); getSupportActionBar().setTitle(R.string.ShareActivity_share_with);
initializeSecurity();
} }
@Override @Override
@ -132,11 +133,6 @@ public class ShareActivity extends PassphraseRequiredSherlockFragmentActivity
} }
private void initializeResources() { 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.masterSecret = getIntent().getParcelableExtra(MASTER_SECRET_EXTRA);
this.fragment = (ShareFragment)this.getSupportFragmentManager() this.fragment = (ShareFragment)this.getSupportFragmentManager()
@ -145,6 +141,16 @@ public class ShareActivity extends PassphraseRequiredSherlockFragmentActivity
this.fragment.setMasterSecret(masterSecret); 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) { private Intent getBaseShareIntent(final Class<?> target) {
final Intent intent = new Intent(this, target); final Intent intent = new Intent(this, target);
final Intent originalIntent = getIntent(); final Intent originalIntent = getIntent();