翰林优商.apk(点击下载) / h.java


package com.czhj.devicehelper.oaId.helpers;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.util.Log;
import com.czhj.devicehelper.oaId.helpers.DevicesIDsHelper;
import com.czhj.devicehelper.oaId.interfaces.f;
import com.czhj.sdk.logger.SigmobLog;
import java.util.concurrent.LinkedBlockingQueue;

public class h {
    public final LinkedBlockingQueue<IBinder> a = new LinkedBlockingQueue<>(1);
    ServiceConnection b = new ServiceConnection() {
        /* class com.czhj.devicehelper.oaId.helpers.h.AnonymousClass1 */

        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            Log.d("oaid", "oaid onServiceConnected() called with: name = [" + componentName + "], service = [" + iBinder + "]");
            try {
                h.this.a.put(iBinder);
            } catch (Exception e) {
                SigmobLog.e(e.getMessage());
            }
        }

        public void onServiceDisconnected(ComponentName componentName) {
        }
    };
    private Context c;

    public h(Context context) {
        this.c = context;
    }

    public void a(DevicesIDsHelper.AppIdsUpdater appIdsUpdater) {
        if (a()) {
            Intent intent = new Intent();
            intent.setClassName("com.samsung.android.deviceidservice", "com.samsung.android.deviceidservice.DeviceIdService");
            if (this.c.bindService(intent, this.b, 1)) {
                try {
                    String a2 = new f.a(this.a.take()).a();
                    if (appIdsUpdater != null) {
                        appIdsUpdater.OnIdsAvalid(a2);
                    }
                } catch (Exception e) {
                    SigmobLog.e(e.getMessage());
                } catch (Throwable th) {
                    this.c.unbindService(this.b);
                    throw th;
                }
                this.c.unbindService(this.b);
            }
        }
    }

    public boolean a() {
        try {
            return this.c.getPackageManager().getPackageInfo("com.samsung.android.deviceidservice", 0) != null;
        } catch (Throwable unused) {
            return false;
        }
    }
}