Fix: "cancelNotificationWithTag" method difference when API below 30 (#1975)
This commit is contained in:
parent
9d3f9cfdc7
commit
c10d4dd837
|
|
@ -309,7 +309,11 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
|||
var idValue = notificationIds.get(idKey);
|
||||
if (idValue == null) return;
|
||||
var im = INotificationManager.Stub.asInterface(android.os.ServiceManager.getService("notification"));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
im.cancelNotificationWithTag("android", "android", modulePackageName, idValue, 0);
|
||||
} else {
|
||||
im.cancelNotificationWithTag("android", modulePackageName, idValue, 0);
|
||||
}
|
||||
// Remove the notification id when the notification is canceled or current module app was uninstalled
|
||||
notificationIds.remove(idKey);
|
||||
} catch (Throwable e) {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,17 @@ import android.os.IBinder;
|
|||
import android.os.IInterface;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
public interface INotificationManager extends IInterface {
|
||||
void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id,
|
||||
Notification notification, int userId) throws RemoteException;
|
||||
|
||||
void cancelNotificationWithTag(String pkg, String tag, int id, int userId) throws RemoteException;
|
||||
|
||||
@RequiresApi(30)
|
||||
void cancelNotificationWithTag(String pkg, String opPkg, String tag, int id, int userId) throws RemoteException;
|
||||
|
||||
void createNotificationChannels(String pkg, ParceledListSlice<NotificationChannel> channelsList) throws RemoteException;
|
||||
|
||||
abstract class Stub extends Binder implements INotificationManager {
|
||||
|
|
|
|||
Loading…
Reference in New Issue