2021-06-27 20:44:35 +00:00
|
|
|
package c.i.a.f.d;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.pm.PackageInfo;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.content.pm.ResolveInfo;
|
|
|
|
import android.util.Log;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import c.i.a.f.e.o.c;
|
|
|
|
import c.i.a.f.e.p.b;
|
|
|
|
import java.util.List;
|
|
|
|
/* compiled from: com.google.android.gms:play-services-cloud-messaging@@16.0.0 */
|
|
|
|
public final class r {
|
|
|
|
public final Context a;
|
|
|
|
public int b;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-13 20:23:20 +00:00
|
|
|
public int f1027c = 0;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
public r(Context context) {
|
|
|
|
this.a = context;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final synchronized int a() {
|
2021-07-13 20:23:20 +00:00
|
|
|
int i = this.f1027c;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (i != 0) {
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
PackageManager packageManager = this.a.getPackageManager();
|
|
|
|
if (b.a(this.a).a.getPackageManager().checkPermission("com.google.android.c2dm.permission.SEND", "com.google.android.gms") == -1) {
|
|
|
|
Log.e("Metadata", "Google Play services missing or without correct permission.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!c.R()) {
|
|
|
|
Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
|
|
|
|
intent.setPackage("com.google.android.gms");
|
|
|
|
List<ResolveInfo> queryIntentServices = packageManager.queryIntentServices(intent, 0);
|
|
|
|
if (queryIntentServices != null && queryIntentServices.size() > 0) {
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f1027c = 1;
|
2021-06-27 20:44:35 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Intent intent2 = new Intent("com.google.iid.TOKEN_REQUEST");
|
|
|
|
intent2.setPackage("com.google.android.gms");
|
|
|
|
List<ResolveInfo> queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent2, 0);
|
|
|
|
if (queryBroadcastReceivers == null || queryBroadcastReceivers.size() <= 0) {
|
|
|
|
Log.w("Metadata", "Failed to resolve IID implementation package, falling back");
|
|
|
|
if (c.R()) {
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f1027c = 2;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f1027c = 1;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-07-13 20:23:20 +00:00
|
|
|
return this.f1027c;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f1027c = 2;
|
2021-06-27 20:44:35 +00:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
public final PackageInfo b(String str) {
|
|
|
|
try {
|
|
|
|
return b.a(this.a).a.getPackageManager().getPackageInfo(str, 0);
|
|
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
|
|
String valueOf = String.valueOf(e);
|
|
|
|
a.Y(valueOf.length() + 23, "Failed to find package ", valueOf, "Metadata");
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|