mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Refuse to start on Android 4 beyond the set expiry date
This commit is contained in:
@@ -99,6 +99,10 @@
|
||||
android:name="org.briarproject.briar.android.splash.ExpiredActivity"
|
||||
android:label="@string/app_name" />
|
||||
|
||||
<activity
|
||||
android:name="org.briarproject.briar.android.splash.ExpiredOldAndroidActivity"
|
||||
android:label="@string/app_name" />
|
||||
|
||||
<activity
|
||||
android:name="org.briarproject.briar.android.login.StartupActivity"
|
||||
android:label="@string/app_name" />
|
||||
|
||||
@@ -80,6 +80,7 @@ import org.briarproject.briar.android.sharing.ShareBlogFragment;
|
||||
import org.briarproject.briar.android.sharing.ShareForumActivity;
|
||||
import org.briarproject.briar.android.sharing.ShareForumFragment;
|
||||
import org.briarproject.briar.android.sharing.SharingModule;
|
||||
import org.briarproject.briar.android.splash.ExpiredOldAndroidActivity;
|
||||
import org.briarproject.briar.android.splash.SplashScreenActivity;
|
||||
import org.briarproject.briar.android.test.TestDataActivity;
|
||||
|
||||
@@ -182,6 +183,8 @@ public interface ActivityComponent {
|
||||
|
||||
void inject(RemovableDriveActivity activity);
|
||||
|
||||
void inject(ExpiredOldAndroidActivity activity);
|
||||
|
||||
// Fragments
|
||||
|
||||
void inject(SetupFragment fragment);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.briarproject.briar.android.splash;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.Localizer;
|
||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||
import org.briarproject.briar.android.activity.BriarActivity;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
|
||||
import static org.briarproject.briar.android.TestingConstants.PREVENT_SCREENSHOTS;
|
||||
|
||||
@NotNullByDefault
|
||||
public class ExpiredOldAndroidActivity extends BriarActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
if (PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
|
||||
|
||||
setContentView(R.layout.activity_expired_old_android);
|
||||
findViewById(R.id.delete_account_button).setOnClickListener(v ->
|
||||
signOut(true, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(
|
||||
Localizer.getInstance().setLocale(base));
|
||||
Localizer.getInstance().setLocale(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectActivity(ActivityComponent component) {
|
||||
component.inject(this);
|
||||
}
|
||||
}
|
||||
@@ -65,9 +65,14 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
int duration =
|
||||
getResources().getInteger(R.integer.splashScreenDuration);
|
||||
new Handler().postDelayed(() -> {
|
||||
if (IS_DEBUG_BUILD && currentTimeMillis() >= EXPIRY_DATE) {
|
||||
LOG.info("Expired");
|
||||
startNextActivity(ExpiredActivity.class);
|
||||
if (currentTimeMillis() >= EXPIRY_DATE) {
|
||||
if (IS_DEBUG_BUILD) {
|
||||
LOG.info("Expired: debug build");
|
||||
startNextActivity(ExpiredActivity.class);
|
||||
} else {
|
||||
LOG.info("Expired: running on old Android");
|
||||
startNextActivity(ExpiredOldAndroidActivity.class);
|
||||
}
|
||||
} else {
|
||||
startNextActivity(ENTRY_ACTIVITY);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_large"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_medium"
|
||||
android:gravity="center"
|
||||
android:text="@string/old_android_expiry_date_reached"
|
||||
android:textSize="@dimen/text_size_large" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_medium"
|
||||
android:gravity="center"
|
||||
android:text="@string/old_android_create_new_account"
|
||||
android:textSize="@dimen/text_size_large" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_medium"
|
||||
android:gravity="center"
|
||||
android:text="@string/old_android_delete_account"
|
||||
android:textSize="@dimen/text_size_large" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/delete_account_button"
|
||||
style="@style/BriarButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_medium"
|
||||
android:text="@string/delete_account_button" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -64,6 +64,10 @@
|
||||
<string name="download_briar">To continue using Briar, please download the latest release.</string>
|
||||
<string name="create_new_account">You will need to create a new account, but you can use the same nickname.</string>
|
||||
<string name="download_briar_button">Download Latest Release</string>
|
||||
<string name="old_android_expiry_date_reached">Briar no longer runs on Android 4.\nPlease install Briar on a newer device.</string>
|
||||
<string name="old_android_create_new_account">You will need to create a new account, but you can use the same nickname.</string>
|
||||
<string name="old_android_delete_account">You can tap the button below to delete your account from this device.</string>
|
||||
<string name="delete_account_button">Delete Account</string>
|
||||
<string name="startup_open_database">Decrypting Database…</string>
|
||||
<string name="startup_migrate_database">Upgrading Database…</string>
|
||||
<string name="startup_compact_database">Compacting Database…</string>
|
||||
|
||||
Reference in New Issue
Block a user