63 lines
2.1 KiB
Java
63 lines
2.1 KiB
Java
package io.fabric.sdk.android.services.common;
|
|
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
|
import io.fabric.sdk.android.Fabric;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ApiKey {
|
|
protected String a() {
|
|
return "Fabric could not be initialized, API key missing from AndroidManifest.xml. Add the following tag to your Application element \n\t<meta-data android:name=\"io.fabric.ApiKey\" android:value=\"YOUR_API_KEY\"/>";
|
|
}
|
|
|
|
protected String a(Context context) {
|
|
try {
|
|
Bundle bundle = context.getPackageManager().getApplicationInfo(context.getPackageName(), PeripheralType.SERVO).metaData;
|
|
if (bundle == null) {
|
|
return null;
|
|
}
|
|
String string = bundle.getString("io.fabric.ApiKey");
|
|
if (string != null) {
|
|
return string;
|
|
}
|
|
Fabric.g().d("Fabric", "Falling back to Crashlytics key lookup from Manifest");
|
|
return bundle.getString("com.crashlytics.ApiKey");
|
|
} catch (Exception e) {
|
|
Fabric.g().d("Fabric", "Caught non-fatal exception while retrieving apiKey: " + e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
protected String b(Context context) {
|
|
int a = CommonUtils.a(context, "io.fabric.ApiKey", "string");
|
|
if (a == 0) {
|
|
Fabric.g().d("Fabric", "Falling back to Crashlytics key lookup from Strings");
|
|
a = CommonUtils.a(context, "com.crashlytics.ApiKey", "string");
|
|
}
|
|
if (a != 0) {
|
|
return context.getResources().getString(a);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public String c(Context context) {
|
|
String a = a(context);
|
|
if (TextUtils.isEmpty(a)) {
|
|
a = b(context);
|
|
}
|
|
if (TextUtils.isEmpty(a)) {
|
|
d(context);
|
|
}
|
|
return a;
|
|
}
|
|
|
|
protected void d(Context context) {
|
|
if (Fabric.i() || CommonUtils.e(context)) {
|
|
throw new IllegalArgumentException(a());
|
|
}
|
|
Fabric.g().e("Fabric", a());
|
|
}
|
|
}
|