导航菜单

页面标题

页面副标题

Fancy Optimizer v4.6.3 - AppLockMonitorService.java 源代码

正在查看: Fancy Optimizer v4.6.3 应用的 AppLockMonitorService.java JAVA 源代码文件

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


package com.fancyclean.boost.applock.service;

import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.IBinder;
import android.os.SystemClock;
import androidx.annotation.Nullable;
import ap.j;
import com.fancyclean.boost.applock.business.lockingscreen.d;
import com.fancyclean.boost.applock.config.ConfigChangeController;
import i5.b;
import kotlin.jvm.internal.s;
import ml.m;
import org.greenrobot.eventbus.ThreadMode;
import p5.a;
import q5.b;
import vj.e;
import vj.h;

public class AppLockMonitorService extends Service {
    public static final h g = h.f(AppLockMonitorService.class);
    public static AppLockMonitorService h;
    public i5.a c;
    public p5.a d;
    public d e;
    public final a f = new a();

    public class a extends BroadcastReceiver {
        public a() {
        }

        @Override
        public final void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (!"android.intent.action.SCREEN_ON".equalsIgnoreCase(action)) {
                if (!"android.intent.action.SCREEN_OFF".equalsIgnoreCase(action)) {
                    AppLockMonitorService.g.d("Unexpected broadcast, action: " + action, (Throwable) null);
                    return;
                }
                p5.a aVar = AppLockMonitorService.this.d;
                aVar.getClass();
                p5.a.n.c("==> pause");
                aVar.h = 2;
                aVar.i.c();
                aVar.e = false;
                AppLockMonitorService.this.d.m.a.clear();
                return;
            }
            p5.a aVar2 = AppLockMonitorService.this.d;
            if (aVar2.h == 2) {
                h hVar = p5.a.n;
                hVar.c("==> resume");
                aVar2.h = 3;
                boolean a = aVar2.a();
                b bVar = aVar2.i;
                if (a) {
                    hVar.c("resume, has something to lock, start monitor");
                    bVar.b();
                } else {
                    hVar.c("resume, has nothing to lock, stop monitor");
                    bVar.c();
                }
            }
        }
    }

    public final a.d a() {
        a.d dVar = new a.d();
        SharedPreferences sharedPreferences = getSharedPreferences("app_lock", 0);
        dVar.b = sharedPreferences == null ? false : sharedPreferences.getBoolean("unlock_once_to_unlock_all_enabled", false);
        SharedPreferences sharedPreferences2 = getSharedPreferences("app_lock", 0);
        dVar.a = sharedPreferences2 != null ? sharedPreferences2.getBoolean("app_relocking_hints_enabled", true) : true;
        return dVar;
    }

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

    @Override
    public final void onCreate() {
        super.onCreate();
        h = this;
        if (p5.a.o == null) {
            synchronized (p5.a.class) {
                if (p5.a.o == null) {
                    p5.a.o = new p5.a(this);
                }
            }
        }
        this.d = p5.a.o;
        this.c = i5.a.c(this);
        d a10 = d.a(this);
        this.e = a10;
        this.d.l = a10;
        e eVar = s.g;
        a10.f.a = eVar.d(this, 1, "lock_type");
        this.e.f.c = eVar.f(this, "pattern_code_hash", (String) null);
        this.e.f.d = eVar.f(this, "pin_code_hash", (String) null);
        this.e.f.b = eVar.g(this, "fingerprint_unlock_enabled", false);
        this.e.f.e = eVar.g(this, "hide_pattern_path_enabled", false);
        this.e.f.f = eVar.g(this, "random_password_keyboard_enabled", false);
        this.e.f.g = i5.a.c(this).g();
        this.e.f.h = eVar.g(this, "vibration_feedback_enabled", true);
        p5.a aVar = this.d;
        SharedPreferences sharedPreferences = getSharedPreferences("app_lock", 0);
        aVar.b = sharedPreferences == null ? false : sharedPreferences.getBoolean("delay_lock_enabled", false);
        aVar.m.a.clear();
        this.d.m.c = a();
        p5.a aVar2 = this.d;
        SharedPreferences sharedPreferences2 = getSharedPreferences("app_lock", 0);
        aVar2.c = sharedPreferences2 == null ? false : sharedPreferences2.getBoolean("disguise_enabled", false);
        p5.a aVar3 = this.d;
        SharedPreferences sharedPreferences3 = getSharedPreferences("app_lock", 0);
        aVar3.d = sharedPreferences3 == null ? false : sharedPreferences3.getBoolean("new_lock_app_installer_enabled", false);
        aVar3.b();
        SharedPreferences sharedPreferences4 = getSharedPreferences("app_lock", 0);
        boolean z10 = sharedPreferences4 == null ? false : sharedPreferences4.getBoolean("break_in_alert_enabled", false);
        SharedPreferences sharedPreferences5 = getSharedPreferences("app_lock", 0);
        i5.b.b(this).j = new b.C0207b(z10, sharedPreferences5 != null ? sharedPreferences5.getInt("wrong_password_entries_count", 1) : 1);
        new Thread(new s5.a(this)).start();
    }

    @Override
    public final void onDestroy() {
        try {
            unregisterReceiver(this.f);
        } catch (Exception e) {
            e.printStackTrace();
        }
        p5.a aVar = this.d;
        aVar.getClass();
        p5.a.n.c("==> stop");
        aVar.h = 4;
        aVar.i.c();
        aVar.e = false;
        aVar.f = null;
        super.onDestroy();
    }

    @Override
    public final int onStartCommand(Intent intent, int i, int i10) {
        String action;
        boolean z10;
        if (intent == null) {
            g.l("==> onStartCommand, null intent, service is restarted", (Exception) null);
            action = "start_monitor";
        } else {
            action = intent.getAction();
            g.c("==> onStartCommand, action: " + action + ", flags: " + i + ", startId: " + i10);
        }
        if ("start_monitor".equals(action)) {
            int i11 = this.d.h;
            if (i11 == 0 || i11 == 4) {
                h hVar = y7.a.a;
                if (Build.VERSION.SDK_INT <= 24) {
                    m.d(this).f(new Intent(this, (Class<?>) AppLockMonitorHelperService.class), false, new androidx.constraintlayout.core.state.e(15));
                }
                p5.a aVar = this.d;
                aVar.getClass();
                h hVar2 = p5.a.n;
                hVar2.c("==> start");
                if (aVar.l == null) {
                    throw new NullPointerException("AppLockEngineCallback is null, set it before startScanning monitor!");
                }
                aVar.h = 1;
                boolean a10 = aVar.a();
                q5.b bVar = aVar.i;
                if (a10) {
                    hVar2.c("start, has something to lock, start monitor");
                    bVar.b();
                } else {
                    hVar2.c("start, has nothing to lock, stop monitor");
                    bVar.c();
                }
                IntentFilter intentFilter = new IntentFilter();
                intentFilter.addAction("android.intent.action.SCREEN_OFF");
                intentFilter.addAction("android.intent.action.SCREEN_ON");
                registerReceiver(this.f, intentFilter);
                if (!ap.b.b().e(this)) {
                    ap.b.b().j(this);
                }
            }
        } else if ("stop_monitor".equals(action)) {
            h hVar3 = y7.a.a;
            if (Build.VERSION.SDK_INT <= 24) {
                stopForeground(true);
            }
            stopSelf();
            ap.b.b().l(this);
        } else if ("config_changed".equals(action)) {
            ConfigChangeController.ConfigChangedData configChangedData = (ConfigChangeController.ConfigChangedData) intent.getParcelableExtra("config_changed_data");
            h hVar4 = g;
            if (configChangedData != null) {
                int i12 = configChangedData.c;
                switch (i12) {
                    case 1:
                        SharedPreferences sharedPreferences = getSharedPreferences("app_lock", 0);
                        this.e.f.a = sharedPreferences == null ? 1 : sharedPreferences.getInt("lock_type", 1);
                        break;
                    case 2:
                        SharedPreferences sharedPreferences2 = getSharedPreferences("app_lock", 0);
                        this.e.f.c = sharedPreferences2 != null ? sharedPreferences2.getString("pattern_code_hash", null) : null;
                        break;
                    case 3:
                        SharedPreferences sharedPreferences3 = getSharedPreferences("app_lock", 0);
                        this.e.f.d = sharedPreferences3 != null ? sharedPreferences3.getString("pin_code_hash", null) : null;
                        break;
                    case 4:
                        hVar4.c("Config changed, refreshPattern");
                        new Thread(new s5.a(this)).start();
                        break;
                    case 5:
                    case 6:
                    default:
                        hVar4.d("Unknown configId: " + i12, (Throwable) null);
                        break;
                    case 7:
                        SharedPreferences sharedPreferences4 = getSharedPreferences("app_lock", 0);
                        this.e.f.b = sharedPreferences4 != null ? sharedPreferences4.getBoolean("fingerprint_unlock_enabled", false) : false;
                        break;
                    case 8:
                        SharedPreferences sharedPreferences5 = getSharedPreferences("app_lock", 0);
                        z10 = sharedPreferences5 != null ? sharedPreferences5.getBoolean("delay_lock_enabled", false) : false;
                        p5.a aVar2 = this.d;
                        aVar2.b = z10;
                        aVar2.m.a.clear();
                        this.d.m.c = a();
                        break;
                    case 9:
                        d dVar = this.e;
                        SharedPreferences sharedPreferences6 = getSharedPreferences("app_lock", 0);
                        dVar.f.e = sharedPreferences6 != null ? sharedPreferences6.getBoolean("hide_pattern_path_enabled", false) : false;
                        break;
                    case 10:
                        d dVar2 = this.e;
                        SharedPreferences sharedPreferences7 = getSharedPreferences("app_lock", 0);
                        dVar2.f.f = sharedPreferences7 != null ? sharedPreferences7.getBoolean("random_password_keyboard_enabled", false) : false;
                        break;
                    case 11:
                        this.e.f.g = i5.a.c(this).g();
                        break;
                    case 12:
                        SharedPreferences sharedPreferences8 = getSharedPreferences("app_lock", 0);
                        boolean z11 = sharedPreferences8 == null ? false : sharedPreferences8.getBoolean("break_in_alert_enabled", false);
                        SharedPreferences sharedPreferences9 = getSharedPreferences("app_lock", 0);
                        i5.b.b(this).j = new b.C0207b(z11, sharedPreferences9 == null ? 1 : sharedPreferences9.getInt("wrong_password_entries_count", 1));
                        break;
                    case 13:
                        SharedPreferences sharedPreferences10 = getSharedPreferences("app_lock", 0);
                        this.d.c = sharedPreferences10 != null ? sharedPreferences10.getBoolean("disguise_enabled", false) : false;
                        new Thread(new s5.a(this)).start();
                        break;
                    case 14:
                        SharedPreferences sharedPreferences11 = getSharedPreferences("app_lock", 0);
                        z10 = sharedPreferences11 != null ? sharedPreferences11.getBoolean("new_lock_app_installer_enabled", false) : false;
                        p5.a aVar3 = this.d;
                        aVar3.d = z10;
                        aVar3.b();
                        break;
                    case 15:
                        SharedPreferences sharedPreferences12 = getSharedPreferences("app_lock", 0);
                        this.e.f.h = sharedPreferences12 == null ? true : sharedPreferences12.getBoolean("vibration_feedback_enabled", true);
                        break;
                }
            } else {
                hVar4.d("configChangedData is null", (Throwable) null);
            }
        } else if ("skip_package".equals(action)) {
            p5.a aVar4 = this.d;
            String stringExtra = intent.getStringExtra("skip_package_name");
            aVar4.e = true;
            aVar4.g = stringExtra;
        }
        return 1;
    }

    @j(threadMode = ThreadMode.POSTING)
    public void onUnlockAppSucceed(l5.b bVar) {
        p5.a aVar = this.d;
        String str = bVar.a;
        synchronized (aVar) {
            if (str != null) {
                if (str.equals(aVar.f)) {
                    aVar.e = true;
                }
            }
            if (aVar.b) {
                aVar.m.a(str);
            }
            aVar.a = SystemClock.elapsedRealtime();
        }
    }
}