99 lines
4.0 KiB
Java
99 lines
4.0 KiB
Java
package com.google.android.gms.measurement.internal;
|
|
|
|
import android.content.ComponentName;
|
|
import android.content.Intent;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.pm.ResolveInfo;
|
|
import android.content.pm.ServiceInfo;
|
|
import android.os.Bundle;
|
|
import com.google.android.gms.common.stats.ConnectionTracker;
|
|
import com.google.android.gms.common.wrappers.PackageManagerWrapper;
|
|
import com.google.android.gms.common.wrappers.Wrappers;
|
|
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class zzbj {
|
|
final zzbw a;
|
|
|
|
zzbj(zzbw zzbwVar) {
|
|
this.a = zzbwVar;
|
|
}
|
|
|
|
protected final void a(String str) {
|
|
if (str == null || str.isEmpty()) {
|
|
this.a.e().z().a("Install Referrer Reporter was called with invalid app package name");
|
|
return;
|
|
}
|
|
this.a.a().f();
|
|
if (!a()) {
|
|
this.a.e().z().a("Install Referrer Reporter is not available");
|
|
return;
|
|
}
|
|
this.a.e().z().a("Install Referrer Reporter is initializing");
|
|
zzbk zzbkVar = new zzbk(this, str);
|
|
this.a.a().f();
|
|
Intent intent = new Intent("com.google.android.finsky.BIND_GET_INSTALL_REFERRER_SERVICE");
|
|
intent.setComponent(new ComponentName("com.android.vending", "com.google.android.finsky.externalreferrer.GetInstallReferrerService"));
|
|
PackageManager packageManager = this.a.b().getPackageManager();
|
|
if (packageManager == null) {
|
|
this.a.e().w().a("Failed to obtain Package Manager to verify binding conditions");
|
|
return;
|
|
}
|
|
List<ResolveInfo> queryIntentServices = packageManager.queryIntentServices(intent, 0);
|
|
if (queryIntentServices == null || queryIntentServices.isEmpty()) {
|
|
this.a.e().z().a("Play Service for fetching Install Referrer is unavailable on device");
|
|
return;
|
|
}
|
|
ResolveInfo resolveInfo = queryIntentServices.get(0);
|
|
ServiceInfo serviceInfo = resolveInfo.serviceInfo;
|
|
if (serviceInfo != null) {
|
|
String str2 = serviceInfo.packageName;
|
|
if (resolveInfo.serviceInfo.name == null || !"com.android.vending".equals(str2) || !a()) {
|
|
this.a.e().z().a("Play Store missing or incompatible. Version 8.3.73 or later required");
|
|
return;
|
|
}
|
|
try {
|
|
this.a.e().z().a("Install Referrer Service is", ConnectionTracker.a().a(this.a.b(), new Intent(intent), zzbkVar, 1) ? "available" : "not available");
|
|
} catch (Exception e) {
|
|
this.a.e().t().a("Exception occurred while binding to Install Referrer Service", e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
|
|
private final boolean a() {
|
|
try {
|
|
PackageManagerWrapper a = Wrappers.a(this.a.b());
|
|
if (a != null) {
|
|
return a.b("com.android.vending", PeripheralType.SERVO).versionCode >= 80837300;
|
|
}
|
|
this.a.e().z().a("Failed to retrieve Package Manager to check Play Store compatibility");
|
|
return false;
|
|
} catch (Exception e) {
|
|
this.a.e().z().a("Failed to retrieve Play Store version", e);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
final Bundle a(String str, com.google.android.gms.internal.measurement.zzu zzuVar) {
|
|
this.a.a().f();
|
|
if (zzuVar == null) {
|
|
this.a.e().w().a("Attempting to use Install Referrer Service while it is not initialized");
|
|
return null;
|
|
}
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString("package_name", str);
|
|
try {
|
|
Bundle c = zzuVar.c(bundle);
|
|
if (c != null) {
|
|
return c;
|
|
}
|
|
this.a.e().t().a("Install Referrer Service returned a null response");
|
|
return null;
|
|
} catch (Exception e) {
|
|
this.a.e().t().a("Exception occurred while retrieving the Install Referrer", e.getMessage());
|
|
return null;
|
|
}
|
|
}
|
|
}
|