110 lines
4.7 KiB
Java
110 lines
4.7 KiB
Java
package androidx.browser.customtabs;
|
|
|
|
import android.app.Service;
|
|
import android.content.Intent;
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.os.IBinder;
|
|
import android.os.RemoteException;
|
|
import android.support.customtabs.ICustomTabsCallback;
|
|
import android.support.customtabs.ICustomTabsService;
|
|
import androidx.collection.ArrayMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.NoSuchElementException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class CustomTabsService extends Service {
|
|
final Map<IBinder, IBinder.DeathRecipient> a = new ArrayMap();
|
|
private ICustomTabsService.Stub b = new ICustomTabsService.Stub() { // from class: androidx.browser.customtabs.CustomTabsService.1
|
|
@Override // android.support.customtabs.ICustomTabsService
|
|
public boolean a(long j) {
|
|
return CustomTabsService.this.a(j);
|
|
}
|
|
|
|
@Override // android.support.customtabs.ICustomTabsService
|
|
public Bundle b(String str, Bundle bundle) {
|
|
return CustomTabsService.this.a(str, bundle);
|
|
}
|
|
|
|
@Override // android.support.customtabs.ICustomTabsService
|
|
public boolean a(ICustomTabsCallback iCustomTabsCallback) {
|
|
final CustomTabsSessionToken customTabsSessionToken = new CustomTabsSessionToken(iCustomTabsCallback);
|
|
try {
|
|
IBinder.DeathRecipient deathRecipient = new IBinder.DeathRecipient() { // from class: androidx.browser.customtabs.CustomTabsService.1.1
|
|
@Override // android.os.IBinder.DeathRecipient
|
|
public void binderDied() {
|
|
CustomTabsService.this.a(customTabsSessionToken);
|
|
}
|
|
};
|
|
synchronized (CustomTabsService.this.a) {
|
|
iCustomTabsCallback.asBinder().linkToDeath(deathRecipient, 0);
|
|
CustomTabsService.this.a.put(iCustomTabsCallback.asBinder(), deathRecipient);
|
|
}
|
|
return CustomTabsService.this.b(customTabsSessionToken);
|
|
} catch (RemoteException unused) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
@Override // android.support.customtabs.ICustomTabsService
|
|
public boolean b(ICustomTabsCallback iCustomTabsCallback, Bundle bundle) {
|
|
return CustomTabsService.this.a(new CustomTabsSessionToken(iCustomTabsCallback), bundle);
|
|
}
|
|
|
|
@Override // android.support.customtabs.ICustomTabsService
|
|
public int b(ICustomTabsCallback iCustomTabsCallback, String str, Bundle bundle) {
|
|
return CustomTabsService.this.a(new CustomTabsSessionToken(iCustomTabsCallback), str, bundle);
|
|
}
|
|
|
|
@Override // android.support.customtabs.ICustomTabsService
|
|
public boolean a(ICustomTabsCallback iCustomTabsCallback, Uri uri, Bundle bundle, List<Bundle> list) {
|
|
return CustomTabsService.this.a(new CustomTabsSessionToken(iCustomTabsCallback), uri, bundle, list);
|
|
}
|
|
|
|
@Override // android.support.customtabs.ICustomTabsService
|
|
public boolean a(ICustomTabsCallback iCustomTabsCallback, Uri uri) {
|
|
return CustomTabsService.this.a(new CustomTabsSessionToken(iCustomTabsCallback), uri);
|
|
}
|
|
|
|
@Override // android.support.customtabs.ICustomTabsService
|
|
public boolean a(ICustomTabsCallback iCustomTabsCallback, int i, Uri uri, Bundle bundle) {
|
|
return CustomTabsService.this.a(new CustomTabsSessionToken(iCustomTabsCallback), i, uri, bundle);
|
|
}
|
|
};
|
|
|
|
protected abstract int a(CustomTabsSessionToken customTabsSessionToken, String str, Bundle bundle);
|
|
|
|
protected abstract Bundle a(String str, Bundle bundle);
|
|
|
|
protected abstract boolean a(long j);
|
|
|
|
protected boolean a(CustomTabsSessionToken customTabsSessionToken) {
|
|
try {
|
|
synchronized (this.a) {
|
|
IBinder a = customTabsSessionToken.a();
|
|
a.unlinkToDeath(this.a.get(a), 0);
|
|
this.a.remove(a);
|
|
}
|
|
return true;
|
|
} catch (NoSuchElementException unused) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
protected abstract boolean a(CustomTabsSessionToken customTabsSessionToken, int i, Uri uri, Bundle bundle);
|
|
|
|
protected abstract boolean a(CustomTabsSessionToken customTabsSessionToken, Uri uri);
|
|
|
|
protected abstract boolean a(CustomTabsSessionToken customTabsSessionToken, Uri uri, Bundle bundle, List<Bundle> list);
|
|
|
|
protected abstract boolean a(CustomTabsSessionToken customTabsSessionToken, Bundle bundle);
|
|
|
|
protected abstract boolean b(CustomTabsSessionToken customTabsSessionToken);
|
|
|
|
@Override // android.app.Service
|
|
public IBinder onBind(Intent intent) {
|
|
return this.b;
|
|
}
|
|
}
|