Loading app/src/main/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" /> <application android:allowBackup="true" Loading app/src/main/java/foundation/e/advancedprivacy/NotificationsPresenter.kt +27 −8 Original line number Diff line number Diff line Loading @@ -47,14 +47,17 @@ import foundation.e.advancedprivacy.domain.usecases.WeeklyReportUseCase import foundation.e.advancedprivacy.externalinterfaces.permissions.IPermissionsPrivacyModule import foundation.e.advancedprivacy.features.weeklyreport.WeeklyReportViewFactory import foundation.e.advancedprivacy.main.MainActivity import java.time.ZoneId import java.time.format.DateTimeFormatter import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.delay import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch import timber.log.Timber import java.time.ZoneId import java.time.format.DateTimeFormatter // @SuppressLint("MissingPermission") class NotificationsPresenter( Loading @@ -67,6 +70,9 @@ class NotificationsPresenter( private val notificationTrackerFlag: NotificationContent, private val appScope: CoroutineScope ) { companion object { private const val HIDE_CHANNEL_DELAY = 30000L } private val notificationManager = NotificationManagerCompat.from(context) Loading Loading @@ -109,12 +115,7 @@ class NotificationsPresenter( channelDescription = R.string.notifications_ipscrambling_channel_description ) createNotificationFlagChannel( channelId = CHANNEL_TRACKER_FLAG, channelName = R.string.notifications_tracker_channel_name, channelDescription = R.string.notifications_tracker_channel_description, importance = NotificationManager.IMPORTANCE_MIN ) createTrackerForegroundserviceChannel() createWeeklyReportChannel() Loading Loading @@ -174,6 +175,24 @@ class NotificationsPresenter( NotificationManagerCompat.from(context).createNotificationChannel(channel) } private fun createTrackerForegroundserviceChannel() { val channel = NotificationChannel( CHANNEL_TRACKER_FLAG, context.getString(R.string.notifications_tracker_channel_name), NotificationManager.IMPORTANCE_LOW ) channel.description = context.getString(R.string.notifications_tracker_channel_description) permissionsPrivacyModule.setBlockable(channel) notificationManager.createNotificationChannel(channel) appScope.launch { delay(HIDE_CHANNEL_DELAY) permissionsPrivacyModule.hideNotificationsChannel(CHANNEL_TRACKER_FLAG) } } private fun createWeeklyReportChannel() { val channel = NotificationChannel( CHANNEL_WEEKLYREPORT, Loading core/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/IPermissionsPrivacyModule.kt +5 −0 Original line number Diff line number Diff line Loading @@ -134,4 +134,9 @@ interface IPermissionsPrivacyModule { * unblockable. */ fun setBlockable(notificationChannel: NotificationChannel) /** * Hide a notification channel. Works as if the user did toggle of the channel in settings. */ fun hideNotificationsChannel(channelId: String) } permissionseos/libs/hidden-apis-stub/src/main/java/android/app/NotificationChannel.java +5 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,9 @@ public class NotificationChannel { @TargetApi(30) public void setBlockable(boolean blockable) {} // Public public int getImportance() { return 0; } // Public public void setImportance(int importance) {} } permissionseos/libs/hidden-apis-stub/src/main/java/android/app/NotificationManager.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package android.app; import androidx.annotation.DeprecatedSinceApi; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; /* Stub based on: https://gitlab.e.foundation/e/os/android_frameworks_base/-/blob/[SDK_VERSION]/core/java/ android/app/NotificationManager.java */ public class NotificationManager { // Public public static final int IMPORTANCE_NONE = 0; // Public public NotificationChannel getNotificationChannel(String channelId) { return null; } @RequiresApi(31) @DeprecatedSinceApi(api = 37, message = "Check availability in SDK37") public void updateNotificationChannel(@NonNull String pkg, int uid, @NonNull NotificationChannel channel) { } } Loading
app/src/main/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" /> <application android:allowBackup="true" Loading
app/src/main/java/foundation/e/advancedprivacy/NotificationsPresenter.kt +27 −8 Original line number Diff line number Diff line Loading @@ -47,14 +47,17 @@ import foundation.e.advancedprivacy.domain.usecases.WeeklyReportUseCase import foundation.e.advancedprivacy.externalinterfaces.permissions.IPermissionsPrivacyModule import foundation.e.advancedprivacy.features.weeklyreport.WeeklyReportViewFactory import foundation.e.advancedprivacy.main.MainActivity import java.time.ZoneId import java.time.format.DateTimeFormatter import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.delay import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch import timber.log.Timber import java.time.ZoneId import java.time.format.DateTimeFormatter // @SuppressLint("MissingPermission") class NotificationsPresenter( Loading @@ -67,6 +70,9 @@ class NotificationsPresenter( private val notificationTrackerFlag: NotificationContent, private val appScope: CoroutineScope ) { companion object { private const val HIDE_CHANNEL_DELAY = 30000L } private val notificationManager = NotificationManagerCompat.from(context) Loading Loading @@ -109,12 +115,7 @@ class NotificationsPresenter( channelDescription = R.string.notifications_ipscrambling_channel_description ) createNotificationFlagChannel( channelId = CHANNEL_TRACKER_FLAG, channelName = R.string.notifications_tracker_channel_name, channelDescription = R.string.notifications_tracker_channel_description, importance = NotificationManager.IMPORTANCE_MIN ) createTrackerForegroundserviceChannel() createWeeklyReportChannel() Loading Loading @@ -174,6 +175,24 @@ class NotificationsPresenter( NotificationManagerCompat.from(context).createNotificationChannel(channel) } private fun createTrackerForegroundserviceChannel() { val channel = NotificationChannel( CHANNEL_TRACKER_FLAG, context.getString(R.string.notifications_tracker_channel_name), NotificationManager.IMPORTANCE_LOW ) channel.description = context.getString(R.string.notifications_tracker_channel_description) permissionsPrivacyModule.setBlockable(channel) notificationManager.createNotificationChannel(channel) appScope.launch { delay(HIDE_CHANNEL_DELAY) permissionsPrivacyModule.hideNotificationsChannel(CHANNEL_TRACKER_FLAG) } } private fun createWeeklyReportChannel() { val channel = NotificationChannel( CHANNEL_WEEKLYREPORT, Loading
core/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/IPermissionsPrivacyModule.kt +5 −0 Original line number Diff line number Diff line Loading @@ -134,4 +134,9 @@ interface IPermissionsPrivacyModule { * unblockable. */ fun setBlockable(notificationChannel: NotificationChannel) /** * Hide a notification channel. Works as if the user did toggle of the channel in settings. */ fun hideNotificationsChannel(channelId: String) }
permissionseos/libs/hidden-apis-stub/src/main/java/android/app/NotificationChannel.java +5 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,9 @@ public class NotificationChannel { @TargetApi(30) public void setBlockable(boolean blockable) {} // Public public int getImportance() { return 0; } // Public public void setImportance(int importance) {} }
permissionseos/libs/hidden-apis-stub/src/main/java/android/app/NotificationManager.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package android.app; import androidx.annotation.DeprecatedSinceApi; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; /* Stub based on: https://gitlab.e.foundation/e/os/android_frameworks_base/-/blob/[SDK_VERSION]/core/java/ android/app/NotificationManager.java */ public class NotificationManager { // Public public static final int IMPORTANCE_NONE = 0; // Public public NotificationChannel getNotificationChannel(String channelId) { return null; } @RequiresApi(31) @DeprecatedSinceApi(api = 37, message = "Check availability in SDK37") public void updateNotificationChannel(@NonNull String pkg, int uid, @NonNull NotificationChannel channel) { } }