Exploit databaseDownload repository ZIP
GH-14fb583d3d1bd2da10251bb1a37b93d6
gitchw/ghostlock-cve-2026-43499
Sources for CVE-2026-43499
169 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files26
gitchw/ghostlock-cve-2026-43499Revision 96acd93156f6
- ↑..Parent directory
- GenericAdapter.java
- ICMDeathCallback.java
- ICentralService.java
- IDeathCallback.java
- IDirectPairCallback.java
- IDisPairCallback.java
- IDisScanCallback.java
- IDiscoveryNativeService.java
- IFrameworkManager.java
- IGenFrameworkManager.java
- ILanCacheIpServiceCallback.java
- IMsgExpCallback.java
- INsdDevicesCallback.java
- IP2pChangeListener.java
- IPeerAgentAuthCallback.java
- IPeerAgentCallback.java
- IPeripheralCallback.java
- IPeripheralService.java
- IPermissionCallback.java
- IQRCodeContentCallback.java
- IServiceChannelCallback.java
- IServiceConnectionCallback.java
- IServiceConnectionIndicationCallback.java
- IWifiP2pChangeReceiver.java
- IWifiP2pService.java
- ManagerConfig.java
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
workspace/decomp/HeyOTA/sources/com/heytap/accessory/api/GenericAdapter.java
Java · 17,932 bytespackage com.heytap.accessory.api;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.ResultReceiver;
import com.heytap.accessory.Config;
import com.heytap.accessory.Initializer;
import com.heytap.accessory.accessorymanager.ConnectConfig;
import com.heytap.accessory.api.ICMDeathCallback;
import com.heytap.accessory.api.IGenFrameworkManager;
import com.heytap.accessory.bean.AccountInfo;
import com.heytap.accessory.bean.FlowControlConfig;
import com.heytap.accessory.bean.PeerAccessory;
import com.heytap.accessory.bean.ServiceProfile;
import com.heytap.accessory.bean.TrafficControlConfig;
import com.heytap.accessory.constant.AFConstants;
import com.heytap.accessory.logging.SdkLog;
import com.heytap.accessory.utils.HexUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
/* loaded from: classes.dex */
public class GenericAdapter {
private static final String TAG = "GenericAdapter";
private static ICMDeathCallback sCMDeathCallback;
private static CountDownLatch sCountDownLatch;
static ServiceConnection sGenericConnection = new ServiceConnection() { // from class: com.heytap.accessory.api.GenericAdapter.1
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
synchronized (GenericAdapter.sOnlyInstance) {
GenericAdapter.sOnlyInstance.mProxy = IGenFrameworkManager.Stub.asInterface(iBinder);
Bundle bundle = new Bundle();
String packageName = GenericAdapter.sOnlyInstance.mContext.getPackageName();
SdkLog.d(GenericAdapter.TAG, "onServiceConnected: packageName: " + packageName);
bundle.putString(AFConstants.EXTRA_PACKAGE_NAME, packageName);
bundle.putInt("sdkVersionCode", Config.getSdkVersionCode());
SdkLog.i(GenericAdapter.TAG, "Getting CMxmlreader instance");
if (GenericAdapter.sOnlyInstance.mProxy != null) {
try {
Bundle sendCommand = GenericAdapter.sOnlyInstance.mProxy.sendCommand(-1L, 1, bundle);
if (sendCommand == null) {
SdkLog.i(GenericAdapter.TAG, "response is null");
} else if (sendCommand.containsKey(AFConstants.EXTRA_CLIENT_ID)) {
GenericAdapter.sOnlyInstance.mClientId = sendCommand.getLong(AFConstants.EXTRA_CLIENT_ID);
GenericAdapter.sOnlyInstance.mProxy.registerDeathCallback(GenericAdapter.sOnlyInstance.mClientId, GenericAdapter.sCMDeathCallback);
}
} catch (RemoteException e) {
SdkLog.e(GenericAdapter.TAG, "exception: " + e.getMessage());
}
if (GenericAdapter.sOnlyInstance.mAccessoryEventReceiver != null) {
GenericAdapter.sOnlyInstance.registerAccessoryCallback(GenericAdapter.sOnlyInstance.mAccessoryEventReceiver);
}
}
SdkLog.d(GenericAdapter.TAG, "Client ID:" + GenericAdapter.sOnlyInstance.mClientId);
if (GenericAdapter.sCountDownLatch != null) {
GenericAdapter.sCountDownLatch.countDown();
}
SdkLog.i(GenericAdapter.TAG, "onServiceConnected: Just notified");
}
}
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName componentName) {
synchronized (GenericAdapter.sOnlyInstance) {
SdkLog.i(GenericAdapter.TAG, "Disconnected from Generic service");
GenericAdapter.sOnlyInstance.mProxy = null;
GenericAdapter.sOnlyInstance.mClientId = -1L;
if (GenericAdapter.sOnlyInstance.mAccessoryEventReceiver != null) {
GenericAdapter.sOnlyInstance.mAccessoryEventReceiver.send(20001, new Bundle());
}
}
}
};
private static volatile GenericAdapter sOnlyInstance;
private ResultReceiver mAccessoryEventReceiver;
private Context mContext;
private IGenFrameworkManager mProxy;
private long mClientId = -1;
private IBinder mToken = new Binder();
/* loaded from: classes.dex */
private static final class ICMDeathCallbackStub extends ICMDeathCallback.Stub {
private String mPackageName;
public ICMDeathCallbackStub(String str) {
if (str != null) {
this.mPackageName = str;
return;
}
throw new IllegalArgumentException("Invalid packageName:null");
}
@Override // com.heytap.accessory.api.ICMDeathCallback
public String getAppName() throws RemoteException {
return this.mPackageName;
}
}
private GenericAdapter(Context context) {
this.mContext = context;
sCMDeathCallback = new ICMDeathCallbackStub(context.getPackageName());
}
public static GenericAdapter getInstance(Context context) {
if (sOnlyInstance == null) {
synchronized (GenericAdapter.class) {
if (sOnlyInstance == null) {
sOnlyInstance = new GenericAdapter(context);
}
}
}
if (sOnlyInstance.mProxy == null) {
sCountDownLatch = new CountDownLatch(1);
Intent intent = new Intent(ManagerConfig.INTENT_BASE_FRAMEWORK_SERVICE);
if (Initializer.useOAFApp()) {
intent.setPackage(ManagerConfig.ACCESSORY_FRAMEWORK_PACKAGE);
} else {
intent.setPackage(context.getPackageName());
}
if (!context.bindService(intent, sGenericConnection, 1)) {
SdkLog.w(TAG, "bind INTENT_BASE_FRAMEWORK_SERVICE failed!");
if (sOnlyInstance.mAccessoryEventReceiver != null) {
sOnlyInstance.mAccessoryEventReceiver.send(20001, new Bundle());
}
return sOnlyInstance;
}
try {
SdkLog.d(TAG, "start count down latch");
sCountDownLatch.await(3000L, TimeUnit.MILLISECONDS);
} catch (Exception unused) {
SdkLog.e(TAG, "bind GAdapter error.");
}
}
return sOnlyInstance;
}
private ResultReceiver prepareResultReceiver(ResultReceiver resultReceiver) {
Parcel obtain = Parcel.obtain();
resultReceiver.writeToParcel(obtain, 0);
obtain.setDataPosition(0);
ResultReceiver resultReceiver2 = (ResultReceiver) ResultReceiver.CREATOR.createFromParcel(obtain);
obtain.recycle();
return resultReceiver2;
}
private synchronized Bundle sendCommand(IGenFrameworkManager iGenFrameworkManager, long j, int i, Bundle bundle) throws RemoteException {
Bundle bundle2 = new Bundle();
if (iGenFrameworkManager == null) {
String str = TAG;
SdkLog.w(str, "proxy is null, rebind service please");
bundle2.putInt("statusCode", -1);
SdkLog.w(str, "proxy is null, maybe you need to bind oaf service.");
return bundle2;
}
Bundle sendCommand = this.mProxy.sendCommand(j, i, bundle);
if (sendCommand != null) {
return sendCommand;
}
throw new RemoteException("command not support:" + i + ", please update oaf.");
}
public synchronized int checkKscExist(byte[] bArr, byte[] bArr2) {
Bundle bundle;
bundle = new Bundle();
bundle.putByteArray(AFConstants.EXTRA_CONNECT_PARAM_DEVICE_ID, bArr);
bundle.putByteArray(AFConstants.EXTRA_CONNECT_PARAM_KSC_ALIAS, bArr2);
try {
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: " + e.getMessage());
return -1;
}
return sendCommand(this.mProxy, this.mClientId, 20, bundle).getInt("statusCode");
}
public synchronized int connect(ConnectConfig connectConfig) {
int i;
i = -1;
Bundle bundle = new Bundle();
bundle.putAll(connectConfig.getBundle());
if (connectConfig.getTransportType() == 1) {
bundle.putBinder("p2p_connect_token", this.mToken);
}
try {
i = sendCommand(this.mProxy, this.mClientId, 8, bundle).getInt("statusCode");
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: connect " + e.getMessage());
e.printStackTrace();
}
return i;
}
public synchronized List<AccountInfo> getAccountInfoList() {
Bundle sendCommand;
Bundle bundle = new Bundle();
SdkLog.d(TAG, "adapter getAccountInfoArray = " + bundle);
ArrayList arrayList = new ArrayList();
try {
sendCommand = sendCommand(this.mProxy, this.mClientId, 10, bundle);
sendCommand.setClassLoader(AccountInfo.class.getClassLoader());
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: " + e.getMessage());
}
if (sendCommand.getInt(AFConstants.EXTRA_CONNECT_PARAM_ACCOUNT_SIZE) == 0) {
return arrayList;
}
arrayList = sendCommand.getParcelableArrayList(AFConstants.EXTRA_CONNECT_PARAM_ACCOUNT_LIST);
return arrayList;
}
public synchronized List<ServiceProfile> getAvailableServices(long j) {
ArrayList arrayList;
arrayList = new ArrayList();
Bundle bundle = new Bundle();
bundle.putLong("accessoryId", j);
try {
Bundle sendCommand = sendCommand(this.mProxy, this.mClientId, 12, bundle);
sendCommand.setClassLoader(ServiceProfile.class.getClassLoader());
if (sendCommand.getInt("statusCode", -1) == 0) {
arrayList = sendCommand.getParcelableArrayList("remoteServices");
}
String str = TAG;
StringBuilder sb = new StringBuilder();
sb.append("return accessoryId:");
sb.append(j);
sb.append(" services size:");
sb.append(arrayList != null ? Integer.valueOf(arrayList.size()) : "null");
SdkLog.d(str, sb.toString());
} catch (RemoteException e) {
SdkLog.e(TAG, "getAvailableServices exception: " + e.getMessage());
}
return arrayList;
}
public synchronized List<PeerAccessory> getConnectedAccessories() {
ArrayList arrayList;
arrayList = new ArrayList();
try {
Bundle sendCommand = sendCommand(this.mProxy, this.mClientId, 4, new Bundle());
sendCommand.setClassLoader(PeerAccessory.class.getClassLoader());
if (sendCommand.getInt("statusCode", -1) == 0) {
arrayList = sendCommand.getParcelableArrayList("connectedAccessories");
}
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: " + e.getMessage());
}
return arrayList;
}
public synchronized byte[] getLocalDeviceId() {
byte[] byteArray;
try {
byteArray = sendCommand(this.mProxy, this.mClientId, 22, new Bundle()).getByteArray("extra_local_device_id");
if (byteArray == null) {
SdkLog.w(TAG, "getPresentDeviceId null");
} else {
SdkLog.d(TAG, "getPresentDeviceId success");
}
} catch (RemoteException e) {
SdkLog.e(TAG, "getPresentDeviceId exception: " + e.getMessage());
return null;
}
return byteArray;
}
public synchronized int getLocalDeviceType() throws RemoteException {
return sendCommand(this.mProxy, this.mClientId, 23, new Bundle()).getInt(AFConstants.EXTRA_LOCAL_DEVICE_TYPE);
}
public synchronized boolean hasBoundFramework() {
return this.mProxy != null;
}
public synchronized boolean isAccessoryCallbackSet() {
return sOnlyInstance.mAccessoryEventReceiver != null;
}
public synchronized boolean isAccessoryEnabled() {
boolean z;
z = false;
try {
int i = sendCommand(this.mProxy, this.mClientId, 31, new Bundle()).getInt(AFConstants.EXTRA_OAF_SWITCH_STATE, -1);
SdkLog.d(TAG, "isQuickConnectSwitchOpened state:" + i);
if (i != 0) {
z = true;
}
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: isQuickConnectSwitchOpened " + e.getMessage());
e.printStackTrace();
}
return z;
}
public synchronized boolean registerAccessoryCallback(ResultReceiver resultReceiver) {
SdkLog.d(TAG, "Register callback");
Bundle bundle = new Bundle();
sOnlyInstance.mAccessoryEventReceiver = resultReceiver;
bundle.putParcelable("resultReceiver", prepareResultReceiver(resultReceiver));
try {
if (sendCommand(this.mProxy, this.mClientId, 6, bundle).getInt("statusCode", -1) == 0) {
return true;
}
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: " + e.getMessage());
}
return false;
}
public synchronized void release() {
Bundle bundle = new Bundle();
if (sOnlyInstance.mProxy != null) {
try {
if (sendCommand(sOnlyInstance.mProxy, sOnlyInstance.mClientId, 5, bundle).getInt("statusCode", -1) == 0) {
SdkLog.d(TAG, "Framework connection terminated successfully.");
}
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: " + e.getMessage());
}
if (sOnlyInstance.mContext != null) {
try {
sOnlyInstance.mContext.unbindService(sGenericConnection);
} catch (Exception e2) {
SdkLog.e(TAG, "exception: unbind");
e2.printStackTrace();
}
}
sOnlyInstance.mProxy = null;
sOnlyInstance.mClientId = -1L;
sOnlyInstance.mAccessoryEventReceiver = null;
}
}
public synchronized int removeKsc(byte[] bArr, byte[] bArr2) {
Bundle bundle;
bundle = new Bundle();
bundle.putByteArray(AFConstants.EXTRA_CONNECT_PARAM_DEVICE_ID, bArr);
bundle.putByteArray(AFConstants.EXTRA_CONNECT_PARAM_KSC_ALIAS, bArr2);
try {
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: " + e.getMessage());
return -1;
}
return sendCommand(this.mProxy, this.mClientId, 21, bundle).getInt("statusCode");
}
public synchronized int setAccessoryDormant(boolean z) {
Bundle bundle;
bundle = new Bundle();
bundle.putBoolean(AFConstants.EXTRA_DORMANT_STATE, z);
try {
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: connect " + e.getMessage());
e.printStackTrace();
return -1;
}
return sendCommand(this.mProxy, this.mClientId, 11, bundle).getInt("statusCode");
}
public synchronized int setFlowControlConfig(FlowControlConfig flowControlConfig) {
Bundle bundle;
bundle = flowControlConfig.getBundle();
SdkLog.i(TAG + "[TCTrack]", " setFlowControlConfig(new) = " + flowControlConfig);
try {
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: " + e.getMessage());
return -1;
}
return sendCommand(this.mProxy, this.mClientId, 30, bundle).getInt("statusCode");
}
public synchronized int setKsc(byte[] bArr, byte[] bArr2, byte[] bArr3) {
Bundle bundle;
bundle = new Bundle();
bundle.putByteArray(AFConstants.EXTRA_CONNECT_PARAM_DEVICE_ID, bArr);
bundle.putByteArray(AFConstants.EXTRA_CONNECT_PARAM_KSC_ALIAS, bArr2);
bundle.putByteArray(AFConstants.EXTRA_CONNECT_PARAM_KSC, bArr3);
SdkLog.d(TAG, "adapter setKsc, deviceId:" + HexUtils.hide(bArr) + ", alias:" + HexUtils.hide(bArr2));
try {
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: " + e.getMessage());
return -1;
}
return sendCommand(this.mProxy, this.mClientId, 9, bundle).getInt("statusCode");
}
@Deprecated
public synchronized int setTrafficControlConfig(TrafficControlConfig trafficControlConfig) {
Bundle bundle;
bundle = trafficControlConfig.getBundle();
SdkLog.i(TAG + "[TCTrack]", "setTrafficControlConfig(old) = " + trafficControlConfig);
try {
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: " + e.getMessage());
return -1;
}
return sendCommand(this.mProxy, this.mClientId, 30, bundle).getInt("statusCode");
}
public synchronized int disconnect(String str, int i, int i2) {
int i3;
i3 = -1;
Bundle bundle = new Bundle();
bundle.putString("address", str);
bundle.putInt("transportType", i);
bundle.putInt(AFConstants.EXTRA_UUID, i2);
if (i == 1) {
bundle.putBinder("p2p_connect_token", this.mToken);
}
try {
i3 = sendCommand(this.mProxy, this.mClientId, 3, bundle).getInt("statusCode");
} catch (RemoteException e) {
SdkLog.e(TAG, "exception: disconnect " + e.getMessage());
e.printStackTrace();
}
return i3;
}
}