导航菜单

页面标题

页面副标题

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

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

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


package com.iflytek.mdmservice.service;

import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Build;
import android.os.SystemClock;
import android.util.Log;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.R$drawable;
import com.iflytek.mdmservice.receiver.AdminReceiver;

public class AdminActiveService extends IntentService {

    private DevicePolicyManager f428a;

    private ComponentName f429b;

    public AdminActiveService() {
        super("AdminActiveService");
    }

    @Override
    public void onCreate() {
        super.onCreate();
        if (Build.VERSION.SDK_INT >= 26) {
            String packageName = getPackageName();
            NotificationManager notificationManager = (NotificationManager) getSystemService(com.igexin.push.core.b.l);
            NotificationChannel notificationChannel = new NotificationChannel(packageName, "主服务", 4);
            notificationChannel.enableLights(true);
            notificationChannel.setLightColor(-65536);
            notificationChannel.setShowBadge(true);
            notificationChannel.setDescription("管控平台正在后台运行,请勿停用此服务!");
            notificationChannel.setLockscreenVisibility(-1);
            notificationManager.createNotificationChannel(notificationChannel);
            startForeground(3114, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
        }
        this.f428a = (DevicePolicyManager) getSystemService("device_policy");
        this.f429b = new ComponentName(this, (Class<?>) AdminReceiver.class);
    }

    @Override
    public void onDestroy() {
        stopForeground(true);
        super.onDestroy();
    }

    @Override
    protected void onHandleIntent(@Nullable Intent intent) {
        while (true) {
            try {
                LogUtil.c("adapter_harmony", "等待判断是否是设备管理器");
            } catch (Exception e) {
                LogUtil.c("adapter_harmony", Log.getStackTraceString(e));
            }
            if (this.f428a.isAdminActive(this.f429b)) {
                MDMApp.j().t();
                return;
            }
            SystemClock.sleep(100L);
        }
    }

    @Override
    public int onStartCommand(@Nullable Intent intent, int i, int i2) {
        if (Build.VERSION.SDK_INT >= 26) {
            String packageName = getPackageName();
            NotificationManager notificationManager = (NotificationManager) getSystemService(com.igexin.push.core.b.l);
            NotificationChannel notificationChannel = new NotificationChannel(packageName, "主服务", 4);
            notificationChannel.enableLights(true);
            notificationChannel.setLightColor(-65536);
            notificationChannel.setShowBadge(true);
            notificationChannel.setDescription("管控平台正在后台运行,请勿停用此服务!");
            notificationChannel.setLockscreenVisibility(-1);
            notificationManager.createNotificationChannel(notificationChannel);
            startForeground(3114, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
        }
        return super.onStartCommand(intent, i, i2);
    }
}