正在查看: Zepto v25.1.4 应用的 UPIBridge.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Zepto v25.1.4 应用的 UPIBridge.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package in.juspay.hyperupi;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.Base64;
import android.util.Log;
import android.webkit.JavascriptInterface;
import androidx.core.content.ContextCompat;
import com.inmobi.media.oe;
import in.juspay.hyper.bridge.HyperBridge;
import in.juspay.hyper.constants.Labels;
import in.juspay.hyper.constants.LogLevel;
import in.juspay.hyper.constants.LogSubCategory;
import in.juspay.hyper.core.BridgeComponents;
import in.juspay.hyper.core.CallbackInvoker;
import in.juspay.hyper.core.JuspayLogger;
import in.juspay.hyper.core.TrackerInterface;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.ArraysKt;
import kotlin.io.CloseableKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.text.Charsets;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.npci.upi.security.services.CLRemoteResultReceiver;
import org.npci.upi.security.services.CLServices;
@Metadata
@SourceDebugExtension
public final class UPIBridge extends HyperBridge {
private static final float BEEP_VOLUME = 0.1f;
@NotNull
public static final Companion Companion = new Companion(null);
private static final String LOG_TAG = "UPIBridge";
@NotNull
private final CLUtils clInterface;
@NotNull
private final Queue<ResetCallback> resetCallbackQueue;
@NotNull
private final UPIUtils upiInterface;
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
public UPIBridge(@NotNull BridgeComponents bridgeComponents) {
super(bridgeComponents);
Intrinsics.checkNotNullParameter(bridgeComponents, "bridgeComponents");
this.resetCallbackQueue = new LinkedList();
this.upiInterface = new UPIUtils(bridgeComponents);
this.clInterface = new CLUtils(bridgeComponents);
}
private final boolean isPermissionGranted(String str) {
return ContextCompat.a(getBridgeComponents().getContext(), str) == 0;
}
public static final void playSound$lambda$0(MediaPlayer mp) {
Intrinsics.checkNotNullParameter(mp, "mp");
mp.stop();
mp.release();
}
public static final boolean playSound$lambda$1(UPIBridge this$0, MediaPlayer mp, int i2, int i3) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(mp, "mp");
Log.w(LOG_TAG, "Failed to play sound " + i2 + ", " + i3);
this$0.getBridgeComponents().getTrackerInterface().trackAction(LogSubCategory.Action.SYSTEM, "error", Labels.System.PLAY_AUDIO, "Failed to play sound", i2 + ", " + i3);
mp.stop();
mp.release();
return true;
}
@JavascriptInterface
public final boolean checkCLLibrary() {
try {
if (Build.VERSION.SDK_INT < 23) {
getBridgeComponents().getTrackerInterface().trackAction(LogSubCategory.Action.SYSTEM, LogLevel.DEBUG, Labels.System.CL_ELIGIBILITY, "Inapp Eligibility", "False : API LEVEL is less than 23.");
return false;
}
int i2 = CLRemoteResultReceiver.a;
int i3 = CLServices.a;
return true;
} catch (Exception e2) {
TrackerInterface trackerInterface = getBridgeComponents().getTrackerInterface();
String LOG_TAG2 = LOG_TAG;
Intrinsics.checkNotNullExpressionValue(LOG_TAG2, "LOG_TAG");
trackerInterface.trackAndLogException(LOG_TAG2, "action", LogSubCategory.Action.SYSTEM, Labels.System.CL_ELIGIBILITY, "Inapp Eligibility Exception", e2);
getBridgeComponents().getTrackerInterface().trackAction(LogSubCategory.Action.SYSTEM, LogLevel.DEBUG, Labels.System.CL_ELIGIBILITY, "Inapp Eligibility", "False : CL Dependencies are missing.");
return false;
}
}
@JavascriptInterface
@NotNull
public final String checkConnection() {
Context context = getBridgeComponents().getContext();
Object systemService = context.getSystemService("connectivity");
ConnectivityManager connectivityManager = systemService instanceof ConnectivityManager ? (ConnectivityManager) systemService : null;
Object systemService2 = context.getSystemService("phone");
TelephonyManager telephonyManager = systemService2 instanceof TelephonyManager ? (TelephonyManager) systemService2 : null;
if (connectivityManager == null) {
return UPIConstants.NETWORK_UNAVAILABLE;
}
if (!isPermissionGranted("android.permission.ACCESS_NETWORK_STATE")) {
return UPIConstants.NETWORK_PERMISSION_DENIED;
}
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo == null) {
return UPIConstants.NETWORK_UNAVAILABLE;
}
if (activeNetworkInfo.getType() != 1) {
return activeNetworkInfo.getType() == 0 ? UPIConstants.MOBILE_DATA : UPIConstants.NETWORK_UNAVAILABLE;
}
boolean z = Settings.Global.getInt(context.getContentResolver(), "airplane_mode_on", 0) == 0;
if (Build.VERSION.SDK_INT < 29 ? !(telephonyManager == null || telephonyManager.getSimState() != 5 || Settings.Global.getInt(context.getContentResolver(), "mobile_data", 1) != 1) : !(telephonyManager == null || !com.facebook.react.views.text.a.x(telephonyManager))) {
if (z) {
return UPIConstants.MOBILE_DATA_AND_WIFI;
}
}
return UPIConstants.WIFI;
}
@JavascriptInterface
@NotNull
public final String decodeNPCIXmlKeys(@Nullable String str) {
return this.clInterface.decodeNPCIXmlKeys(str);
}
@JavascriptInterface
@NotNull
public final String generateRandom() {
return this.clInterface.generateRandom();
}
@JavascriptInterface
@Nullable
public final String generateTrustCred(@Nullable String str, @Nullable String str2) {
return this.clInterface.generateTrustCred(str, str2);
}
@JavascriptInterface
@NotNull
public final String getCLVersion() {
return this.clInterface.getClVersion();
}
@JavascriptInterface
public final void getChallenge(@Nullable String str, @Nullable String str2, @Nullable String str3) {
this.clInterface.getChallenge(str, str2, str3);
}
@JavascriptInterface
public final void getCredentials(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, @Nullable String str5, @Nullable String str6, @Nullable String str7, @Nullable String str8, @Nullable String str9) {
this.clInterface.getCredentials(str, str2, str3, str4, str5, str6, str7, str8, str9);
}
@JavascriptInterface
@NotNull
public final String getDeviceDetails() {
byte[] bytes = this.upiInterface.getDeviceDetails().getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
String encodeToString = Base64.encodeToString(bytes, 2);
Intrinsics.checkNotNullExpressionValue(encodeToString, "encodeToString(\n … Base64.DEFAULT\n )");
return encodeToString;
}
@JavascriptInterface
@NotNull
public final String getSIMOperators() {
byte[] bArr;
String simOperators = this.upiInterface.getSimOperators();
if (simOperators != null) {
bArr = simOperators.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bArr, "this as java.lang.String).getBytes(charset)");
} else {
bArr = null;
}
String encodeToString = Base64.encodeToString(bArr, 2);
Intrinsics.checkNotNullExpressionValue(encodeToString, "encodeToString(\n … Base64.DEFAULT\n )");
return encodeToString;
}
@JavascriptInterface
public final void getUPILiteBalance(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4) {
this.clInterface.getUPILiteBalance(str, str2, str3, str4);
}
@JavascriptInterface
public final boolean isAirplaneModeOn() {
return this.upiInterface.isAirplaneModeOn();
}
@JavascriptInterface
public final boolean isDualSIM() {
return SimUtils.INSTANCE.isDualSim(getBridgeComponents().getContext());
}
@JavascriptInterface
public final boolean isSimActive(int i2) {
return this.upiInterface.isSimActive(i2);
}
@JavascriptInterface
public final boolean isSimSupport() {
return SimUtils.INSTANCE.isSimSupport(getBridgeComponents().getContext());
}
@JavascriptInterface
public final void isUpiLiteBound(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4) {
this.clInterface.isUpiLiteBound(str, str2, str3, str4);
}
@JavascriptInterface
public final void isUpiLiteSupported(@Nullable String str) {
this.clInterface.isUpiLiteSupported(str);
}
@JavascriptInterface
public final void playSound(@Nullable String str, @Nullable String str2) {
int i2 = 1;
if (str == null) {
String LOG_TAG2 = LOG_TAG;
Intrinsics.checkNotNullExpressionValue(LOG_TAG2, "LOG_TAG");
JuspayLogger.d(LOG_TAG2, "sound is null, returning.");
CallbackInvoker callbackInvoker = getBridgeComponents().getCallbackInvoker();
byte[] bytes = "sound NOT PROVIDED".getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
String format = String.format("{\"error\":\"true\",\"data\":\"%s\"}", Arrays.copyOf(new Object[]{Base64.encodeToString(bytes, 2)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "format(format, *args)");
callbackInvoker.invokeCallbackInDUIWebview(str2, format);
return;
}
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(3);
mediaPlayer.setOnCompletionListener(new g());
mediaPlayer.setOnErrorListener(new oe(this, i2));
try {
AssetFileDescriptor openFd = getBridgeComponents().getContext().getResources().getAssets().openFd(str);
try {
mediaPlayer.setDataSource(openFd.getFileDescriptor(), openFd.getStartOffset(), openFd.getLength());
Unit unit = Unit.a;
CloseableKt.a(openFd, null);
mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
mediaPlayer.prepare();
mediaPlayer.start();
} finally {
}
} catch (Exception e2) {
String LOG_TAG3 = LOG_TAG;
Log.w(LOG_TAG3, e2);
TrackerInterface trackerInterface = getBridgeComponents().getTrackerInterface();
Intrinsics.checkNotNullExpressionValue(LOG_TAG3, "LOG_TAG");
trackerInterface.trackAndLogException(LOG_TAG3, "action", LogSubCategory.Action.SYSTEM, Labels.System.PLAY_AUDIO, "PlaySound Exception", e2);
mediaPlayer.release();
}
}
@JavascriptInterface
@Nullable
public final String populateHMAC(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4) {
return this.clInterface.populateHMAC(str, str2, str3, str4);
}
@JavascriptInterface
public final void registerApp(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, @Nullable String str5) {
this.clInterface.registerApp(str, str2, str3, str4, str5);
}
@JavascriptInterface
public final void registerUPILiteOnboarding(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, @Nullable String str5) {
this.clInterface.registerUPILiteOnboarding(str, str2, str3, str4, str5);
}
@JavascriptInterface
public final void registerUPILiteState(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, @Nullable String str5) {
this.clInterface.registerUPILiteState(str, str2, str3, str4, str5);
}
@Override
public void reset() {
while (this.resetCallbackQueue.peek() != null) {
ResetCallback poll = this.resetCallbackQueue.poll();
if (poll != null) {
poll.reset();
}
}
}
@JavascriptInterface
public final void sendSMS(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4) {
sendSMS(str, new String[]{str}, str3, "1", str4);
}
@JavascriptInterface
public final void unBindDevice(@Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4) {
this.clInterface.unBindDevice(str, str2, str3, str4);
}
@JavascriptInterface
public final void unbindNPCICL(@NotNull String callback) {
Intrinsics.checkNotNullParameter(callback, "callback");
this.clInterface.unbindNPCICL(callback);
}
@JavascriptInterface
public final void sendSMS(@Nullable String str, @Nullable String[] strArr, @Nullable String str2, @Nullable String str3, @Nullable String str4) {
String[] strArr2;
if (strArr == null || (strArr2 = (String[]) ArraysKt.q(strArr).toArray(new String[0])) == null) {
strArr2 = new String[0];
}
String[] strArr3 = strArr2;
UPIUtils uPIUtils = this.upiInterface;
if (str == null) {
str = "0";
}
String str5 = str;
if (str3 == null) {
str3 = "1";
}
uPIUtils.sendSms(str5, strArr3, str2, str3, str4, new UPIBridge$sendSMS$1(this.resetCallbackQueue));
}
}