Exploit database

GH-14fb583d3d1bd2da10251bb1a37b93d6

gitchw/ghostlock-cve-2026-43499

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

166 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files19

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

workspace/decomp/HeyOTA/sources/com/heytap/accessory/discovery/BaseManager.java

Java · 8,764 bytes
package com.heytap.accessory.discovery;

import android.content.ComponentName;
import android.content.Context;
import android.content.ServiceConnection;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Process;
import com.heytap.accessory.Config;
import com.heytap.accessory.Initializer;
import com.heytap.accessory.api.IDeathCallback;
import com.heytap.accessory.api.IDiscoveryNativeService;
import com.heytap.accessory.api.IServiceConnectionIndicationCallback;
import com.heytap.accessory.api.ManagerConfig;
import com.heytap.accessory.bean.SdkUnsupportedException;
import com.heytap.accessory.constant.DiscoveryServiceConstants;
import com.heytap.accessory.logging.SdkLog;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public abstract class BaseManager implements ServiceConnection {
    private static final String BACKGROUND_THREAD_NAME = "BGT";
    public static final int FASTPAIR_CORE_VERSION_10200 = 10200;
    private static final String TAG = "BaseManager";
    private Executor mBgThreadPool = Executors.newSingleThreadExecutor(new ThreadFactory() { // from class: com.heytap.accessory.discovery.-$$Lambda$BaseManager$mtAnJL-OPBYyym19bDdpGvU4YyE
        @Override // java.util.concurrent.ThreadFactory
        public final Thread newThread(Runnable runnable) {
            Thread a2;
            a2 = BaseManager.a(runnable);
            return a2;
        }
    });
    private long mClientId;
    private IDeathCallback mDeathCallback;
    private int mFpCoreVersion;
    private ServiceConnectionIndicationCallback mScIndicationCallback;
    private int mServiceVersion;

    /* loaded from: classes.dex */
    private static final class DeathCallbackStub extends IDeathCallback.Stub {

        /* renamed from: a, reason: collision with root package name */
        private String f46a;

        public DeathCallbackStub(String str) {
            if (str != null) {
                this.f46a = str;
                return;
            }
            throw new IllegalArgumentException("Invalid packageName:null");
        }

        @Override // com.heytap.accessory.api.IDeathCallback
        public String getAppName() {
            return this.f46a;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes.dex */
    public final class ServiceConnectionIndicationCallback extends IServiceConnectionIndicationCallback.Stub {
        @Override // com.heytap.accessory.api.IServiceConnectionIndicationCallback
        public void onServiceConnectionRequested(Bundle bundle) {
            SdkLog.i(BaseManager.TAG, "onServiceConnectionRequested: " + bundle);
        }

        private ServiceConnectionIndicationCallback(BaseManager baseManager) {
            SdkLog.i(BaseManager.TAG, "ServiceConnectionIndicationCallback");
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static class b {

        /* renamed from: a, reason: collision with root package name */
        boolean f47a;

        /* renamed from: b, reason: collision with root package name */
        IManagerCallback f48b;

        /* JADX INFO: Access modifiers changed from: package-private */
        public b(boolean z, IManagerCallback iManagerCallback) {
            this.f47a = z;
            this.f48b = iManagerCallback;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static /* synthetic */ Thread a(Runnable runnable) {
        return new Thread(runnable, BACKGROUND_THREAD_NAME);
    }

    public static void initAFMAccessory(Context context) throws SdkUnsupportedException {
        if (context != null) {
            try {
                PackageInfo packageInfo = context.getPackageManager().getPackageInfo(ManagerConfig.ACCESSORY_FRAMEWORK_PACKAGE, 0);
                int i = packageInfo == null ? -1 : packageInfo.versionCode;
                Initializer.initContext(context);
                Initializer.setOAFSdkVersion(i);
                SdkLog.i(TAG, "AF version: " + i);
                return;
            } catch (PackageManager.NameNotFoundException unused) {
                SdkLog.e(TAG, "AF not installed");
                throw new SdkUnsupportedException("AF not installed", 2);
            }
        }
        throw new IllegalArgumentException("Illegal argument: context");
    }

    public int getFpCoreVersion() {
        return this.mFpCoreVersion;
    }

    protected abstract String getPackageName();

    public int getServiceVersion() {
        return this.mServiceVersion;
    }

    @Override // android.content.ServiceConnection
    public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
        String str = TAG;
        SdkLog.i(str, "trace-onServiceConnected, ComponentName: " + componentName + ", service: " + iBinder);
        IDiscoveryNativeService asInterface = IDiscoveryNativeService.Stub.asInterface(iBinder);
        if (asInterface == null) {
            SdkLog.e(str, "onServiceConnected failed, service is null");
            return;
        }
        this.mDeathCallback = new DeathCallbackStub(getPackageName());
        this.mScIndicationCallback = new ServiceConnectionIndicationCallback();
        a(asInterface);
        onSubServiceConnected(asInterface);
    }

    @Override // android.content.ServiceConnection
    public void onServiceDisconnected(ComponentName componentName) {
        SdkLog.i(TAG, "trace-onServiceDisconnected, ComponentName: " + componentName);
        onSubServiceDisconnected();
    }

    protected abstract void onSubBindService(Context context);

    protected abstract void onSubServiceConnected(IDiscoveryNativeService iDiscoveryNativeService);

    protected abstract void onSubServiceDisconnected();

    /* JADX INFO: Access modifiers changed from: protected */
    public void runOnBackGround(final Context context, final com.heytap.accessory.discovery.a aVar) {
        SdkLog.i(TAG, "runOnBackGround");
        this.mBgThreadPool.execute(new Runnable() { // from class: com.heytap.accessory.discovery.-$$Lambda$BaseManager$HjwPhgk9Pj1lEQQ8fuzVT9wQf0M
            @Override // java.lang.Runnable
            public final void run() {
                BaseManager.this.a(context);
            }
        });
        this.mBgThreadPool.execute(new Runnable() { // from class: com.heytap.accessory.discovery.-$$Lambda$BaseManager$SgWdAp2UGksSDE3Z-nAyFw_QirI
            @Override // java.lang.Runnable
            public final void run() {
                BaseManager.a(a.this);
            }
        });
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ void a(Context context) {
        SdkLog.i(TAG, "runOnBackGround MSG_BIND_SERVICE andSdk(" + Build.VERSION.SDK_INT + ")");
        onSubBindService(context);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static /* synthetic */ void a(com.heytap.accessory.discovery.a aVar) {
        SdkLog.i(TAG, "runOnBackGround MSG_RUN_RUNNABLE andSdk(" + Build.VERSION.SDK_INT + ")");
        if (aVar != null) {
            aVar.run();
        }
    }

    private void a(IDiscoveryNativeService iDiscoveryNativeService) {
        try {
            Bundle makeDiscoveryConnection = iDiscoveryNativeService.makeDiscoveryConnection(Process.myPid(), getPackageName(), this.mDeathCallback, Config.getSdkVersionCode(), this.mScIndicationCallback);
            if (makeDiscoveryConnection == null) {
                SdkLog.e(TAG, "onServiceConnected failed,AUTHCODE_EXPECTED invalid response");
                return;
            }
            long j = makeDiscoveryConnection.getLong(DiscoveryServiceConstants.EXTRA_CLIENT_ID, -1L);
            this.mClientId = j;
            if (j == -1) {
                SdkLog.e(TAG, "onServiceConnected failed, invalid clientId, error: " + makeDiscoveryConnection.getInt(DiscoveryServiceConstants.EXTRA_ERROR_CODE, 0));
                return;
            }
            this.mServiceVersion = makeDiscoveryConnection.getInt(DiscoveryServiceConstants.EXTRA_SERVICE_VERSION, 1);
            this.mFpCoreVersion = makeDiscoveryConnection.getInt(DiscoveryServiceConstants.EXTRA_FP_CORE_VERSION, 1);
            SdkLog.i(TAG, "Received clientId: " + this.mClientId + ", serviceVersion: " + this.mServiceVersion + ", fpcoreVersion: " + this.mFpCoreVersion);
        } catch (Exception e) {
            SdkLog.e(TAG, e);
        }
    }
}