mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Prevent calls crashing due to background restrictions.
This commit is contained in:
committed by
Greyson Parrelli
parent
a63fd5a584
commit
919648b94b
@@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies;
|
||||
|
||||
/**
|
||||
* Easy access to various properties of the device, typically to make performance-related decisions.
|
||||
@@ -65,6 +66,13 @@ public final class DeviceProperties {
|
||||
return info;
|
||||
}
|
||||
|
||||
public static boolean isBackgroundRestricted() {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return isBackgroundRestricted(AppDependencies.getApplication());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@RequiresApi(28)
|
||||
public static boolean isBackgroundRestricted(@NonNull Context context) {
|
||||
ActivityManager activityManager = ServiceUtil.getActivityManager(context);
|
||||
|
||||
Reference in New Issue
Block a user