导航菜单

页面标题

页面副标题

Petal Maps v4.7.0.310001 - HicloudContentProvider.java 源代码

正在查看: Petal Maps v4.7.0.310001 应用的 HicloudContentProvider.java JAVA 源代码文件

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


package com.huawei.maps.businessbase.cloudspace.hwcloud;

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 android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.huawei.maps.businessbase.cloudspace.util.CloudSpaceDataType;
import com.huawei.maps.businessbase.model.hicloud.HiCloudContants;
import com.huawei.maps.businessbase.servicepermission.ServicePermission;
import com.huawei.maps.businessbase.utils.account.OnAccountSuccessListener;
import com.huawei.maps.businessbase.utils.account.bean.Account;
import com.huawei.secure.android.common.intent.SafeBundle;
import defpackage.as0;
import defpackage.e4;
import defpackage.en3;
import defpackage.rd;
import defpackage.ud;
import defpackage.us3;

public class HicloudContentProvider extends ContentProvider {
    public static final UriMatcher b;
    public Context a;

    public class a implements OnAccountSuccessListener {
        public final Bundle a;

        public a(Bundle bundle) {
            this.a = bundle;
        }

        @Override
        public void onSuccess(Account account) {
            hm4.p("HicloudContentProvider", "Login Success: ");
            HicloudContentProvider.this.e(this.a);
        }
    }

    static {
        UriMatcher uriMatcher = new UriMatcher(-1);
        b = uriMatcher;
        uriMatcher.addURI("com.huawei.maps.app.cloudSync", "delete_sync_data?sync_opt=1", 1);
        uriMatcher.addURI("com.huawei.maps.app.cloudSync", "delete_sync_data?sync_opt=2", 2);
        uriMatcher.addURI("com.huawei.maps.app.cloudSync", "delete_sync_data", 0);
        uriMatcher.addURI("com.huawei.maps.app.cloudSync", "query_local_data", 3);
    }

    public final void c(Uri uri) {
        if (b.match(uri) == 0) {
            if (!TextUtils.isEmpty(uri.getQuery()) && "sync_opt=1".equals(uri.getQuery())) {
                hm4.q("HicloudContentProvider", "[hicloud]delete ACTION_DELETE_ONE", false);
                en3.P().f();
            } else if (TextUtils.isEmpty(uri.getQuery()) || !"sync_opt=2".equals(uri.getQuery())) {
                hm4.q("HicloudContentProvider", "[hicloud]delete ACTION_DELETE_ONE others", false);
            } else {
                hm4.q("HicloudContentProvider", "[hicloud]delete ACTION_DELETE_TWO", false);
                en3.P().K0();
            }
        }
    }

    @Override
    @Nullable
    public Bundle call(@NonNull String str, @Nullable String str2, @Nullable Bundle bundle) {
        hm4.p("HicloudContentProvider", "[hicloud] call start: ");
        if (!f(str, bundle)) {
            hm4.q("HicloudContentProvider", "[hicloud] call do not have permission", false);
            return super.call(str, str2, bundle);
        }
        if (ServicePermission.isPrivacyReadFromSP()) {
            hm4.p("HicloudContentProvider", "call: isPrivacyRead");
            if (e4.a().hasLogin()) {
                e(bundle);
            } else {
                hm4.q("HicloudContentProvider", "[hicloud]has not Login, try login", false);
                e4.a().silentSignIn(new a(bundle));
            }
        }
        return super.call(str, str2, bundle);
    }

    public final Cursor d(Uri uri) {
        if (b.match(uri) != 3) {
            return null;
        }
        hm4.q("HicloudContentProvider", "[hicloud]query ACTION_QUERY", false);
        Cursor l0 = en3.P().l0();
        hm4.q("HicloudContentProvider", "[hicloud]query cursor count=" + l0.getCount(), false);
        l0.close();
        return l0;
    }

    @Override
    public int delete(Uri uri, String str, String[] strArr) {
        hm4.p("HicloudContentProvider", "[hicloud] delete request start ");
        if (!us3.f().d(getCallingPackage())) {
            hm4.q("HicloudContentProvider", "[hicloud] request do not have delete permission", false);
            return 0;
        }
        if (ServicePermission.isPrivacyReadFromSP()) {
            c(uri);
        }
        return 0;
    }

    public final void e(@Nullable Bundle bundle) {
        hm4.p("HicloudContentProvider", "dealSyncRequestFromHicloud start ");
        int i = bundle != null ? new SafeBundle(bundle).getInt("syncScene") : -1;
        i();
        hm4.q("HicloudContentProvider", "[hicloud]call syncScene=" + i, false);
        if (1 == i) {
            p79.g(HiCloudContants.SWITCH_STATE, true, o41.b());
            as0.f().startSyncData(CloudSpaceDataType.ALL);
        } else if (2 == i || 3 == i || 4 == i) {
            as0.f().startSyncData(CloudSpaceDataType.ALL);
        } else if (i == 0) {
            p79.g(HiCloudContants.SWITCH_STATE, false, this.a);
            p79.g(HiCloudContants.CURRENT_SYNC_STATE, false, this.a);
            h();
        } else {
            hm4.q("HicloudContentProvider", "[hicloud]call syncScene= other", false);
        }
        hm4.p("HicloudContentProvider", "dealSyncRequestFromHicloud end ");
    }

    public final boolean f(@NonNull String str, Bundle bundle) {
        if (bundle == null) {
            return false;
        }
        String string = new SafeBundle(bundle).getString("syncType");
        return !TextUtils.isEmpty(string) && "sync_scene_change".equals(str) && HiCloudContants.SYNC_TYPE.equals(string) && us3.f().d(getCallingPackage());
    }

    @Override
    public String getType(Uri uri) {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public final void h() {
        ud.f(System.currentTimeMillis());
        rd.b().i(false);
    }

    public final void i() {
        as0 f = as0.f();
        if ("4".equals(f.getHiCloudType())) {
            return;
        }
        f.setHiCloudType("1");
    }

    @Override
    public Uri insert(Uri uri, ContentValues contentValues) {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    @Override
    public boolean onCreate() {
        this.a = getContext();
        return false;
    }

    @Override
    public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
        hm4.p("HicloudContentProvider", "content provider query start");
        if (!us3.f().d(getCallingPackage())) {
            hm4.q("HicloudContentProvider", "request do not have query permission, not from [hicloud]", false);
            return null;
        }
        if (!ServicePermission.isPrivacyReadFromSP()) {
            return null;
        }
        hm4.p("HicloudContentProvider", "query, isPrivacyRead");
        if (!e4.a().hasLogin()) {
            hm4.q("HicloudContentProvider", "[hicloud]has not Login, try login", false);
            while (!e4.a().hasLogin()) {
                try {
                    Thread.sleep(100L);
                } catch (InterruptedException unused) {
                    hm4.h("HicloudContentProvider", "Account login wait error");
                }
                e4.a().silentSignIn(new OnAccountSuccessListener() {
                    @Override
                    public final void onSuccess(Account account) {
                        hm4.p("HicloudContentProvider", "Login Success: ");
                    }
                });
            }
        }
        return d(uri);
    }

    @Override
    public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
        throw new UnsupportedOperationException("Not yet implemented");
    }
}