34 lines
936 B
Java
34 lines
936 B
Java
package androidx.core.app;
|
|
|
|
import android.app.Service;
|
|
import android.os.Build;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RestrictTo;
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
public final class ServiceCompat {
|
|
public static final int START_STICKY = 1;
|
|
public static final int STOP_FOREGROUND_DETACH = 2;
|
|
public static final int STOP_FOREGROUND_REMOVE = 1;
|
|
|
|
@Retention(RetentionPolicy.SOURCE)
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public @interface StopForegroundFlags {
|
|
}
|
|
|
|
private ServiceCompat() {
|
|
}
|
|
|
|
public static void stopForeground(@NonNull Service service, int i) {
|
|
if (Build.VERSION.SDK_INT >= 24) {
|
|
service.stopForeground(i);
|
|
return;
|
|
}
|
|
boolean z2 = true;
|
|
if ((i & 1) == 0) {
|
|
z2 = false;
|
|
}
|
|
service.stopForeground(z2);
|
|
}
|
|
}
|