正在查看: Cantique de Louanges v12 应用的 StickerContentProvider.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Cantique de Louanges v12 应用的 StickerContentProvider.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.eugene.hymnesetlouanges;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.UriMatcher;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class StickerContentProvider extends ContentProvider {
public static final Uri b = new Uri.Builder().scheme("content").authority("com.eugene.hymnesetlouanges.stickercontentprovider").appendPath("metadata").build();
private static final UriMatcher c = new UriMatcher(-1);
private List a;
private AssetFileDescriptor a(Uri uri, AssetManager assetManager, String str, String str2) {
if (str.endsWith("_ico.png")) {
str = str.replace("_ico.png", "_ico");
}
File file = new File(getContext().getFilesDir(), str);
if (!file.exists()) {
return null;
}
try {
return new AssetFileDescriptor(ParcelFileDescriptor.open(file, 268435456), 0L, -1L);
} catch (FileNotFoundException unused) {
return null;
}
}
private Cursor b(Uri uri) {
List<StickerPack> f = f();
if (f != null) {
String lastPathSegment = uri.getLastPathSegment();
for (StickerPack stickerPack : f) {
if (lastPathSegment.equals(stickerPack.a)) {
return e(uri, Collections.singletonList(stickerPack));
}
}
}
return e(uri, new ArrayList());
}
private AssetFileDescriptor c(Uri uri) {
AssetManager assets = getContext().getAssets();
List<String> pathSegments = uri.getPathSegments();
if (pathSegments.size() != 3) {
throw new IllegalArgumentException("path segments should be 3, uri is: " + uri);
}
String str = pathSegments.get(pathSegments.size() - 1);
String str2 = pathSegments.get(pathSegments.size() - 2);
if (TextUtils.isEmpty(str2)) {
throw new IllegalArgumentException("identifier is empty, uri: " + uri);
}
if (TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("file name is empty, uri: " + uri);
}
List<StickerPack> f = f();
if (f == null) {
return null;
}
for (StickerPack stickerPack : f) {
if (str2.equals(stickerPack.a)) {
if (str.equals(stickerPack.d)) {
return a(uri, assets, str, str2);
}
Iterator it = stickerPack.q().iterator();
while (it.hasNext()) {
if (str.equals(((Sticker) it.next()).a)) {
return a(uri, assets, str, str2);
}
}
}
}
return null;
}
private Cursor d(Uri uri) {
return e(uri, f());
}
private Cursor e(Uri uri, List list) {
MatrixCursor matrixCursor = new MatrixCursor(new String[]{"sticker_pack_identifier", "sticker_pack_name", "sticker_pack_publisher", "sticker_pack_icon", "android_play_store_link", "ios_app_download_link", "sticker_pack_publisher_email", "sticker_pack_publisher_website", "sticker_pack_privacy_policy_website", "sticker_pack_license_agreement_website", "image_data_version", "animated_sticker_pack", "whatsapp_will_not_cache_stickers"});
Iterator it = list.iterator();
while (it.hasNext()) {
StickerPack stickerPack = (StickerPack) it.next();
MatrixCursor.RowBuilder newRow = matrixCursor.newRow();
newRow.add(stickerPack.a);
newRow.add(stickerPack.b);
newRow.add(stickerPack.c);
newRow.add(stickerPack.d);
newRow.add(stickerPack.o);
newRow.add(stickerPack.l);
newRow.add(stickerPack.e);
newRow.add(stickerPack.f);
newRow.add(stickerPack.g);
newRow.add(stickerPack.h);
newRow.add(stickerPack.i);
newRow.add(Integer.valueOf(stickerPack.j ? 1 : 0));
newRow.add(Integer.valueOf(stickerPack.k ? 1 : 0));
}
matrixCursor.setNotificationUri(getContext().getContentResolver(), uri);
return matrixCursor;
}
private List f() {
i(getContext());
return this.a;
}
private Cursor g(Uri uri) {
String lastPathSegment = uri.getLastPathSegment();
MatrixCursor matrixCursor = new MatrixCursor(new String[]{"sticker_file_name", "sticker_emoji"});
List<StickerPack> f = f();
if (f != null) {
for (StickerPack stickerPack : f) {
if (lastPathSegment.equals(stickerPack.a)) {
for (Sticker sticker : stickerPack.q()) {
matrixCursor.addRow(new Object[]{sticker.a, TextUtils.join(",", sticker.b)});
}
}
}
}
matrixCursor.setNotificationUri(getContext().getContentResolver(), uri);
return matrixCursor;
}
private void h() {
List<StickerPack> f = f();
if (f == null) {
return;
}
for (StickerPack stickerPack : f) {
c.addURI("com.eugene.hymnesetlouanges.stickercontentprovider", "stickers_asset/" + stickerPack.a + "/" + stickerPack.d, 5);
for (Sticker sticker : stickerPack.q()) {
c.addURI("com.eugene.hymnesetlouanges.stickercontentprovider", "stickers_asset/" + stickerPack.a + "/" + sticker.a, 4);
}
}
}
private synchronized void i(Context context) {
ApplicationInfo applicationInfo;
int i;
this.a = new ArrayList();
config configVar = (config) context.getApplicationContext();
if (configVar != null && configVar.Z1 != null) {
SharedPreferences sharedPreferences = context.getSharedPreferences("sh", 0);
PackageManager packageManager = context.getPackageManager();
try {
applicationInfo = packageManager.getApplicationInfo(context.getApplicationInfo().packageName, 0);
} catch (PackageManager.NameNotFoundException unused) {
applicationInfo = null;
}
String charSequence = applicationInfo != null ? packageManager.getApplicationLabel(applicationInfo).toString() : "";
if (!charSequence.equals("")) {
int i2 = 0;
while (true) {
m[] mVarArr = configVar.Z1;
if (i2 >= mVarArr.length) {
break;
}
m mVar = mVarArr[i2];
if (mVar.t == 13 && mVar.n1) {
if (new File(getContext().getFilesDir(), "img_s" + mVar.y + "_ico").exists()) {
i = i2;
StickerPack stickerPack = new StickerPack(mVar.y + "", mVar.a, charSequence, "img_s" + mVar.y + "_ico.png", null, null, null, null, mVar.p1 + "", mVar.o1, false);
ArrayList arrayList = new ArrayList();
for (String str : sharedPreferences.getString("gal_a_" + mVar.y, "").split("/")) {
if (!str.equals("")) {
String[] split = str.split("@");
if (split.length == 4 || split.length == 5 || split.length == 6) {
if (new File(getContext().getFilesDir(), "gal_" + split[0] + "_g.webp").exists()) {
arrayList.add(new Sticker("gal_" + split[0] + "_g.webp", new ArrayList()));
if (arrayList.size() > 29) {
break;
}
}
}
}
}
if (arrayList.size() > 2) {
stickerPack.r(arrayList);
this.a.add(stickerPack);
if (this.a.size() > 9) {
break;
}
} else {
continue;
}
i2 = i + 1;
}
}
i = i2;
i2 = i + 1;
}
}
}
}
@Override
public int delete(Uri uri, String str, String[] strArr) {
throw new UnsupportedOperationException("Not supported");
}
@Override
public String getType(Uri uri) {
h();
int match = c.match(uri);
if (match == 1) {
return "vnd.android.cursor.dir/vnd.com.eugene.hymnesetlouanges.stickercontentprovider.metadata";
}
if (match == 2) {
return "vnd.android.cursor.item/vnd.com.eugene.hymnesetlouanges.stickercontentprovider.metadata";
}
if (match == 3) {
return "vnd.android.cursor.dir/vnd.com.eugene.hymnesetlouanges.stickercontentprovider.stickers";
}
if (match == 4) {
return "image/webp";
}
if (match == 5) {
return "image/png";
}
throw new IllegalArgumentException("Unknown URI: " + uri);
}
@Override
public Uri insert(Uri uri, ContentValues contentValues) {
throw new UnsupportedOperationException("Not supported");
}
@Override
public boolean onCreate() {
if (!"com.eugene.hymnesetlouanges.stickercontentprovider".startsWith(getContext().getPackageName())) {
throw new IllegalStateException("your authority (com.eugene.hymnesetlouanges.stickercontentprovider) for the content provider should start with your package name: " + getContext().getPackageName());
}
UriMatcher uriMatcher = c;
uriMatcher.addURI("com.eugene.hymnesetlouanges.stickercontentprovider", "metadata", 1);
uriMatcher.addURI("com.eugene.hymnesetlouanges.stickercontentprovider", "metadata/*", 2);
uriMatcher.addURI("com.eugene.hymnesetlouanges.stickercontentprovider", "stickers/*", 3);
return true;
}
@Override
public AssetFileDescriptor openAssetFile(Uri uri, String str) {
h();
int match = c.match(uri);
if (match == 4 || match == 5) {
return c(uri);
}
return null;
}
@Override
public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
h();
int match = c.match(uri);
if (match == 1) {
return d(uri);
}
if (match == 2) {
return b(uri);
}
if (match == 3) {
return g(uri);
}
throw new IllegalArgumentException("Unknown URI: " + uri);
}
@Override
public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
throw new UnsupportedOperationException("Not supported");
}
}