正在查看: Pulsar v1.0.0 应用的 UBSDataContentProvider.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Pulsar v1.0.0 应用的 UBSDataContentProvider.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.xly.analytics.android.sdk.data;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;
import com.xly.analytics.android.sdk.UBSLog;
import com.xly.analytics.android.sdk.data.adapter.DbParams;
public class UBSDataContentProvider extends ContentProvider {
private static final UriMatcher uriMatcher = new UriMatcher(-1);
private UBSProviderHelper mProviderHelper;
@Override
public int bulkInsert(Uri uri, ContentValues[] contentValuesArr) {
try {
return this.mProviderHelper.bulkInsert(uri, contentValuesArr);
} catch (Exception e) {
UBSLog.printStackTrace(e);
return 0;
}
}
@Override
public int delete(Uri uri, String str, String[] strArr) {
try {
int match = uriMatcher.match(uri);
if (1 == match) {
return this.mProviderHelper.deleteEvents(str, strArr);
}
if (match == 15) {
return this.mProviderHelper.removeSP(uri.getQueryParameter(DbParams.REMOVE_SP_KEY));
}
return 0;
} catch (Exception e) {
UBSLog.printStackTrace(e);
return 0;
}
}
@Override
public String getType(Uri uri) {
return null;
}
@Override
public Uri insert(Uri uri, ContentValues contentValues) {
if (contentValues != null && contentValues.size() != 0) {
try {
int match = uriMatcher.match(uri);
if (match == 1) {
return this.mProviderHelper.insertEvent(uri, contentValues);
}
if (match == 8) {
return this.mProviderHelper.insertChannelPersistent(uri, contentValues);
}
this.mProviderHelper.insertPersistent(match, uri, contentValues);
return uri;
} catch (Exception e) {
UBSLog.printStackTrace(e);
}
}
return uri;
}
@Override
public boolean onCreate() {
String str;
try {
Context context = getContext();
if (context == null) {
return true;
}
try {
str = context.getApplicationContext().getPackageName();
} catch (UnsupportedOperationException unused) {
str = "com.xly.analytics.android.sdk.test";
}
UBSProviderHelper uBSProviderHelper = UBSProviderHelper.getInstance(context);
this.mProviderHelper = uBSProviderHelper;
uBSProviderHelper.appendUri(uriMatcher, str + ".UBSDataContentProvider");
return true;
} catch (Exception e) {
UBSLog.printStackTrace(e);
return true;
}
}
@Override
public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
try {
int match = uriMatcher.match(uri);
return match == 1 ? this.mProviderHelper.queryByTable(DbParams.TABLE_EVENTS, strArr, str, strArr2, str2) : match == 8 ? this.mProviderHelper.queryByTable(DbParams.TABLE_CHANNEL_PERSISTENT, strArr, str, strArr2, str2) : this.mProviderHelper.queryPersistent(match, uri);
} catch (Exception e) {
UBSLog.printStackTrace(e);
return null;
}
}
@Override
public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
return 0;
}
}