diff --git a/briar-android/res/layout/invitation_bluetooth_invitation_code.xml b/briar-android/res/layout/invitation_bluetooth_invitation_code.xml index d63fbe535f80b840c7ad059c24df334548d7b720..8bc5319b6218787613f7ba85d1151e9100342782 100644 --- a/briar-android/res/layout/invitation_bluetooth_invitation_code.xml +++ b/briar-android/res/layout/invitation_bluetooth_invitation_code.xml @@ -68,6 +68,7 @@ style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="@dimen/margin_medium" android:indeterminate="true" android:layout_below="@+id/waitingView" android:layout_centerHorizontal="true" diff --git a/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java b/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java index 06647461b31797a2f3e0640a62b4a7cc8aa69d2c..8a0561f4d2bf1ec5bab72c997e9d5828c2b717a7 100644 --- a/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java +++ b/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java @@ -5,6 +5,7 @@ import android.app.NotificationManager; import android.content.Context; import android.content.Intent; import android.net.Uri; +import android.os.Build; import android.support.v4.app.NotificationCompat; import android.support.v4.app.TaskStackBuilder; @@ -41,6 +42,9 @@ import static android.app.Notification.DEFAULT_VIBRATE; import static android.content.Context.NOTIFICATION_SERVICE; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; +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.VISIBILITY_SECRET; import static java.util.logging.Level.WARNING; import static org.briarproject.android.fragment.SettingsFragment.SETTINGS_NAMESPACE; @@ -213,6 +217,10 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, t.addNextIntent(i); b.setContentIntent(t.getPendingIntent(nextRequestId++, 0)); } + if (Build.VERSION.SDK_INT >= 21) { + b.setCategory(CATEGORY_MESSAGE); + b.setVisibility(VISIBILITY_SECRET); + } Object o = appContext.getSystemService(NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) o; nm.notify(PRIVATE_MESSAGE_NOTIFICATION_ID, b.build()); @@ -292,6 +300,10 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, t.addNextIntent(i); b.setContentIntent(t.getPendingIntent(nextRequestId++, 0)); } + if (Build.VERSION.SDK_INT >= 21) { + b.setCategory(CATEGORY_SOCIAL); + b.setVisibility(VISIBILITY_SECRET); + } Object o = appContext.getSystemService(NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) o; nm.notify(FORUM_POST_NOTIFICATION_ID, b.build()); diff --git a/briar-android/src/org/briarproject/android/BriarService.java b/briar-android/src/org/briarproject/android/BriarService.java index f050d7c11c79901385cbc67139327c0af2f7e12d..f11019303edf796ea0c3d505c115c2a514308d88 100644 --- a/briar-android/src/org/briarproject/android/BriarService.java +++ b/briar-android/src/org/briarproject/android/BriarService.java @@ -6,6 +6,7 @@ import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; import android.os.Binder; +import android.os.Build; import android.os.IBinder; import android.support.v4.app.NotificationCompat; @@ -27,6 +28,8 @@ import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; +import static android.support.v4.app.NotificationCompat.CATEGORY_SERVICE; +import static android.support.v4.app.NotificationCompat.VISIBILITY_SECRET; import static java.util.logging.Level.WARNING; import static org.briarproject.api.lifecycle.LifecycleManager.StartResult.ALREADY_RUNNING; import static org.briarproject.api.lifecycle.LifecycleManager.StartResult.SUCCESS; @@ -74,6 +77,10 @@ public class BriarService extends RoboService { i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); b.setContentIntent(PendingIntent.getActivity(this, 0, i, 0)); + if (Build.VERSION.SDK_INT >= 21) { + b.setCategory(CATEGORY_SERVICE); + b.setVisibility(VISIBILITY_SECRET); + } startForeground(ONGOING_NOTIFICATION_ID, b.build()); // Start the services in a background thread new Thread() {