package org.a.a.a.a.a; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.Signature; import android.os.Build; import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; import android.text.TextUtils; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.a.a.a.a.a; /* compiled from: OpenIDHelper */ public class b { /* renamed from: ʻ reason: contains not printable characters */ public org.a.a.a.a.a f7652 = null; /* renamed from: ʼ reason: contains not printable characters */ public String f7653 = null; /* renamed from: ʽ reason: contains not printable characters */ public String f7654 = null; /* renamed from: ʾ reason: contains not printable characters */ public final Object f7655 = new Object(); /* renamed from: ʿ reason: contains not printable characters */ public ServiceConnection f7656 = new a(); /* compiled from: OpenIDHelper */ class a implements ServiceConnection { public a() { } public void onServiceConnected(ComponentName componentName, IBinder iBinder) { b.this.f7652 = a.AbstractBinderC0117a.m9755(iBinder); synchronized (b.this.f7655) { b.this.f7655.notify(); } } public void onServiceDisconnected(ComponentName componentName) { b.this.f7652 = null; } } /* access modifiers changed from: private */ /* renamed from: org.a.a.a.a.a.b$b reason: collision with other inner class name */ /* compiled from: OpenIDHelper */ public static class C0119b { /* renamed from: ʻ reason: contains not printable characters */ public static final b f7658 = new b(null); } public /* synthetic */ b(a aVar) { } /* renamed from: ʻ reason: contains not printable characters */ public boolean m9758(Context context) { try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo("com.heytap.openid", 0); if (Build.VERSION.SDK_INT >= 28) { if (packageInfo == null || packageInfo.getLongVersionCode() < 1) { return false; } return true; } else if (packageInfo == null || packageInfo.versionCode < 1) { return false; } else { return true; } } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); return false; } } /* renamed from: ʼ reason: contains not printable characters */ public final String m9759(Context context, String str) { Signature[] signatureArr; if (TextUtils.isEmpty(this.f7653)) { this.f7653 = context.getPackageName(); } if (TextUtils.isEmpty(this.f7654)) { String str2 = null; try { signatureArr = context.getPackageManager().getPackageInfo(this.f7653, 64).signatures; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); signatureArr = null; } if (signatureArr != null && signatureArr.length > 0) { byte[] byteArray = signatureArr[0].toByteArray(); try { MessageDigest instance = MessageDigest.getInstance("SHA1"); if (instance != null) { byte[] digest = instance.digest(byteArray); StringBuilder sb = new StringBuilder(); for (byte b : digest) { sb.append(Integer.toHexString((b & 255) | 256).substring(1, 3)); } str2 = sb.toString(); } } catch (NoSuchAlgorithmException e2) { e2.printStackTrace(); } } this.f7654 = str2; } String r8 = ((a.AbstractBinderC0117a.C0118a) this.f7652).m9756(this.f7653, this.f7654, str); return TextUtils.isEmpty(r8) ? "" : r8; } /* renamed from: ʻ reason: contains not printable characters */ public synchronized String m9757(Context context, String str) { if (Looper.myLooper() == Looper.getMainLooper()) { throw new IllegalStateException("Cannot run on MainThread"); } else if (this.f7652 == null) { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.heytap.openid", "com.heytap.openid.IdentifyService")); intent.setAction("action.com.heytap.openid.OPEN_ID_SERVICE"); if (context.bindService(intent, this.f7656, 1)) { synchronized (this.f7655) { try { this.f7655.wait(3000); } catch (InterruptedException e) { e.printStackTrace(); } } } if (this.f7652 == null) { return ""; } try { return m9759(context, str); } catch (RemoteException e2) { e2.printStackTrace(); return ""; } } else { try { return m9759(context, str); } catch (RemoteException e3) { e3.printStackTrace(); return ""; } } } }