导航菜单

页面标题

页面副标题

管控平台 v5.2.3.0. - DeviceInfoProvider.java 源代码

正在查看: 管控平台 v5.2.3.0. 应用的 DeviceInfoProvider.java JAVA 源代码文件

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


package com.iflytek.mdmservice.provider;

import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.SpHelper;
import com.iflytek.mdmlibrary.MdmSdk;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.db.dao.DeviceInfoDao;
import com.iflytek.mdmservice.db.entity.DeviceInfo;
import com.iflytek.mdmservice.db.impl.DeviceInfoDaoImpl;
import com.iflytek.mdmservice.utils.DeviceHelper;
import com.iflytek.mdmservice.utils.i;

public class DeviceInfoProvider extends ContentProvider {

    public static final Uri f324b = Uri.parse("content://com.iflytek.mdmservice.provider.DeviceInfoProvider/device");

    private static final String f325c = DeviceInfoDao.Properties.Id.e;
    private static final UriMatcher d;

    private DeviceInfoDaoImpl f326a;

    static {
        UriMatcher uriMatcher = new UriMatcher(-1);
        d = uriMatcher;
        uriMatcher.addURI("com.iflytek.mdmservice.provider.DeviceInfoProvider", "device", 0);
        d.addURI("com.iflytek.mdmservice.provider.DeviceInfoProvider", "device/#", 1);
    }

    private void a() {
        DeviceInfo deviceInfo;
        String wifiMac = DeviceHelper.getWifiMac();
        if (TextUtils.isEmpty(wifiMac) || "02:00:00:00:00:00".equals(wifiMac)) {
            deviceInfo = null;
        } else {
            deviceInfo = new DeviceInfo();
            deviceInfo.setKey(DeviceInfo.MAC);
            deviceInfo.setValue(wifiMac);
        }
        final DeviceInfo deviceInfo2 = deviceInfo;
        final DeviceInfo deviceInfo3 = new DeviceInfo();
        deviceInfo3.setKey(DeviceInfo.SERIAL);
        deviceInfo3.setValue(MdmSdk.getSerialNumber());
        final DeviceInfo deviceInfo4 = new DeviceInfo();
        deviceInfo4.setKey(DeviceInfo.PLATFORM_ID);
        deviceInfo4.setValue(String.valueOf(i.a()));
        int i = SpHelper.getInt("device_status", 1);
        final DeviceInfo deviceInfo5 = new DeviceInfo();
        deviceInfo5.setKey(DeviceInfo.STATUS);
        deviceInfo5.setValue(String.valueOf(i));
        final DeviceInfoDao deviceInfoDao = MDMApp.k().getDeviceInfoDao();
        MDMApp.k().runInTx(new Runnable() {
            @Override
            public final void run() {
                DeviceInfoProvider.b(DeviceInfoDao.this, deviceInfo2, deviceInfo3, deviceInfo4, deviceInfo5);
            }
        });
    }

    static void b(DeviceInfoDao deviceInfoDao, DeviceInfo deviceInfo, DeviceInfo deviceInfo2, DeviceInfo deviceInfo3, DeviceInfo deviceInfo4) {
        deviceInfoDao.deleteAll();
        if (deviceInfo != null) {
            deviceInfoDao.insertInTx(deviceInfo, deviceInfo2, deviceInfo3, deviceInfo4);
        } else {
            deviceInfoDao.insertInTx(deviceInfo2, deviceInfo3, deviceInfo4);
        }
    }

    @Override
    public int delete(@NonNull Uri uri, @Nullable String str, @Nullable String[] strArr) {
        return 0;
    }

    @Override
    @Nullable
    public String getType(@NonNull Uri uri) {
        int match = d.match(uri);
        if (match == 0) {
            return "vnd.android.cursor.dir/device";
        }
        if (match != 1) {
            return null;
        }
        return "vnd.android.cursor.item/device";
    }

    @Override
    @Nullable
    public Uri insert(@NonNull Uri uri, @Nullable ContentValues contentValues) {
        return null;
    }

    @Override
    public boolean onCreate() {
        this.f326a = new DeviceInfoDaoImpl(getContext());
        return true;
    }

    @Override
    @Nullable
    public Cursor query(@NonNull Uri uri, @Nullable String[] strArr, @Nullable String str, @Nullable String[] strArr2, @Nullable String str2) {
        Cursor query;
        int match = d.match(uri);
        if (match == 0) {
            a();
            query = this.f326a.query(str, strArr2);
        } else {
            if (match != 1) {
                throw new IllegalArgumentException("Unknown URI: " + uri);
            }
            a();
            query = this.f326a.query(f325c + "=?", new String[]{String.valueOf(ContentUris.parseId(uri))});
        }
        query.setNotificationUri(getContext().getContentResolver(), uri);
        return query;
    }

    @Override
    public int update(@NonNull Uri uri, @Nullable ContentValues contentValues, @Nullable String str, @Nullable String[] strArr) {
        return 0;
    }
}