导航菜单

页面标题

页面副标题

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

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

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


package com.user.a4keygen.services;

import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.IBinder;
import android.os.SystemClock;
import androidx.core.app.NotificationCompat;
import com.user.a4keygen.BuildConfig;
import com.user.a4keygen.R;
import com.user.a4keygen.activity.LockingActvity;
import com.user.a4keygen.constants.WebServiceUrlConstant;
import com.user.a4keygen.receiver.ScreenStatusReceiver;
import com.user.a4keygen.util.Config;
import com.user.a4keygen.webutil.WebClientService;

public class LockService extends Service {
    static final boolean $assertionsDisabled = false;
    private BroadcastReceiver ssbroadcastReceiver;
    int time = 0;
    boolean stop = false;

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

    @Override
    public int onStartCommand(Intent intent, int i, int i2) {
        return 1;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.SCREEN_ON");
        intentFilter.addAction("android.intent.action.SCREEN_OFF");
        intentFilter.addAction("android.intent.action.USER_PRESENT");
        intentFilter.setPriority(1000);
        ScreenStatusReceiver screenStatusReceiver = new ScreenStatusReceiver();
        this.ssbroadcastReceiver = screenStatusReceiver;
        registerReceiver(screenStatusReceiver, intentFilter);
        startInForeground();
    }

    private void startInForeground() {
        if (Build.VERSION.SDK_INT >= 26) {
            createNotificationChannel(Config.CHANNEL_ID, "MyService");
            Notification.Builder contentIntent = new Notification.Builder(this, Config.CHANNEL_ID).setContentTitle("Company name").setAutoCancel(false).setSmallIcon(WebClientService.getWebServiceUrl().equals(WebServiceUrlConstant.GMM_WEB_SERVICE_URL) ? R.mipmap.ic_app_gmm : R.mipmap.ic_app).setContentIntent(PendingIntent.getActivity(getApplicationContext(), 0, new Intent(getApplicationContext(), (Class<?>) LockingActvity.class), 33554432));
            contentIntent.setOngoing(true);
            Notification build = contentIntent.build();
            build.flags |= 98;
            startForeground(1112, build);
            return;
        }
        startForeground(18, new NotificationCompat.Builder(this).setContentTitle("Company name").setPriority(0).setAutoCancel(false).build());
    }

    private void createNotificationChannel(String str, String str2) {
        try {
            if (Build.VERSION.SDK_INT >= 26) {
                NotificationChannel notificationChannel = new NotificationChannel(str, str2, 0);
                notificationChannel.setLightColor(-16776961);
                notificationChannel.setLockscreenVisibility(0);
                ((NotificationManager) getSystemService("notification")).createNotificationChannel(notificationChannel);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        stopForeground(true);
        unregisterReceiver(this.ssbroadcastReceiver);
        if (Build.VERSION.SDK_INT >= 26) {
            startForegroundService(new Intent(this, (Class<?>) LockService.class));
        } else {
            startService(new Intent(this, (Class<?>) LockService.class));
        }
        if (Build.VERSION.SDK_INT >= 26) {
            stopForeground(true);
        } else {
            stopSelf();
        }
    }

    @Override
    public void onTaskRemoved(Intent intent) {
        super.onTaskRemoved(intent);
        Intent intent2 = new Intent(getApplicationContext(), (Class<?>) LockService.class);
        intent2.setPackage(BuildConfig.APPLICATION_ID);
        ((AlarmManager) getApplicationContext().getSystemService("alarm")).set(3, SystemClock.elapsedRealtime() + 1000, PendingIntent.getService(getApplicationContext(), 1, intent2, 33554432));
    }
}