导航菜单

页面标题

页面副标题

OLX India v19.42.007 - SdkProvider.java 源代码

正在查看: OLX India v19.42.007 应用的 SdkProvider.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.adtmonetize.sdk.common.provider;

import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.Keep;
import com.adtmonetize.sdk.common.BaseConstants;
import com.adtmonetize.sdk.common.DeviceIdsManager;
import com.adtmonetize.sdk.common.LifeCycleManager;
import com.adtmonetize.sdk.common.util.ContextUtils;
import com.adtmonetize.sdk.common.util.ExecutorManager;
import com.adtmonetize.sdk.common.util.ReferrerManager;
import com.adtmonetize.sdk.common.util.SQLUtils;
import com.adtmonetize.sdk.common.util.log.DevLog;
import org.json.JSONArray;

@Keep
public class SdkProvider extends ContentProvider {
    public static final String TAG = "SdkProvider";
    private final UriMatcher mRriMatcher = new UriMatcher(-1);

    public static class C0411 extends SQLiteOpenHelper {

        public static C0411 f156;

        public C0411(Context context) {
            super(context, BaseConstants.DB_NAME, (SQLiteDatabase.CursorFactory) null, 1);
            setWriteAheadLoggingEnabled(true);
        }

        public static synchronized C0411 m313(Context context) {
            synchronized (C0411.class) {
                synchronized (C0411.class) {
                    try {
                        if (f156 == null) {
                            f156 = new C0411(context);
                        }
                    } catch (Throwable th) {
                        throw th;
                    }
                }
                return f156;
            }
            return f156;
        }

        @Override
        public void onCreate(SQLiteDatabase sQLiteDatabase) {
        }

        @Override
        public void onDowngrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
        }

        @Override
        public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
        }
    }

    private Bundle execSQL(SQLiteDatabase sQLiteDatabase, String str, Bundle bundle) {
        sQLiteDatabase.execSQL(str);
        Bundle bundle2 = new Bundle(1);
        bundle2.putInt("code", 0);
        return bundle2;
    }

    private Bundle execSQLS(SQLiteDatabase sQLiteDatabase, String str, Bundle bundle) {
        try {
            JSONArray jSONArray = new JSONArray(str);
            int length = jSONArray.length();
            for (int i = 0; i < length; i++) {
                sQLiteDatabase.execSQL(jSONArray.optString(i));
            }
            Bundle bundle2 = new Bundle(1);
            bundle2.putInt("code", 0);
            return bundle2;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static Uri getUri(Context context, String str) {
        return Uri.parse("content://" + context.getPackageName() + BaseConstants.URI_AUTHORITY).buildUpon().appendPath(str).build();
    }

    private Bundle insertOrUpdate(SQLiteDatabase sQLiteDatabase, String str, Bundle bundle) {
        long j;
        String str2;
        int i = 0;
        if (bundle != null) {
            if (bundle.containsKey(BaseConstants.SQL_CONDITION)) {
                str2 = bundle.getString(BaseConstants.SQL_CONDITION);
                bundle.remove(BaseConstants.SQL_CONDITION);
            } else {
                str2 = null;
            }
            ContentValues contentValues = SQLUtils.getContentValues(bundle);
            j = sQLiteDatabase.insertWithOnConflict(str, null, contentValues, 4);
            if (j == -1) {
                i = sQLiteDatabase.update(str, contentValues, str2, null);
            }
        } else {
            j = 0;
        }
        Bundle bundle2 = new Bundle(2);
        bundle2.putLong("id", j);
        bundle2.putInt("affected", i);
        return bundle2;
    }

    private Bundle insertOrUpdateMultiple(SQLiteDatabase sQLiteDatabase, String str, Bundle bundle) {
        String str2;
        try {
            sQLiteDatabase.beginTransaction();
            int size = bundle.size();
            for (int i = 0; i < size; i++) {
                Bundle bundle2 = bundle.getBundle(String.valueOf(i));
                if (bundle2 != null) {
                    if (bundle2.containsKey(BaseConstants.SQL_CONDITION)) {
                        str2 = bundle2.getString(BaseConstants.SQL_CONDITION);
                        bundle2.remove(BaseConstants.SQL_CONDITION);
                    } else {
                        str2 = null;
                    }
                    ContentValues contentValues = SQLUtils.getContentValues(bundle2);
                    if (sQLiteDatabase.insertWithOnConflict(str, null, contentValues, 4) == -1) {
                        sQLiteDatabase.update(str, contentValues, str2, null);
                    }
                }
            }
            sQLiteDatabase.setTransactionSuccessful();
            Bundle bundle3 = new Bundle(1);
            bundle3.putInt("code", 0);
            try {
                sQLiteDatabase.endTransaction();
            } catch (Exception unused) {
            }
            return bundle3;
        } catch (Throwable th) {
            try {
                sQLiteDatabase.endTransaction();
            } catch (Exception unused2) {
            }
            throw th;
        }
    }

    public static void lambda$onCreate$0(Context context) {
        try {
            LifeCycleManager.getInstance().registerLifecycleCallback(ContextUtils.getApplication());
        } catch (Throwable th) {
            DevLog.logE(TAG + " registerLifecycleCallback failed, " + th.getMessage());
        }
        try {
            DeviceIdsManager.getInstance().prepareIds(context);
        } catch (Throwable th2) {
            DevLog.logE(TAG + " DeviceIdsManager prepareIds failed, " + th2.getMessage());
        }
        try {
            ReferrerManager.getInstance().getReferrer(context);
        } catch (Throwable th3) {
            DevLog.logE(TAG + " ModuleManager install failed, " + th3.getMessage());
        }
    }

    @Override
    public synchronized android.os.Bundle call(java.lang.String r8, java.lang.String r9, android.os.Bundle r10) {
        throw new UnsupportedOperationException("Method not decompiled: com.adtmonetize.sdk.common.provider.SdkProvider.call(java.lang.String, java.lang.String, android.os.Bundle):android.os.Bundle");
    }

    @Override
    public synchronized int delete(Uri uri, String str, String[] strArr) {
        String str2;
        try {
            Context context = getContext();
            if (context == null) {
                return -1;
            }
            try {
                if (this.mRriMatcher.match(uri) == 1050001 && (str2 = uri.getPathSegments().get(0)) != null) {
                    if (str == null) {
                        str = "1";
                    }
                    SQLiteDatabase writableDatabase = C0411.m313(context).getWritableDatabase();
                    writableDatabase.beginTransaction();
                    int delete = writableDatabase.delete(str2, str, strArr);
                    DevLog.logI(TAG + ", Deleted " + delete + " records from " + str2);
                    writableDatabase.setTransactionSuccessful();
                    writableDatabase.endTransaction();
                    return delete;
                }
            } catch (Exception e) {
                DevLog.logW(TAG + ", delete error: " + e.getMessage());
            }
            return -1;
        } catch (Throwable th) {
            throw th;
        }
    }

    @Override
    public String getType(Uri uri) {
        try {
            Context context = getContext();
            if (context == null) {
                return null;
            }
            StringBuilder sb = new StringBuilder();
            sb.append("vnd.android.cursor.item/vnd.");
            sb.append(context.getPackageName() + BaseConstants.URI_AUTHORITY);
            sb.append(".item");
            return sb.toString();
        } catch (Exception e) {
            DevLog.logW(TAG + ", getType error: " + e.getMessage());
            return null;
        }
    }

    @Override
    public synchronized Uri insert(Uri uri, ContentValues contentValues) {
        String str;
        StringBuilder sb = new StringBuilder();
        String str2 = TAG;
        sb.append(str2);
        sb.append(", Method DatabaseContentProvider.insert is called");
        DevLog.logD(sb.toString());
        Context context = getContext();
        if (context == null) {
            return null;
        }
        try {
            if (this.mRriMatcher.match(uri) == 1050001 && (str = uri.getPathSegments().get(0)) != null) {
                long insert = C0411.m313(context).getWritableDatabase().insert(str, null, contentValues);
                DevLog.logI(str2 + ", insert table to " + str + ", " + contentValues);
                if (insert <= 0) {
                    return null;
                }
                Uri withAppendedId = ContentUris.withAppendedId(uri, insert);
                getContext().getContentResolver().notifyChange(withAppendedId, null);
                return withAppendedId;
            }
        } catch (Exception e) {
            DevLog.logW(TAG + ", insert error: " + e.getMessage());
        }
        return null;
    }

    @Override
    public boolean onCreate() {
        final Context context = getContext();
        if (context == null) {
            DevLog.logE(TAG + ", Could not add uri match because context is null");
            return false;
        }
        ExecutorManager.getInstance().execute(new Runnable() {
            @Override
            public final void run() {
                SdkProvider.lambda$onCreate$0(context);
            }
        });
        this.mRriMatcher.addURI(context.getPackageName() + BaseConstants.URI_AUTHORITY, "*", BaseConstants.MATCHER_CODE);
        return true;
    }

    @Override
    public synchronized Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
        String str3;
        try {
            Context context = getContext();
            if (context != null && this.mRriMatcher.match(uri) == 1050001 && (str3 = uri.getPathSegments().get(0)) != null) {
                return C0411.m313(context).getReadableDatabase().query(str3, strArr, str, strArr2, null, null, str2);
            }
        } catch (Exception e) {
            DevLog.logW(TAG + ", query error: " + e.getMessage());
        }
        return null;
    }

    @Override
    public synchronized int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
        String str2;
        Context context = getContext();
        if (context == null) {
            return -1;
        }
        try {
            if (this.mRriMatcher.match(uri) == 1050001 && (str2 = uri.getPathSegments().get(0)) != null) {
                SQLiteDatabase writableDatabase = C0411.m313(context).getWritableDatabase();
                writableDatabase.beginTransaction();
                int update = writableDatabase.update(str2, contentValues, str, strArr);
                writableDatabase.setTransactionSuccessful();
                writableDatabase.endTransaction();
                return update;
            }
        } catch (Exception e) {
            DevLog.logW(TAG + ", update error: " + e.getMessage());
        }
        return -1;
    }
}