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 java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import ῲ.㴹.C2284;
import ῲ.㸾.K.C2296;

public abstract class CustomTabsService extends Service {

    /* renamed from: ʬ  reason: contains not printable characters */
    public ICustomTabsService.Stub f660 = new BinderC0122();

    /* renamed from: ῲ  reason: contains not printable characters */
    public final Map<IBinder, IBinder.DeathRecipient> f661 = new C2284();

    /* renamed from: androidx.browser.customtabs.CustomTabsService$K  reason: contains not printable characters */
    public class BinderC0122 extends ICustomTabsService.Stub {

        /* renamed from: androidx.browser.customtabs.CustomTabsService$K$K  reason: contains not printable characters */
        public class C0123 implements IBinder.DeathRecipient {

            /* renamed from: K  reason: contains not printable characters */
            public final /* synthetic */ C2296 f664;

            public C0123(C2296 k) {
                this.f664 = k;
            }

            public void binderDied() {
                CustomTabsService.this.m377(this.f664);
            }
        }

        public BinderC0122() {
        }

        @Override // android.support.customtabs.ICustomTabsService
        public Bundle extraCommand(String str, Bundle bundle) {
            return CustomTabsService.this.m375(str, bundle);
        }

        @Override // android.support.customtabs.ICustomTabsService
        public boolean mayLaunchUrl(ICustomTabsCallback iCustomTabsCallback, Uri uri, Bundle bundle, List<Bundle> list) {
            return CustomTabsService.this.m380(new C2296(iCustomTabsCallback), uri, bundle, list);
        }

        @Override // android.support.customtabs.ICustomTabsService
        public boolean newSession(ICustomTabsCallback iCustomTabsCallback) {
            C2296 k = new C2296(iCustomTabsCallback);
            try {
                C0123 k2 = new C0123(k);
                synchronized (CustomTabsService.this.f661) {
                    iCustomTabsCallback.asBinder().linkToDeath(k2, 0);
                    CustomTabsService.this.f661.put(iCustomTabsCallback.asBinder(), k2);
                }
                return CustomTabsService.this.m373(k);
            } catch (RemoteException unused) {
                return false;
            }
        }

        @Override // android.support.customtabs.ICustomTabsService
        public int postMessage(ICustomTabsCallback iCustomTabsCallback, String str, Bundle bundle) {
            return CustomTabsService.this.m374(new C2296(iCustomTabsCallback), str, bundle);
        }

        @Override // android.support.customtabs.ICustomTabsService
        public boolean requestPostMessageChannel(ICustomTabsCallback iCustomTabsCallback, Uri uri) {
            return CustomTabsService.this.m379(new C2296(iCustomTabsCallback), uri);
        }

        @Override // android.support.customtabs.ICustomTabsService
        public boolean updateVisuals(ICustomTabsCallback iCustomTabsCallback, Bundle bundle) {
            return CustomTabsService.this.m381(new C2296(iCustomTabsCallback), bundle);
        }

        @Override // android.support.customtabs.ICustomTabsService
        public boolean validateRelationship(ICustomTabsCallback iCustomTabsCallback, int i, Uri uri, Bundle bundle) {
            return CustomTabsService.this.m378(new C2296(iCustomTabsCallback), i, uri, bundle);
        }

        @Override // android.support.customtabs.ICustomTabsService
        public boolean warmup(long j) {
            return CustomTabsService.this.m376(j);
        }
    }

    public IBinder onBind(Intent intent) {
        return this.f660;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public abstract boolean m373(C2296 k);

    /* renamed from: K  reason: contains not printable characters */
    public abstract int m374(C2296 k, String str, Bundle bundle);

    /* renamed from: K  reason: contains not printable characters */
    public abstract Bundle m375(String str, Bundle bundle);

    /* renamed from: K  reason: contains not printable characters */
    public abstract boolean m376(long j);

    /* renamed from: K  reason: contains not printable characters */
    public boolean m377(C2296 k) {
        try {
            synchronized (this.f661) {
                IBinder r4 = k.m5990();
                r4.unlinkToDeath(this.f661.get(r4), 0);
                this.f661.remove(r4);
            }
            return true;
        } catch (NoSuchElementException unused) {
            return false;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public abstract boolean m378(C2296 k, int i, Uri uri, Bundle bundle);

    /* renamed from: K  reason: contains not printable characters */
    public abstract boolean m379(C2296 k, Uri uri);

    /* renamed from: K  reason: contains not printable characters */
    public abstract boolean m380(C2296 k, Uri uri, Bundle bundle, List<Bundle> list);

    /* renamed from: K  reason: contains not printable characters */
    public abstract boolean m381(C2296 k, Bundle bundle);
}
