package com.umeng.analytics.pro; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; import android.os.IInterface; import android.os.Parcel; import android.os.RemoteException; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; /* access modifiers changed from: package-private */ /* compiled from: HuaweiDeviceIdSupplier */ public class ad implements z { private static final String a = "com.uodis.opendevice.aidl.OpenDeviceIdentifierService"; private static final int b = 1; private static final int c = 2; ad() { } @Override // com.umeng.analytics.pro.z public String a(Context context) { a aVar = new a(); Intent intent = new Intent("com.uodis.opendevice.OPENIDS_SERVICE"); intent.setPackage("com.huawei.hwid"); if (context.bindService(intent, aVar, 1)) { try { return new b(aVar.a()).a(); } catch (Exception unused) { } finally { context.unbindService(aVar); } } return null; } /* compiled from: HuaweiDeviceIdSupplier */ private static final class a implements ServiceConnection { boolean a; private final LinkedBlockingQueue<IBinder> b; public void onServiceDisconnected(ComponentName componentName) { } private a() { this.a = false; this.b = new LinkedBlockingQueue<>(); } public void onServiceConnected(ComponentName componentName, IBinder iBinder) { try { this.b.put(iBinder); } catch (InterruptedException unused) { } } public IBinder a() throws InterruptedException { if (!this.a) { this.a = true; return this.b.poll(5, TimeUnit.SECONDS); } throw new IllegalStateException(); } } /* compiled from: HuaweiDeviceIdSupplier */ private static final class b implements IInterface { private IBinder a; public b(IBinder iBinder) { this.a = iBinder; } public IBinder asBinder() { return this.a; } public String a() throws RemoteException { Parcel obtain = Parcel.obtain(); Parcel obtain2 = Parcel.obtain(); try { obtain.writeInterfaceToken(ad.a); this.a.transact(1, obtain, obtain2, 0); obtain2.readException(); return obtain2.readString(); } finally { obtain2.recycle(); obtain.recycle(); } } public boolean b() throws RemoteException { Parcel obtain = Parcel.obtain(); Parcel obtain2 = Parcel.obtain(); try { obtain.writeInterfaceToken(ad.a); boolean z = false; this.a.transact(2, obtain, obtain2, 0); obtain2.readException(); if (obtain2.readInt() != 0) { z = true; } return z; } finally { obtain2.recycle(); obtain.recycle(); } } } }