mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 06:39:54 +01:00
Merge branch '2250-refuse-to-start-if-android4-expired' into 'master'
Refuse to start app on Android 4 beyond expiry date Closes #2250 See merge request briar/briar!1578
This commit is contained in:
@@ -99,6 +99,10 @@
|
|||||||
android:name="org.briarproject.briar.android.splash.ExpiredActivity"
|
android:name="org.briarproject.briar.android.splash.ExpiredActivity"
|
||||||
android:label="@string/app_name" />
|
android:label="@string/app_name" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="org.briarproject.briar.android.splash.ExpiredOldAndroidActivity"
|
||||||
|
android:label="@string/app_name" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.briarproject.briar.android.login.StartupActivity"
|
android:name="org.briarproject.briar.android.login.StartupActivity"
|
||||||
android:label="@string/app_name" />
|
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.ShareForumActivity;
|
||||||
import org.briarproject.briar.android.sharing.ShareForumFragment;
|
import org.briarproject.briar.android.sharing.ShareForumFragment;
|
||||||
import org.briarproject.briar.android.sharing.SharingModule;
|
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.splash.SplashScreenActivity;
|
||||||
import org.briarproject.briar.android.test.TestDataActivity;
|
import org.briarproject.briar.android.test.TestDataActivity;
|
||||||
|
|
||||||
@@ -182,6 +183,8 @@ public interface ActivityComponent {
|
|||||||
|
|
||||||
void inject(RemovableDriveActivity activity);
|
void inject(RemovableDriveActivity activity);
|
||||||
|
|
||||||
|
void inject(ExpiredOldAndroidActivity activity);
|
||||||
|
|
||||||
// Fragments
|
// Fragments
|
||||||
|
|
||||||
void inject(SetupFragment fragment);
|
void inject(SetupFragment fragment);
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package org.briarproject.briar.android.splash;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||||
|
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||||
|
import org.briarproject.bramble.api.system.AndroidWakeLockManager;
|
||||||
|
import org.briarproject.briar.R;
|
||||||
|
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||||
|
import org.briarproject.briar.android.activity.BaseActivity;
|
||||||
|
import org.briarproject.briar.android.controller.BriarController;
|
||||||
|
import org.briarproject.briar.android.logout.ExitActivity;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
|
||||||
|
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
|
||||||
|
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||||
|
import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
|
||||||
|
|
||||||
|
@MethodsNotNullByDefault
|
||||||
|
@ParametersNotNullByDefault
|
||||||
|
public class ExpiredOldAndroidActivity extends BaseActivity {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
BriarController briarController;
|
||||||
|
@Inject
|
||||||
|
AndroidWakeLockManager wakeLockManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle state) {
|
||||||
|
super.onCreate(state);
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_expired_old_android);
|
||||||
|
findViewById(R.id.delete_account_button).setOnClickListener(v -> {
|
||||||
|
// Hold a wake lock to ensure we exit before the device goes to sleep
|
||||||
|
wakeLockManager.runWakefully(() -> {
|
||||||
|
// we're not signed in, just go ahead and delete
|
||||||
|
briarController.deleteAccount();
|
||||||
|
// remove from recent apps
|
||||||
|
Intent i = new Intent(this, ExitActivity.class);
|
||||||
|
i.addFlags(FLAG_ACTIVITY_NEW_TASK
|
||||||
|
| FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
|
||||||
|
| FLAG_ACTIVITY_NO_ANIMATION
|
||||||
|
| FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
startActivity(i);
|
||||||
|
}, "DeleteAccount");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void injectActivity(ActivityComponent component) {
|
||||||
|
component.inject(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -65,9 +65,14 @@ public class SplashScreenActivity extends BaseActivity {
|
|||||||
int duration =
|
int duration =
|
||||||
getResources().getInteger(R.integer.splashScreenDuration);
|
getResources().getInteger(R.integer.splashScreenDuration);
|
||||||
new Handler().postDelayed(() -> {
|
new Handler().postDelayed(() -> {
|
||||||
if (IS_DEBUG_BUILD && currentTimeMillis() >= EXPIRY_DATE) {
|
if (currentTimeMillis() >= EXPIRY_DATE) {
|
||||||
LOG.info("Expired");
|
if (IS_DEBUG_BUILD) {
|
||||||
startNextActivity(ExpiredActivity.class);
|
LOG.info("Expired: debug build");
|
||||||
|
startNextActivity(ExpiredActivity.class);
|
||||||
|
} else {
|
||||||
|
LOG.info("Expired: running on old Android");
|
||||||
|
startNextActivity(ExpiredOldAndroidActivity.class);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
startNextActivity(ENTRY_ACTIVITY);
|
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/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,9 @@
|
|||||||
<string name="download_briar">To continue using Briar, please download the latest release.</string>
|
<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="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="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_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_open_database">Decrypting Database…</string>
|
||||||
<string name="startup_migrate_database">Upgrading Database…</string>
|
<string name="startup_migrate_database">Upgrading Database…</string>
|
||||||
<string name="startup_compact_database">Compacting Database…</string>
|
<string name="startup_compact_database">Compacting Database…</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user