mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Light battery optimizations cleanup.
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
public class PowerManagerCompat {
|
||||
|
||||
@@ -13,4 +18,11 @@ public class PowerManagerCompat {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@RequiresApi(api = 23)
|
||||
public static void requestIgnoreBatteryOptimizations(@NonNull Context context) {
|
||||
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,
|
||||
Uri.parse("package:" + context.getPackageName()));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user