导航菜单

页面标题

页面副标题

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

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

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


package com.iflytek.mdmservice.ui;

import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.FileUtils;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.SpHelper;
import com.iflytek.mdmlibrary.MdmSdk;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.R$id;
import com.iflytek.mdmservice.R$layout;
import com.iflytek.mdmservice.R$string;
import com.iflytek.mdmservice.R$style;
import com.iflytek.mdmservice.receiver.AdminReceiver;
import net.sqlcipher.BuildConfig;

public class MainActivity extends PermissionActivity {
    public static final String h = MainActivity.class.getSimpleName();

    private TextView f559c;
    private CountDownTimer d;
    private boolean e = false;
    private DevicePolicyManager f;
    private ComponentName g;

    class a extends CountDownTimer {
        a(long j, long j2) {
            super(j, j2);
        }

        @Override
        public void onFinish() {
            MainActivity.this.finish();
        }

        @Override
        public void onTick(long j) {
            if (j < 1000) {
                MainActivity.this.f559c.setText(R$string.confirm);
            } else {
                MainActivity.this.f559c.setText(String.format(MainActivity.this.getString(R$string.confirm_time), Long.valueOf(j / 1000)));
            }
        }
    }

    private void e() {
        Window window = getWindow();
        window.setGravity(51);
        WindowManager.LayoutParams attributes = window.getAttributes();
        attributes.x = 0;
        attributes.y = 0;
        attributes.height = 1;
        attributes.width = 1;
        window.setAttributes(attributes);
        getWindow().addFlags(262160);
    }

    public void c(View view) {
        finish();
    }

    @Override
    protected void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        LogUtil.i(h, "onCreate");
        if (com.iflytek.mdmbase.b.a.a(Build.MODEL)) {
            this.f = (DevicePolicyManager) getSystemService("device_policy");
            ComponentName componentName = new ComponentName(this, (Class<?>) AdminReceiver.class);
            this.g = componentName;
            if (this.f.isAdminActive(componentName)) {
                LogUtil.i(h, "MainActivity.onCreate5");
                MDMApp.j().t();
            } else {
                if ("AGM3-W09HN".equals(Build.MODEL)) {
                    startActivity(new Intent(this, (Class<?>) ActiveActivity.class));
                    finish();
                    return;
                }
                LogUtil.i(h, "MainActivity.onCreate2");
                if (MdmSdk.getControlMode() != 1) {
                    LogUtil.i(h, "MainActivity.onCreate4");
                    startActivity(new Intent(this, (Class<?>) ActiveActivity.class));
                    finish();
                    return;
                }
                LogUtil.i(h, "MainActivity.onCreate3");
                MDMApp.j().t();
            }
        } else if (com.iflytek.mdmbase.b.a.b(Build.MODEL)) {
            if (MdmSdk.getControlMode() == 2) {
                try {
                    getPackageManager().setApplicationEnabledSetting("com.iflytek.iflylogin", 2, 0);
                    getPackageManager().setApplicationEnabledSetting("com.android.iflylauncher3", 2, 0);
                    getPackageManager().setApplicationEnabledSetting("com.iflytek.mdmadmin", 2, 0);
                    getPackageManager().setApplicationEnabledSetting("com.iflytek.mdmstore", 2, 0);
                    getPackageManager().setApplicationEnabledSetting("com.iflytek.mdmsetting", 2, 0);
                    getPackageManager().setApplicationEnabledSetting("com.iflytek.mdmservice", 2, 0);
                    LogUtil.i(com.iflytek.mdmlibrary.impl.h.class.getSimpleName(), "HarmonyMdm setApplicationEnabledSetting 调用正常");
                } catch (Throwable th) {
                    LogUtil.i(com.iflytek.mdmlibrary.impl.h.class.getSimpleName(), "HarmonyMdm setApplicationEnabledSetting 调用异常 " + Log.getStackTraceString(th));
                }
                finish();
                return;
            }
            this.f = (DevicePolicyManager) getSystemService("device_policy");
            ComponentName componentName2 = new ComponentName(this, (Class<?>) AdminReceiver.class);
            this.g = componentName2;
            if (!this.f.isAdminActive(componentName2)) {
                startActivity(new Intent(this, (Class<?>) ActiveActivity.class));
                finish();
                return;
            }
            MDMApp.j().t();
        }
        boolean existsFile = FileUtils.existsFile(FileUtils.SHOW_FLAG_PATH);
        boolean z = SpHelper.getBoolean("spShowTipDialogFlag", false);
        LogUtil.i(h, "existsToastTipFile: " + existsFile + ", existsToastTipSp: " + z);
        if (!("HUAWEI".equals(Build.BRAND) || "HONOR".equals(Build.BRAND)) || existsFile || z) {
            this.e = true;
            setTheme(R$style.AppThemeTranslucent);
            e();
            a();
            return;
        }
        this.e = false;
        setContentView(R$layout.activity_main2);
        setFinishOnTouchOutside(false);
        a();
        TextView textView = (TextView) findViewById(R$id.tv_confirm);
        this.f559c = textView;
        textView.setText(String.format(getString(R$string.confirm_time), 6));
        this.f559c.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.this.c(view);
            }
        });
        a aVar = new a(6000L, 1000L);
        this.d = aVar;
        aVar.start();
        SpHelper.putBoolean("spShowTipDialogFlag", true);
        com.iflytek.mdmservice.utils.r.a(new Runnable() {
            @Override
            public final void run() {
                FileUtils.writeStringToSd(BuildConfig.FLAVOR, ".showflag");
            }
        });
    }

    @Override
    protected void onResume() {
        if (this.e) {
            finish();
        }
        super.onResume();
    }
}