������������������.apk分析 / as.java


package com.xiaomi.push;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.IBinder;
import android.os.Looper;
import android.os.Parcel;

/* access modifiers changed from: package-private */
public class as implements au {
    private static boolean a;

    /* renamed from: a  reason: collision with other field name */
    private volatile int f6744a = 0;

    /* renamed from: a  reason: collision with other field name */
    private Context f6745a;

    /* renamed from: a  reason: collision with other field name */
    private ServiceConnection f6746a;

    /* renamed from: a  reason: collision with other field name */
    private final Object f6747a = new Object();

    /* renamed from: a  reason: collision with other field name */
    private volatile String f6748a = null;
    private volatile String b = null;

    /* renamed from: b  reason: collision with other field name */
    private volatile boolean f6749b = false;

    /* access modifiers changed from: private */
    public class a implements ServiceConnection {
        private a() {
        }

        /* JADX WARNING: Exception block dominator not found, dom blocks: [] */
        /* JADX WARNING: Missing exception handler attribute for start block: B:19:0x0052 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:30:0x0073 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:8:0x0030 */
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            try {
                as.this.f6748a = b.a(iBinder);
                as.this.f6749b = b.m9125a(iBinder);
                as.this.b();
                as.this.f6744a = 2;
                synchronized (as.this.f6747a) {
                    as.this.f6747a.notifyAll();
                }
            } catch (Exception unused) {
                as.this.b();
                as.this.f6744a = 2;
                synchronized (as.this.f6747a) {
                    as.this.f6747a.notifyAll();
                }
            } catch (Throwable th) {
                as.this.b();
                as.this.f6744a = 2;
                synchronized (as.this.f6747a) {
                    as.this.f6747a.notifyAll();
                    throw th;
                }
            }
        }

        public void onServiceDisconnected(ComponentName componentName) {
        }
    }

    private static class b {
        static String a(IBinder iBinder) {
            Parcel obtain = Parcel.obtain();
            Parcel obtain2 = Parcel.obtain();
            try {
                obtain.writeInterfaceToken("com.uodis.opendevice.aidl.OpenDeviceIdentifierService");
                iBinder.transact(1, obtain, obtain2, 0);
                obtain2.readException();
                return obtain2.readString();
            } finally {
                obtain2.recycle();
                obtain.recycle();
            }
        }

        /* renamed from: a  reason: collision with other method in class */
        static boolean m9125a(IBinder iBinder) {
            Parcel obtain = Parcel.obtain();
            Parcel obtain2 = Parcel.obtain();
            try {
                obtain.writeInterfaceToken("com.uodis.opendevice.aidl.OpenDeviceIdentifierService");
                boolean z = false;
                iBinder.transact(2, obtain, obtain2, 0);
                obtain2.readException();
                if (obtain2.readInt() != 0) {
                    z = true;
                }
                return z;
            } finally {
                obtain2.recycle();
                obtain.recycle();
            }
        }
    }

    public as(Context context) {
        this.f6745a = context;
        a();
    }

    /* JADX WARNING: Removed duplicated region for block: B:16:0x0027 A[ORIG_RETURN, RETURN, SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:17:? A[RETURN, SYNTHETIC] */
    private static String a(Context context) {
        String str;
        String str2;
        String str3 = null;
        try {
            if (Build.VERSION.SDK_INT >= 24) {
                str2 = context.createDeviceProtectedStorageContext().getSharedPreferences("aaid", 0).getString("aaid", null);
                if (str2 != null) {
                    return str2;
                }
            } else {
                str2 = null;
            }
            try {
                str = context.getSharedPreferences("aaid", 0).getString("aaid", null);
            } catch (Exception unused) {
                str3 = str2;
            }
        } catch (Exception unused2) {
            str = str3;
            if (str != null) {
            }
        }
        return str != null ? "" : str;
    }

    @Override // com.xiaomi.push.au, com.xiaomi.push.au
    private void a() {
        boolean z;
        this.f6746a = new a();
        Intent intent = new Intent("com.uodis.opendevice.OPENIDS_SERVICE");
        intent.setPackage("com.huawei.hwid");
        int i = 1;
        try {
            z = this.f6745a.bindService(intent, this.f6746a, 1);
        } catch (Exception unused) {
            z = false;
        }
        if (!z) {
            i = 2;
        }
        this.f6744a = i;
    }

    /* JADX WARNING: Exception block dominator not found, dom blocks: [] */
    /* JADX WARNING: Missing exception handler attribute for start block: B:9:0x0032 */
    private void a(String str) {
        if (this.f6744a == 1 && Looper.myLooper() != Looper.getMainLooper()) {
            synchronized (this.f6747a) {
                com.xiaomi.channel.commonutils.logger.b.m9051a("huawei's " + str + " wait...");
                this.f6747a.wait(3000);
            }
        }
    }

    /* renamed from: a  reason: collision with other method in class */
    public static boolean m9121a(Context context) {
        try {
            PackageInfo packageInfo = context.getPackageManager().getPackageInfo("com.huawei.hwid", 128);
            boolean z = (packageInfo.applicationInfo.flags & 1) != 0;
            a = packageInfo.versionCode >= 20602000;
            return z;
        } catch (Exception unused) {
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    @Override // com.xiaomi.push.au
    private void b() {
        ServiceConnection serviceConnection = this.f6746a;
        if (serviceConnection != null) {
            try {
                this.f6745a.unbindService(serviceConnection);
            } catch (Exception unused) {
            }
        }
    }

    @Override // com.xiaomi.push.au, com.xiaomi.push.au
    /* renamed from: a  reason: collision with other method in class */
    public String m9122a() {
        return null;
    }

    @Override // com.xiaomi.push.au, com.xiaomi.push.au
    /* renamed from: a  reason: collision with other method in class */
    public boolean m9123a() {
        return a;
    }

    @Override // com.xiaomi.push.au
    /* renamed from: b  reason: collision with other method in class */
    public String m9124b() {
        a("getOAID");
        return this.f6748a;
    }

    @Override // com.xiaomi.push.au
    public String c() {
        return null;
    }

    @Override // com.xiaomi.push.au
    public String d() {
        if (this.b == null) {
            synchronized (this) {
                if (this.b == null) {
                    this.b = a(this.f6745a);
                }
            }
        }
        return this.b;
    }
}