75 lines
2.8 KiB
Java
75 lines
2.8 KiB
Java
package androidx.core.app;
|
|
|
|
import android.app.Notification;
|
|
import android.app.Service;
|
|
import android.content.Intent;
|
|
import android.os.Binder;
|
|
import android.os.Build;
|
|
import android.os.IBinder;
|
|
import android.os.RemoteException;
|
|
import android.support.v4.app.INotificationSideChannel;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class NotificationCompatSideChannelService extends Service {
|
|
void a(int i, String str) {
|
|
for (String str2 : getPackageManager().getPackagesForUid(i)) {
|
|
if (str2.equals(str)) {
|
|
return;
|
|
}
|
|
}
|
|
throw new SecurityException("NotificationSideChannelService: Uid " + i + " is not authorized for package " + str);
|
|
}
|
|
|
|
public abstract void a(String str);
|
|
|
|
public abstract void a(String str, int i, String str2);
|
|
|
|
public abstract void a(String str, int i, String str2, Notification notification);
|
|
|
|
@Override // android.app.Service
|
|
public IBinder onBind(Intent intent) {
|
|
if (!intent.getAction().equals("android.support.BIND_NOTIFICATION_SIDE_CHANNEL") || Build.VERSION.SDK_INT > 19) {
|
|
return null;
|
|
}
|
|
return new NotificationSideChannelStub();
|
|
}
|
|
|
|
private class NotificationSideChannelStub extends INotificationSideChannel.Stub {
|
|
NotificationSideChannelStub() {
|
|
}
|
|
|
|
@Override // android.support.v4.app.INotificationSideChannel
|
|
public void a(String str, int i, String str2, Notification notification) throws RemoteException {
|
|
NotificationCompatSideChannelService.this.a(Binder.getCallingUid(), str);
|
|
long clearCallingIdentity = Binder.clearCallingIdentity();
|
|
try {
|
|
NotificationCompatSideChannelService.this.a(str, i, str2, notification);
|
|
} finally {
|
|
Binder.restoreCallingIdentity(clearCallingIdentity);
|
|
}
|
|
}
|
|
|
|
@Override // android.support.v4.app.INotificationSideChannel
|
|
public void a(String str, int i, String str2) throws RemoteException {
|
|
NotificationCompatSideChannelService.this.a(Binder.getCallingUid(), str);
|
|
long clearCallingIdentity = Binder.clearCallingIdentity();
|
|
try {
|
|
NotificationCompatSideChannelService.this.a(str, i, str2);
|
|
} finally {
|
|
Binder.restoreCallingIdentity(clearCallingIdentity);
|
|
}
|
|
}
|
|
|
|
@Override // android.support.v4.app.INotificationSideChannel
|
|
public void a(String str) {
|
|
NotificationCompatSideChannelService.this.a(Binder.getCallingUid(), str);
|
|
long clearCallingIdentity = Binder.clearCallingIdentity();
|
|
try {
|
|
NotificationCompatSideChannelService.this.a(str);
|
|
} finally {
|
|
Binder.restoreCallingIdentity(clearCallingIdentity);
|
|
}
|
|
}
|
|
}
|
|
}
|