Compare commits

...

6 Commits

Author SHA1 Message Date
akwizgran
9d2cc4c3c1 Add method to detect whether system uses glibc. 2021-02-20 10:18:24 +00:00
akwizgran
8a534b4503 Bump version numbers for 1.2.16 release. 2021-02-19 18:01:56 +00:00
akwizgran
e5b2275c82 Merge branch '1947-forum-crash' into 'master'
Don't add new thread items when the existing ones haven't loaded

Closes #1947

See merge request briar/briar!1375
2021-02-19 17:27:38 +00:00
Torsten Grote
5159593825 Don't add new item when the existing ones haven't loaded 2021-02-19 14:17:21 -03:00
akwizgran
6fbc82ee27 Merge branch '1075-1146-1317-ongoing-notification' into 'master'
Use IMPORTANCE_LOW for ongoing notification, don't show a badge

Closes #1317, #1146, and #1075

See merge request briar/briar!1369
2021-02-18 17:00:47 +00:00
akwizgran
fb2b4209cf Use IMPORTANCE_LOW for ongoing notification, don't show a badge. 2021-02-10 11:46:41 +00:00
6 changed files with 44 additions and 7 deletions

View File

@@ -11,8 +11,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 29 targetSdkVersion 29
versionCode 10215 versionCode 10216
versionName "1.2.15" versionName "1.2.16"
consumerProguardFiles 'proguard-rules.txt' consumerProguardFiles 'proguard-rules.txt'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -14,12 +14,18 @@ import org.briarproject.bramble.api.system.ResourceProvider;
import java.io.File; import java.io.File;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.logging.Logger;
import javax.net.SocketFactory; import javax.net.SocketFactory;
import static java.util.logging.Level.INFO;
import static java.util.logging.Logger.getLogger;
@NotNullByDefault @NotNullByDefault
class UnixTorPlugin extends JavaTorPlugin { class UnixTorPlugin extends JavaTorPlugin {
private static final Logger LOG = getLogger(UnixTorPlugin.class.getName());
UnixTorPlugin(Executor ioExecutor, UnixTorPlugin(Executor ioExecutor,
Executor wakefulIoExecutor, Executor wakefulIoExecutor,
NetworkManager networkManager, NetworkManager networkManager,
@@ -41,6 +47,8 @@ class UnixTorPlugin extends JavaTorPlugin {
circumventionProvider, batteryManager, backoff, circumventionProvider, batteryManager, backoff,
torRendezvousCrypto, callback, architecture, torRendezvousCrypto, callback, architecture,
maxLatency, maxIdleTime, torDirectory); maxLatency, maxIdleTime, torDirectory);
boolean isGlibc = isGlibc();
if (LOG.isLoggable(INFO)) LOG.info("System uses glibc: " + isGlibc);
} }
@Override @Override
@@ -48,10 +56,27 @@ class UnixTorPlugin extends JavaTorPlugin {
return CLibrary.INSTANCE.getpid(); return CLibrary.INSTANCE.getpid();
} }
protected boolean isGlibc() {
try {
GnuCLibrary glibc = Native.loadLibrary("c", GnuCLibrary.class);
if (LOG.isLoggable(INFO)) {
LOG.info("glibc version " + glibc.gnu_get_libc_version());
}
return true;
} catch (UnsatisfiedLinkError e) {
return false;
}
}
private interface CLibrary extends Library { private interface CLibrary extends Library {
CLibrary INSTANCE = Native.loadLibrary("c", CLibrary.class); CLibrary INSTANCE = Native.loadLibrary("c", CLibrary.class);
int getpid(); int getpid();
} }
private interface GnuCLibrary extends Library {
String gnu_get_libc_version();
}
} }

View File

@@ -22,8 +22,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 29 targetSdkVersion 29
versionCode 10215 versionCode 10216
versionName "1.2.15" versionName "1.2.16"
applicationId "org.briarproject.briar.android" applicationId "org.briarproject.briar.android"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true

View File

@@ -37,7 +37,7 @@ import javax.inject.Inject;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
import static android.app.NotificationManager.IMPORTANCE_NONE; import static android.app.NotificationManager.IMPORTANCE_LOW;
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
import static android.content.Intent.ACTION_SHUTDOWN; import static android.content.Intent.ACTION_SHUTDOWN;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
@@ -56,6 +56,7 @@ import static org.briarproject.briar.android.BriarApplication.ENTRY_ACTIVITY;
import static org.briarproject.briar.api.android.AndroidNotificationManager.FAILURE_CHANNEL_ID; import static org.briarproject.briar.api.android.AndroidNotificationManager.FAILURE_CHANNEL_ID;
import static org.briarproject.briar.api.android.AndroidNotificationManager.FAILURE_NOTIFICATION_ID; import static org.briarproject.briar.api.android.AndroidNotificationManager.FAILURE_NOTIFICATION_ID;
import static org.briarproject.briar.api.android.AndroidNotificationManager.ONGOING_CHANNEL_ID; import static org.briarproject.briar.api.android.AndroidNotificationManager.ONGOING_CHANNEL_ID;
import static org.briarproject.briar.api.android.AndroidNotificationManager.ONGOING_CHANNEL_OLD_ID;
import static org.briarproject.briar.api.android.AndroidNotificationManager.ONGOING_NOTIFICATION_ID; import static org.briarproject.briar.api.android.AndroidNotificationManager.ONGOING_NOTIFICATION_ID;
import static org.briarproject.briar.api.android.LockManager.ACTION_LOCK; import static org.briarproject.briar.api.android.LockManager.ACTION_LOCK;
@@ -120,11 +121,17 @@ public class BriarService extends Service {
if (SDK_INT >= 26) { if (SDK_INT >= 26) {
NotificationManager nm = (NotificationManager) NotificationManager nm = (NotificationManager)
requireNonNull(getSystemService(NOTIFICATION_SERVICE)); requireNonNull(getSystemService(NOTIFICATION_SERVICE));
// Delete the old notification channel, which had
// IMPORTANCE_NONE and showed a badge
nm.deleteNotificationChannel(ONGOING_CHANNEL_OLD_ID);
// Use IMPORTANCE_LOW so the system doesn't show its own
// notification on API 26-27
NotificationChannel ongoingChannel = new NotificationChannel( NotificationChannel ongoingChannel = new NotificationChannel(
ONGOING_CHANNEL_ID, ONGOING_CHANNEL_ID,
getString(R.string.ongoing_notification_title), getString(R.string.ongoing_notification_title),
IMPORTANCE_NONE); IMPORTANCE_LOW);
ongoingChannel.setLockscreenVisibility(VISIBILITY_SECRET); ongoingChannel.setLockscreenVisibility(VISIBILITY_SECRET);
ongoingChannel.setShowBadge(false);
nm.createNotificationChannel(ongoingChannel); nm.createNotificationChannel(ongoingChannel);
NotificationChannel failureChannel = new NotificationChannel( NotificationChannel failureChannel = new NotificationChannel(
FAILURE_CHANNEL_ID, FAILURE_CHANNEL_ID,

View File

@@ -197,6 +197,10 @@ public abstract class ThreadListViewModel<I extends ThreadItem>
*/ */
@UiThread @UiThread
protected void addItem(I item, boolean scrollToItem) { protected void addItem(I item, boolean scrollToItem) {
// If items haven't loaded, we need to wait until they have.
// Since this was a R/W DB transaction, the load will pick up this item.
if (items.getValue() == null) return;
messageTree.add(item); messageTree.add(item);
if (scrollToItem) this.scrollToItem.set(item.getId()); if (scrollToItem) this.scrollToItem.set(item.getId());
items.setValue(new LiveResult<>(messageTree.depthFirstOrder())); items.setValue(new LiveResult<>(messageTree.depthFirstOrder()));

View File

@@ -39,7 +39,8 @@ public interface AndroidNotificationManager {
String BLOG_CHANNEL_ID = "blogs"; String BLOG_CHANNEL_ID = "blogs";
// Channels are sorted by channel ID in the Settings app, so use IDs // Channels are sorted by channel ID in the Settings app, so use IDs
// that will sort below the main channels such as contacts // that will sort below the main channels such as contacts
String ONGOING_CHANNEL_ID = "zForegroundService"; String ONGOING_CHANNEL_OLD_ID = "zForegroundService";
String ONGOING_CHANNEL_ID = "zForegroundService2";
String FAILURE_CHANNEL_ID = "zStartupFailure"; String FAILURE_CHANNEL_ID = "zStartupFailure";
String REMINDER_CHANNEL_ID = "zSignInReminder"; String REMINDER_CHANNEL_ID = "zSignInReminder";