导航菜单

页面标题

页面副标题

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

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

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


package com.iflytek.mdmservice.ui;

import android.app.Activity;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmlibrary.MdmSdk;
import com.iflytek.mdmservice.R$id;
import com.iflytek.mdmservice.R$layout;
import com.iflytek.mdmservice.receiver.AdminReceiver;
import com.iflytek.mdmservice.service.AdminActiveService;

public class ActiveActivity extends Activity {

    private DevicePolicyManager f547a;

    private ComponentName f548b;

    private TextView f549c;

    public void a(View view) {
        Intent intent = new Intent("android.app.action.ADD_DEVICE_ADMIN");
        intent.putExtra("android.app.extra.DEVICE_ADMIN", this.f548b);
        startActivityForResult(intent, 1);
    }

    @Override
    protected void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        LogUtil.i("ActiveActivity", "requestCode: " + i + ", resultCode: " + i2);
        if (i2 == -1 && i == 1) {
            if (com.iflytek.mdmbase.b.a.b(Build.MODEL)) {
                MdmSdk.activeDeviceAdmin(this);
                MdmSdk.setDeviceOwnerApp();
            }
            finish();
        }
    }

    @Override
    protected void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        this.f547a = (DevicePolicyManager) getSystemService("device_policy");
        ComponentName componentName = new ComponentName(this, (Class<?>) AdminReceiver.class);
        this.f548b = componentName;
        if (this.f547a.isAdminActive(componentName)) {
            finish();
            return;
        }
        LogUtil.c("ActiveActivity", "MdmSdk.getControlMode():" + MdmSdk.getControlMode());
        if ("AGM3-W09HN".equals(Build.MODEL) || (com.iflytek.mdmbase.b.a.b(Build.MODEL) && MdmSdk.getControlMode() == 1)) {
            MdmSdk.activeDeviceAdmin(this);
            if (com.iflytek.mdmbase.b.a.b(Build.MODEL)) {
                if (Build.VERSION.SDK_INT >= 26) {
                    startForegroundService(new Intent(this, (Class<?>) AdminActiveService.class));
                } else {
                    startService(new Intent(this, (Class<?>) AdminActiveService.class));
                }
            }
            finish();
            return;
        }
        setContentView(R$layout.activity_active);
        setFinishOnTouchOutside(false);
        TextView textView = (TextView) findViewById(R$id.tv_active_admin);
        this.f549c = textView;
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                ActiveActivity.this.a(view);
            }
        });
        if (com.iflytek.mdmbase.b.a.b(Build.MODEL)) {
            if (Build.VERSION.SDK_INT >= 26) {
                startForegroundService(new Intent(this, (Class<?>) AdminActiveService.class));
            } else {
                startService(new Intent(this, (Class<?>) AdminActiveService.class));
            }
        }
    }
}