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


package com.xlx.speech.voicereadsdk.oaid.impl;

import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import com.xlx.speech.voicereadsdk.oaid.IGetter;
import com.xlx.speech.voicereadsdk.oaid.IOAID;
import com.xlx.speech.voicereadsdk.oaid.OAIDException;
import com.xlx.speech.voicereadsdk.oaid.OAIDLog;
import com.xlx.speech.voicereadsdk.oaid.aidl.zui.deviceidservice.IDeviceidInterface;
import com.xlx.speech.voicereadsdk.oaid.impl.OAIDService;

/* access modifiers changed from: package-private */
public class LenovoImpl implements IOAID {
    private final Context context;

    public LenovoImpl(Context context2) {
        this.context = context2;
    }

    @Override // com.xlx.speech.voicereadsdk.oaid.IOAID
    public void doGet(IGetter iGetter) {
        if (this.context != null && iGetter != null) {
            Intent intent = new Intent();
            intent.setClassName("com.zui.deviceidservice", "com.zui.deviceidservice.DeviceidService");
            OAIDService.bind(this.context, intent, iGetter, new OAIDService.RemoteCaller() {
                /* class com.xlx.speech.voicereadsdk.oaid.impl.LenovoImpl.AnonymousClass1 */

                @Override // com.xlx.speech.voicereadsdk.oaid.impl.OAIDService.RemoteCaller
                public String callRemoteInterface(IBinder iBinder) {
                    IDeviceidInterface asInterface = IDeviceidInterface.Stub.asInterface(iBinder);
                    if (asInterface == null) {
                        throw new OAIDException("IDeviceidInterface is null");
                    } else if (asInterface.isSupport()) {
                        return asInterface.getOAID();
                    } else {
                        throw new OAIDException("IDeviceidInterface#isSupport return false");
                    }
                }
            });
        }
    }

    @Override // com.xlx.speech.voicereadsdk.oaid.IOAID
    public boolean supported() {
        Context context2 = this.context;
        if (context2 == null) {
            return false;
        }
        try {
            return context2.getPackageManager().getPackageInfo("com.zui.deviceidservice", 0) != null;
        } catch (Exception e) {
            OAIDLog.print(e);
            return false;
        }
    }
}