正在查看: Aptoide v9.22.5.3 应用的 ToolboxContentProvider.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Aptoide v9.22.5.3 应用的 ToolboxContentProvider.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package cm.aptoide.pt.toolbox;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.SharedPreferences;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.os.Binder;
import cm.aptoide.accountmanager.Account;
import cm.aptoide.accountmanager.AptoideAccountManager;
import cm.aptoide.pt.AptoideApplication;
import cm.aptoide.pt.BuildConfig;
import cm.aptoide.pt.account.AndroidAccountManagerPersistence;
import cm.aptoide.pt.account.FacebookSignUpAdapter;
import cm.aptoide.pt.account.GoogleSignUpAdapter;
import cm.aptoide.pt.networking.Authentication;
import cm.aptoide.pt.networking.AuthenticationPersistence;
import cm.aptoide.pt.utils.AptoideUtils;
import java.util.Locale;
import javax.inject.Inject;
import javax.inject.Named;
public class ToolboxContentProvider extends ContentProvider {
private static final String BACKUP_PACKAGE = "pt.aptoide.backupapps";
private static final int CHANGE_PREFERENCE = 6;
private static final int LOGIN_AVATAR = 9;
private static final int LOGIN_NAME = 5;
private static final int LOGIN_NICKNAME = 8;
private static final int LOGIN_TYPE = 4;
private static final int PASSHASH = 3;
private static final int REFRESH_TOKEN = 7;
private static final int REPO = 2;
private static final int TOKEN = 1;
private static final String UPLOADER_PACKAGE = "pt.caixamagica.aptoide.uploader";
@Inject
AptoideAccountManager accountManager;
@Inject
AuthenticationPersistence authenticationPersistence;
private ToolboxSecurityManager securityManager;
@Inject
@Named
SharedPreferences sharedPreferences;
private UriMatcher uriMatcher;
private MatrixCursor create(String str, String str2) {
MatrixCursor matrixCursor = new MatrixCursor(new String[]{str}, 1);
matrixCursor.addRow(new String[]{str2});
return matrixCursor;
}
@Override
public int delete(Uri uri, String str, String[] strArr) {
return 0;
}
@Override
public String getType(Uri uri) {
return null;
}
@Override
public Uri insert(Uri uri, ContentValues contentValues) {
return null;
}
@Override
public boolean onCreate() {
this.securityManager = new ToolboxSecurityManager(getContext().getPackageManager());
UriMatcher uriMatcher = new UriMatcher(-1);
this.uriMatcher = uriMatcher;
uriMatcher.addURI(BuildConfig.CONTENT_AUTHORITY, "token", 1);
this.uriMatcher.addURI(BuildConfig.CONTENT_AUTHORITY, "refreshToken", 7);
this.uriMatcher.addURI(BuildConfig.CONTENT_AUTHORITY, "repo", 2);
this.uriMatcher.addURI(BuildConfig.CONTENT_AUTHORITY, "loginType", 4);
this.uriMatcher.addURI(BuildConfig.CONTENT_AUTHORITY, "passHash", 3);
this.uriMatcher.addURI(BuildConfig.CONTENT_AUTHORITY, "loginName", 5);
this.uriMatcher.addURI(BuildConfig.CONTENT_AUTHORITY, "changePreference", 6);
this.uriMatcher.addURI(BuildConfig.CONTENT_AUTHORITY, "loginNickname", 8);
this.uriMatcher.addURI(BuildConfig.CONTENT_AUTHORITY, "loginAvatar", 9);
((AptoideApplication) getContext().getApplicationContext()).getApplicationComponent().inject(this);
return true;
}
@Override
public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
if (!this.securityManager.checkSignature(Binder.getCallingUid(), BuildConfig.SIGNATURE_BACKUP, BACKUP_PACKAGE) && !this.securityManager.checkSignature(Binder.getCallingUid(), BuildConfig.SIGNATURE_UPLOADER, UPLOADER_PACKAGE)) {
throw new SecurityException("Package not authorized to access provider.");
}
Authentication authentication = (Authentication) this.authenticationPersistence.getAuthentication().r(null).y().b();
Account account = (Account) this.accountManager.accountStatus().W0().b();
if (authentication == null || account == null) {
throw new IllegalStateException("User not logged in.");
}
switch (this.uriMatcher.match(uri)) {
case 1:
return create("userToken", authentication.getAccessToken());
case 2:
return create(AndroidAccountManagerPersistence.ACCOUNT_STORE_NAME, account.getStore().getName());
case 3:
if (AptoideAccountManager.APTOIDE_SIGN_UP_TYPE.equals(authentication.getType())) {
return create("userPass", AptoideUtils.AlgorithmU.computeSha1(authentication.getPassword()));
}
if (FacebookSignUpAdapter.TYPE.equals(authentication.getType()) || GoogleSignUpAdapter.TYPE.equals(authentication.getType())) {
return create("userPass", authentication.getPassword());
}
break;
case 4:
break;
case 5:
return create("loginName", authentication.getEmail());
case 6:
default:
throw new IllegalArgumentException("Only /token, /refreshToken, /repo, /passHash, /loginType, /loginName, loginNickname and loginAvatar supported.");
case 7:
return create("userRefreshToken", authentication.getRefreshToken());
case 8:
return create("loginNickname", account.getNickname());
case 9:
return create("loginAvatar", account.getAvatar());
}
return create("loginType", authentication.getType().toLowerCase(Locale.US));
}
@Override
public int update(android.net.Uri r5, android.content.ContentValues r6, java.lang.String r7, java.lang.String[] r8) {
throw new UnsupportedOperationException("Method not decompiled: cm.aptoide.pt.toolbox.ToolboxContentProvider.update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]):int");
}
}