Exploit databaseDownload repository ZIP
GH-14fb583d3d1bd2da10251bb1a37b93d6
gitchw/ghostlock-cve-2026-43499
Sources for CVE-2026-43499
166 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
gitchw/ghostlock-cve-2026-43499Revision 96acd93156f6
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
workspace/decomp/HeyOTA/sources/com/heytap/wearable/ota/db/DbHelper.java
Java · 9,177 bytespackage com.heytap.wearable.ota.db;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import com.heytap.wearable.ota.OTAApplication;
import com.heytap.wearable.ota.activity.OtaUpdateInfo;
import com.heytap.wearable.ota.download.DownloadInfo;
import com.heytap.wearable.ota.install.PackageInstallInfo;
import com.heytap.wearable.ota.util.OppoLog;
/* loaded from: classes.dex */
public class DbHelper {
private static final String[] OTA_INFO_PROJECTION;
private static OtaUpdateInfo sInfo;
private static boolean sInit;
private static ContentObserver sObserver;
static {
Uri.parse("content://com.heytap.wearable.ota/raw_sql");
OTA_INFO_PROJECTION = new String[]{"_id", "name", "type", "old_version", "new_version", "size", "md5", "url", "active_url", "recommend", "description", "share", "latestNews", "rom_version", "silence_update", "notice_type", "downloaded_size", "download_reason", "install_pkg_path", "ota_status"};
sObserver = new ContentObserver(new Handler(Looper.getMainLooper())) { // from class: com.heytap.wearable.ota.db.DbHelper.1
@Override // android.database.ContentObserver
public void onChange(boolean z) {
super.onChange(z);
synchronized (DbHelper.class) {
OtaUpdateInfo unused = DbHelper.sInfo = null;
DbHelper.getOTAUpdateInfo(OTAApplication.getContext());
}
}
};
}
private static void init(Context context) {
if (sInit) {
return;
}
sInit = true;
context.getContentResolver().registerContentObserver(OTADb$PatchColumns.CONTENT_URI, true, sObserver);
}
public static int getOTAUpdateStatus(Context context) {
if (context == null) {
OppoLog.d("DbHelper", "the context is null");
return 0;
}
return getOTAUpdateInfo(context).status;
}
public static void addOTAUpdateInfo(Context context, Uri uri, ContentValues contentValues) {
String str = (String) contentValues.get("name");
if (str == null || "".equals(str)) {
return;
}
context.getContentResolver().insert(uri, contentValues);
}
public static synchronized OtaUpdateInfo getOTAUpdateInfo(Context context) {
synchronized (DbHelper.class) {
if (sInfo != null) {
return new OtaUpdateInfo(sInfo);
}
init(context);
OtaUpdateInfo otaUpdateInfo = new OtaUpdateInfo();
Cursor query = context.getContentResolver().query(OTADb$PatchColumns.CONTENT_URI, OTA_INFO_PROJECTION, "type=0 or type=1", null, null);
if (query != null) {
while (query.moveToNext()) {
try {
otaUpdateInfo.name = query.getString(1);
otaUpdateInfo.type = query.getInt(2);
otaUpdateInfo.oldVersion = query.getString(3);
otaUpdateInfo.newVersion = query.getString(4);
otaUpdateInfo.size = query.getLong(5);
otaUpdateInfo.md5 = query.getString(6);
otaUpdateInfo.url = query.getString(7);
otaUpdateInfo.activeUrl = query.getString(8);
otaUpdateInfo.recommonad = query.getInt(9);
otaUpdateInfo.descripstion = query.getString(10);
otaUpdateInfo.share = query.getString(11);
otaUpdateInfo.news = query.getString(12);
otaUpdateInfo.romVersion = query.getString(13);
otaUpdateInfo.silenceUpdate = query.getInt(14);
otaUpdateInfo.noticeUpdate = query.getInt(15);
otaUpdateInfo.downloadedSize = query.getLong(16);
otaUpdateInfo.downloadReason = query.getInt(17);
otaUpdateInfo.installPath = query.getString(18);
otaUpdateInfo.status = query.getInt(19);
} finally {
if (query != null) {
query.close();
}
if (!TextUtils.isEmpty(otaUpdateInfo.name)) {
sInfo = new OtaUpdateInfo(otaUpdateInfo);
}
}
}
}
return otaUpdateInfo;
}
}
public static int getOTAUpdateType(Context context) {
if (context == null) {
OppoLog.d("DbHelper", "the context is null");
return -1;
}
return getOTAUpdateInfo(context).type;
}
public static void deleteOTAItem(Context context) {
OppoLog.w("DbHelper", "deleteOTAItem!");
Uri uri = OTADb$PatchColumns.CONTENT_URI;
ContentResolver contentResolver = context.getContentResolver();
sInfo = null;
contentResolver.delete(uri, "type=0 or type=1", null);
}
public static DownloadInfo getOTADownloadInfo(Context context) {
DownloadInfo downloadInfo = new DownloadInfo();
if (context == null) {
OppoLog.d("DbHelper", "the context is null");
return downloadInfo;
}
OtaUpdateInfo oTAUpdateInfo = getOTAUpdateInfo(context);
downloadInfo.url = oTAUpdateInfo.url;
downloadInfo.activeUrl = oTAUpdateInfo.activeUrl;
downloadInfo.name = oTAUpdateInfo.name;
downloadInfo.newVer = oTAUpdateInfo.newVersion;
downloadInfo.size = oTAUpdateInfo.size;
downloadInfo.downloadedSize = oTAUpdateInfo.downloadedSize;
downloadInfo.md5 = oTAUpdateInfo.md5;
downloadInfo.state = oTAUpdateInfo.status;
SharedPrefManager sharedPrefManager = new SharedPrefManager(context, 1);
boolean readBoolean = sharedPrefManager.readBoolean("ota_user_agree_download_in_watch_mobile_flag", false);
boolean readBoolean2 = sharedPrefManager.readBoolean("ota_user_agree_download_in_watch_phone_flag", false);
int i = (readBoolean ? 1 : 0) | downloadInfo.supportMobile;
downloadInfo.supportMobile = i;
downloadInfo.supportMobile = i | (readBoolean2 ? 2 : 0);
return downloadInfo;
}
public static void changeUpdateStatus(Context context, int i) {
OppoLog.d("DbHelper", "change db status to " + i);
ContentValues contentValues = new ContentValues();
contentValues.put("ota_status", Integer.valueOf(i));
context.getContentResolver().update(OTADb$PatchColumns.CONTENT_URI, contentValues, "type=0 or type=1", null);
}
public static void setDownloadProcess(Context context, String str, long j) {
ContentValues contentValues = new ContentValues();
contentValues.put("downloaded_size", Long.valueOf(j));
context.getContentResolver().update(OTADb$PatchColumns.CONTENT_URI, contentValues, "name='" + str + "'", null);
}
public static void setDownloadPauseReason(Context context, int i) {
ContentValues contentValues = new ContentValues();
contentValues.put("download_reason", Integer.valueOf(i));
context.getContentResolver().update(OTADb$PatchColumns.CONTENT_URI, contentValues, "type=0 or type=1", null);
}
public static void setInstallPath(Context context, String str, String str2) {
ContentValues contentValues = new ContentValues();
contentValues.put("install_pkg_path", str2);
context.getContentResolver().update(OTADb$PatchColumns.CONTENT_URI, contentValues, "name='" + str + "'", null);
}
public static PackageInstallInfo getPackageInstallInfo(Context context) {
PackageInstallInfo packageInstallInfo = new PackageInstallInfo();
if (context == null) {
OppoLog.d("DbHelper", "the context is null");
return packageInstallInfo;
}
OtaUpdateInfo oTAUpdateInfo = getOTAUpdateInfo(context);
packageInstallInfo.name = oTAUpdateInfo.name;
packageInstallInfo.type = oTAUpdateInfo.type;
packageInstallInfo.oldVersion = oTAUpdateInfo.oldVersion;
packageInstallInfo.newVersion = oTAUpdateInfo.newVersion;
packageInstallInfo.size = oTAUpdateInfo.size;
packageInstallInfo.md5 = oTAUpdateInfo.md5;
packageInstallInfo.path = oTAUpdateInfo.installPath;
packageInstallInfo.status = oTAUpdateInfo.status;
OppoLog.i("DbHelper", "getPackageInstallInfo " + oTAUpdateInfo);
return packageInstallInfo;
}
public static void setNews(Context context, String str, String str2) {
ContentValues contentValues = new ContentValues();
contentValues.put("latestNews", str2);
context.getContentResolver().update(OTADb$PatchColumns.CONTENT_URI, contentValues, "name='" + str + "'", null);
}
}