Compare commits

...

4 Commits

Author SHA1 Message Date
akwizgran
6778a2dee8 Move task to back rather than showing home screen. 2018-08-07 10:57:05 +01:00
akwizgran
ecb6661b12 Add comment. 2018-08-07 10:50:08 +01:00
akwizgran
677a6529f4 Code cleanup. 2018-08-07 10:43:10 +01:00
akwizgran
fb6c982e10 Don't check for isFinishing() in onStart(). 2018-08-07 10:33:50 +01:00
3 changed files with 10 additions and 14 deletions

View File

@@ -65,7 +65,6 @@ import javax.inject.Inject;
import static android.app.Notification.DEFAULT_LIGHTS; import static android.app.Notification.DEFAULT_LIGHTS;
import static android.app.Notification.DEFAULT_SOUND; import static android.app.Notification.DEFAULT_SOUND;
import static android.app.Notification.DEFAULT_VIBRATE; import static android.app.Notification.DEFAULT_VIBRATE;
import static android.app.Notification.VISIBILITY_SECRET;
import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_LOW;
import static android.content.Context.NOTIFICATION_SERVICE; import static android.content.Context.NOTIFICATION_SERVICE;
@@ -75,6 +74,7 @@ import static android.os.Build.VERSION.SDK_INT;
import static android.support.v4.app.NotificationCompat.CATEGORY_MESSAGE; import static android.support.v4.app.NotificationCompat.CATEGORY_MESSAGE;
import static android.support.v4.app.NotificationCompat.CATEGORY_SOCIAL; import static android.support.v4.app.NotificationCompat.CATEGORY_SOCIAL;
import static android.support.v4.app.NotificationCompat.PRIORITY_LOW; import static android.support.v4.app.NotificationCompat.PRIORITY_LOW;
import static android.support.v4.app.NotificationCompat.VISIBILITY_SECRET;
import static java.util.logging.Level.WARNING; import static java.util.logging.Level.WARNING;
import static org.briarproject.bramble.util.LogUtils.logException; import static org.briarproject.bramble.util.LogUtils.logException;
import static org.briarproject.briar.android.activity.BriarActivity.GROUP_ID; import static org.briarproject.briar.android.activity.BriarActivity.GROUP_ID;
@@ -623,13 +623,12 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
public void showSignInNotification() { public void showSignInNotification() {
if (blockSignInReminder) return; if (blockSignInReminder) return;
if (SDK_INT >= 26) { if (SDK_INT >= 26) {
String title = appContext
.getString(R.string.reminder_notification_channel_title);
NotificationChannel channel = NotificationChannel channel =
new NotificationChannel(REMINDER_CHANNEL_ID, appContext new NotificationChannel(REMINDER_CHANNEL_ID, title,
.getString(
R.string.reminder_notification_channel_title),
IMPORTANCE_LOW); IMPORTANCE_LOW);
channel.setLockscreenVisibility( channel.setLockscreenVisibility(VISIBILITY_SECRET);
NotificationCompat.VISIBILITY_SECRET);
notificationManager.createNotificationChannel(channel); notificationManager.createNotificationChannel(channel);
} }

View File

@@ -61,7 +61,7 @@ public abstract class BriarActivity extends BaseActivity {
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
if (!briarController.accountSignedIn() && !isFinishing()) { if (!briarController.accountSignedIn()) {
Intent i = new Intent(this, PasswordActivity.class); Intent i = new Intent(this, PasswordActivity.class);
startActivityForResult(i, REQUEST_PASSWORD); startActivityForResult(i, REQUEST_PASSWORD);
} else if (SDK_INT >= 23) { } else if (SDK_INT >= 23) {

View File

@@ -23,8 +23,6 @@ import org.briarproject.briar.api.android.AndroidNotificationManager;
import javax.inject.Inject; import javax.inject.Inject;
import static android.content.Intent.ACTION_MAIN;
import static android.content.Intent.CATEGORY_HOME;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.view.View.INVISIBLE; import static android.view.View.INVISIBLE;
@@ -56,7 +54,8 @@ public class PasswordActivity extends BaseActivity {
overridePendingTransition(R.anim.fade_in, R.anim.fade_out); overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
if (!accountManager.accountExists()) { if (!accountManager.accountExists()) {
// TODO: Finish instead of deleting account? // This can happen on older devices if the app is relaunched from
// recent apps after clearing data
deleteAccount(); deleteAccount();
return; return;
} }
@@ -109,10 +108,8 @@ public class PasswordActivity extends BaseActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
// Show the home screen rather than another password prompt // Move the whole task to the back, don't show another password prompt
Intent intent = new Intent(ACTION_MAIN); moveTaskToBack(true);
intent.addCategory(CATEGORY_HOME);
startActivity(intent);
} }
private void deleteAccount() { private void deleteAccount() {