Merge pull request #794 from SamWhited/issue788

Add option to disable screen security
This commit is contained in:
Moxie Marlinspike
2014-02-27 18:02:05 -08:00
4 changed files with 60 additions and 57 deletions

View File

@@ -272,7 +272,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
} else {
inflater.inflate(R.menu.conversation_secure_no_identity, menu);
}
inflater.inflate(R.menu.conversation_secure_sms, menu.findItem(R.id.menu_security).getSubMenu());
} else if (isSingleConversation() && !pushRegistered) {
inflater.inflate(R.menu.conversation_insecure, menu);
@@ -479,7 +479,6 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
startActivityForResult(intent, GROUP_EDIT);
}
private void handleDistributionBroadcastEnabled(MenuItem item) {
distributionType = ThreadDatabase.DistributionTypes.BROADCAST;
item.setChecked(true);
@@ -756,7 +755,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
registerForContextMenu(sendButton);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && TextSecurePreferences.isScreenSecurityEnabled(this)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
}
@@ -813,7 +812,6 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
new IntentFilter(GroupDatabase.DATABASE_UPDATE_ACTION));
}
//////// Helper Methods
private void addAttachment(int type) {

View File

@@ -29,6 +29,7 @@ public class TextSecurePreferences {
private static final String PASSPHRASE_TIMEOUT_INTERVAL_PREF = "pref_timeout_interval";
private static final String PASSPHRASE_TIMEOUT_PREF = "pref_timeout_passphrase";
private static final String AUTO_KEY_EXCHANGE_PREF = "pref_auto_complete_key_exchange";
private static final String SCREEN_SECURITY_PREF = "pref_screen_security";
private static final String ENTER_SENDS_PREF = "pref_enter_sends";
private static final String ENTER_PRESENT_PREF = "pref_enter_key";
private static final String SMS_DELIVERY_REPORT_PREF = "pref_delivery_report_sms";
@@ -134,6 +135,10 @@ public class TextSecurePreferences {
return getBooleanPreference(context, AUTO_KEY_EXCHANGE_PREF, true);
}
public static boolean isScreenSecurityEnabled(Context context) {
return getBooleanPreference(context, SCREEN_SECURITY_PREF, true);
}
public static boolean isUseLocalApnsEnabled(Context context) {
return getBooleanPreference(context, ENABLE_MANUAL_MMS_PREF, false);
}