mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Created switches for disabling alpha/beta testing code.
This commit is contained in:
@@ -4,6 +4,7 @@ import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
|
||||
import static android.view.inputmethod.InputMethodManager.HIDE_IMPLICIT_ONLY;
|
||||
import static org.briarproject.android.TestingConstants.PREVENT_SCREENSHOTS;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.logging.Logger;
|
||||
@@ -42,7 +43,7 @@ public class BriarActivity extends RoboActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle state) {
|
||||
super.onCreate(state);
|
||||
getWindow().setFlags(FLAG_SECURE, FLAG_SECURE);
|
||||
if(PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
|
||||
if(databaseConfig.getEncryptionKey() != null) startAndBindService();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.briarproject.android;
|
||||
|
||||
import static android.view.Gravity.CENTER;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
|
||||
import static org.briarproject.android.TestingConstants.PREVENT_SCREENSHOTS;
|
||||
import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH;
|
||||
|
||||
import org.briarproject.R;
|
||||
@@ -18,7 +19,7 @@ public class ExpiredActivity extends Activity {
|
||||
public void onCreate(Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
getWindow().setFlags(FLAG_SECURE, FLAG_SECURE);
|
||||
if(PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
|
||||
|
||||
LinearLayout layout = new LinearLayout(this);
|
||||
layout.setLayoutParams(MATCH_MATCH);
|
||||
|
||||
@@ -9,6 +9,7 @@ import static android.view.View.VISIBLE;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
|
||||
import static android.view.inputmethod.InputMethodManager.HIDE_IMPLICIT_ONLY;
|
||||
import static android.widget.LinearLayout.VERTICAL;
|
||||
import static org.briarproject.android.TestingConstants.PREVENT_SCREENSHOTS;
|
||||
import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH;
|
||||
import static org.briarproject.android.util.CommonLayoutParams.WRAP_WRAP;
|
||||
|
||||
@@ -56,7 +57,7 @@ public class PasswordActivity extends RoboActivity {
|
||||
public void onCreate(Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
getWindow().setFlags(FLAG_SECURE, FLAG_SECURE);
|
||||
if(PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
|
||||
|
||||
SharedPreferences prefs = getSharedPreferences("db", MODE_PRIVATE);
|
||||
String hex = prefs.getString("key", null);
|
||||
|
||||
@@ -7,6 +7,7 @@ import static android.view.View.VISIBLE;
|
||||
import static android.widget.LinearLayout.VERTICAL;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.android.TestingConstants.SHOW_TESTING_ACTIVITY;
|
||||
import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP;
|
||||
import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP_1;
|
||||
|
||||
@@ -168,16 +169,18 @@ OnClickListener {
|
||||
|
||||
layout.addView(new HorizontalBorder(this));
|
||||
|
||||
LinearLayout footer = new LinearLayout(this);
|
||||
footer.setLayoutParams(MATCH_WRAP);
|
||||
footer.setGravity(CENTER);
|
||||
footer.setBackgroundColor(res.getColor(R.color.button_bar_background));
|
||||
testingButton = new ImageButton(this);
|
||||
testingButton.setBackgroundResource(0);
|
||||
testingButton.setImageResource(R.drawable.action_about);
|
||||
testingButton.setOnClickListener(this);
|
||||
footer.addView(testingButton);
|
||||
layout.addView(footer);
|
||||
if(SHOW_TESTING_ACTIVITY) {
|
||||
LinearLayout footer = new LinearLayout(this);
|
||||
footer.setLayoutParams(MATCH_WRAP);
|
||||
footer.setGravity(CENTER);
|
||||
footer.setBackgroundColor(res.getColor(R.color.button_bar_background));
|
||||
testingButton = new ImageButton(this);
|
||||
testingButton.setBackgroundResource(0);
|
||||
testingButton.setImageResource(R.drawable.action_about);
|
||||
testingButton.setOnClickListener(this);
|
||||
footer.addView(testingButton);
|
||||
layout.addView(footer);
|
||||
}
|
||||
|
||||
setContentView(layout);
|
||||
}
|
||||
@@ -246,7 +249,7 @@ OnClickListener {
|
||||
}
|
||||
|
||||
public void onClick(View view) {
|
||||
if(testingButton == null) return; // Not created yet
|
||||
if(progress == null) return; // Not created yet
|
||||
if(view == testingButton) {
|
||||
startActivity(new Intent(this, TestingActivity.class));
|
||||
return;
|
||||
|
||||
@@ -12,6 +12,7 @@ import static android.view.View.VISIBLE;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
|
||||
import static android.widget.LinearLayout.VERTICAL;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static org.briarproject.android.TestingConstants.PREVENT_SCREENSHOTS;
|
||||
import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH;
|
||||
import static org.briarproject.android.util.CommonLayoutParams.WRAP_WRAP;
|
||||
import static org.briarproject.api.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
||||
@@ -75,7 +76,7 @@ public class SetupActivity extends RoboActivity implements OnClickListener {
|
||||
public void onCreate(Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
getWindow().setFlags(FLAG_SECURE, FLAG_SECURE);
|
||||
if(PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
|
||||
|
||||
LinearLayout layout = new LinearLayout(this);
|
||||
layout.setLayoutParams(MATCH_MATCH);
|
||||
|
||||
@@ -3,10 +3,11 @@ package org.briarproject.android;
|
||||
import static android.view.Gravity.CENTER;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static org.briarproject.android.TestingConstants.DEFAULT_LOG_LEVEL;
|
||||
import static org.briarproject.android.TestingConstants.PREVENT_SCREENSHOTS;
|
||||
import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.briarproject.R;
|
||||
@@ -31,8 +32,6 @@ public class SplashScreenActivity extends RoboSplashActivity {
|
||||
|
||||
// This build expires on 10 May 2014
|
||||
private static final long EXPIRY_DATE = 1399680000 * 1000L;
|
||||
// Default log level - change this to OFF for release builds
|
||||
private static final Level DEFAULT_LOG_LEVEL = INFO;
|
||||
|
||||
private long now = System.currentTimeMillis();
|
||||
|
||||
@@ -45,7 +44,7 @@ public class SplashScreenActivity extends RoboSplashActivity {
|
||||
public void onCreate(Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
getWindow().setFlags(FLAG_SECURE, FLAG_SECURE);
|
||||
if(PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
|
||||
|
||||
LinearLayout layout = new LinearLayout(this);
|
||||
layout.setLayoutParams(MATCH_MATCH);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.briarproject.android;
|
||||
|
||||
import static java.util.logging.Level.INFO;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
interface TestingConstants {
|
||||
|
||||
/** Default log level - this should be OFF for release builds. */
|
||||
Level DEFAULT_LOG_LEVEL = INFO;
|
||||
|
||||
/**
|
||||
* Whether to prevent screenshots from being taken. This should be true for
|
||||
* release builds, to prevent Recent Apps from storing screenshots of
|
||||
* private information. Unfortunately this also prevents the user from
|
||||
* taking screenshots intentionally.
|
||||
*/
|
||||
boolean PREVENT_SCREENSHOTS = false;
|
||||
|
||||
/**
|
||||
* Whether to allow TestingActivity to be launched from SettingsActivity.
|
||||
* This should be false for release builds.
|
||||
*/
|
||||
boolean SHOW_TESTING_ACTIVITY = true;
|
||||
}
|
||||
Reference in New Issue
Block a user