导航菜单

页面标题

页面副标题

Fix Locker v1.5 - RebootService.java 源代码

正在查看: Fix Locker v1.5 应用的 RebootService.java JAVA 源代码文件

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


package com.user.a4keygen.services;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import com.user.a4keygen.DeviceAdminReceiver;
import com.user.a4keygen.constants.ServiceKeyValueConstant;
import com.user.a4keygen.constants.WebServiceUrlConstant;
import com.user.a4keygen.util.IconUtils;
import com.user.a4keygen.webutil.WebClientService;

public class RebootService extends Service {
    private static final String CHANNEL_ID = "RebootServiceChannel";
    private static final int NOTIFICATION_ID = 108;
    private static final String TAG = "RebootService";
    private ComponentName adminComponent;
    private DevicePolicyManager dpm;

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Log.d(TAG, "Service created");
        this.dpm = (DevicePolicyManager) getApplicationContext().getSystemService("device_policy");
        this.adminComponent = new ComponentName(getApplicationContext(), (Class<?>) DeviceAdminReceiver.class);
        if (WebClientService.isActiveAdmin(getApplicationContext())) {
            return;
        }
        Log.d(TAG, "Device Admin is not active!");
        stopSelf();
    }

    @Override
    public int onStartCommand(Intent intent, int i, int i2) {
        createNotificationChannel();
        startForeground(108, new NotificationCompat.Builder(this, CHANNEL_ID).setContentTitle(WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.GMM_WEB_SERVICE_URL) ? ServiceKeyValueConstant.REBOOT_SERVICE_ : "Rebooting The Device").setSmallIcon(IconUtils.getAppIcon()).setPriority(1).build());
        this.dpm.reboot(this.adminComponent);
        return 2;
    }

    private void createNotificationChannel() {
        if (Build.VERSION.SDK_INT >= 26) {
            NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "AppLock Service Channel", 3);
            NotificationManager notificationManager = (NotificationManager) getSystemService(NotificationManager.class);
            if (notificationManager != null) {
                notificationManager.createNotificationChannel(notificationChannel);
            }
        }
    }

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