package com.adjust.sdk; import android.content.Context; import android.database.Cursor; import android.net.Uri; import java.util.concurrent.atomic.AtomicBoolean; public class InstallReferrerHuawei { private static final String REFERRER_PROVIDER_AUTHORITY = "com.huawei.appmarket.commondata"; private static final String REFERRER_PROVIDER_URI = "content://com.huawei.appmarket.commondata/item/5"; private Context context; private ILogger logger = AdjustFactory.getLogger(); private final InstallReferrerReadListener referrerCallback; private final AtomicBoolean shouldTryToRead; public InstallReferrerHuawei(Context context, InstallReferrerReadListener installReferrerReadListener) { this.context = context; this.referrerCallback = installReferrerReadListener; this.shouldTryToRead = new AtomicBoolean(true); } /* JADX WARNING: Code restructure failed: missing block: B:15:0x008a, code lost: if (r3 != null) goto L_0x00a1; */ /* JADX WARNING: Code restructure failed: missing block: B:20:0x009f, code lost: if (0 == 0) goto L_0x00a4; */ /* JADX WARNING: Code restructure failed: missing block: B:21:0x00a1, code lost: r3.close(); */ /* JADX WARNING: Code restructure failed: missing block: B:22:0x00a4, code lost: r17.shouldTryToRead.set(false); */ /* JADX WARNING: Code restructure failed: missing block: B:23:0x00a9, code lost: return; */ public void readReferrer() { if (!this.shouldTryToRead.get()) { this.logger.debug("Should not try to read Install referrer Huawei", new Object[0]); } else if (Util.resolveContentProvider(this.context, "com.huawei.appmarket.commondata")) { Cursor cursor = null; Uri parse = Uri.parse("content://com.huawei.appmarket.commondata/item/5"); try { cursor = this.context.getContentResolver().query(parse, null, null, new String[]{this.context.getPackageName()}, null); if (cursor == null || !cursor.moveToFirst()) { this.logger.debug("InstallReferrerHuawei fail to read referrer for package [%s] and content uri [%s]", this.context.getPackageName(), parse.toString()); } else { String string = cursor.getString(0); String string2 = cursor.getString(1); String string3 = cursor.getString(2); this.logger.debug("InstallReferrerHuawei reads referrer[%s] clickTime[%s] installTime[%s]", string, string2, string3); this.referrerCallback.onInstallReferrerRead(string, Long.parseLong(string2), Long.parseLong(string3)); } } catch (Exception e) { this.logger.debug("InstallReferrerHuawei error [%s]", e.getMessage()); } catch (Throwable th) { if (0 != 0) { cursor.close(); } throw th; } } } }