导航菜单

页面标题

页面副标题

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

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

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


package com.iflytek.mdmservice.service;

import a.b.c.c;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Build;
import android.os.IBinder;
import android.os.RemoteException;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmservice.R$drawable;
import com.iflytek.mdmservice.k.d0;
import com.iflytek.mdmservice.k.h0;
import com.iflytek.mdmstore.model.RemoteAppInfo;
import java.util.Iterator;
import java.util.List;

public class CheckMDMService extends IntentService {

    private static final Object f449c = new Object();

    private a.b.c.c f450a;

    ServiceConnection f451b;

    class a implements d0.z {
        a() {
        }

        @Override
        public void a(List<RemoteAppInfo> list) {
            h0.b(this, list);
        }

        @Override
        public void b(List<RemoteAppInfo> list) {
            if (CheckMDMService.this.f450a == null) {
                Iterator<RemoteAppInfo> it = list.iterator();
                while (it.hasNext()) {
                    com.iflytek.mdmservice.utils.e.b(CheckMDMService.this.getApplicationContext()).e(it.next());
                }
                return;
            }
            try {
                CheckMDMService.this.f450a.x(list);
            } catch (RemoteException unused) {
                Iterator<RemoteAppInfo> it2 = list.iterator();
                while (it2.hasNext()) {
                    com.iflytek.mdmservice.utils.e.b(CheckMDMService.this.getApplicationContext()).e(it2.next());
                }
            }
        }
    }

    class b implements ServiceConnection {
        b() {
        }

        @Override
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            CheckMDMService.this.f450a = c.a.G(iBinder);
            LogUtil.e("CheckMDMService服务启动");
        }

        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            CheckMDMService.this.f450a = null;
            LogUtil.e("CheckMDMService服务关闭");
        }
    }

    public CheckMDMService() {
        super("CheckMDMService");
        this.f451b = new b();
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Intent intent = new Intent();
        intent.setComponent(new ComponentName("com.iflytek.mdmstore", "com.iflytek.mdmstore.service.DownloadRemoteManagerService"));
        LogUtil.e("CheckMDMService绑定服务" + bindService(intent, this.f451b, 1));
        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(1115, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
        }
    }

    @Override
    public void onDestroy() {
        LogUtil.d("CheckMDMService", "onDestroy");
        ServiceConnection serviceConnection = this.f451b;
        if (serviceConnection != null) {
            unbindService(serviceConnection);
            LogUtil.d("CheckMDMService", "onDestroy解绑");
        }
        super.onDestroy();
    }

    @Override
    protected void onHandleIntent(@Nullable Intent intent) {
        LogUtil.d("CheckMDMService onHandleIntent");
        long currentTimeMillis = System.currentTimeMillis();
        while (this.f450a == null && System.currentTimeMillis() - currentTimeMillis < 3000) {
            synchronized (f449c) {
                try {
                    f449c.wait(100L);
                } catch (InterruptedException e) {
                    LogUtil.e(e.getMessage());
                    Thread.currentThread().interrupt();
                }
            }
        }
        d0.b0().E(new a());
    }

    @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(1115, new Notification.Builder(this, packageName).setContentTitle("正在进行设备管控").setContentText("管控平台正在后台运行,请勿停用此服务!").setWhen(System.currentTimeMillis()).setSmallIcon(R$drawable.ic_notification_mdm).build());
        }
        return super.onStartCommand(intent, i, i2);
    }
}