AppLocker icon indicating copy to clipboard operation
AppLocker copied to clipboard

App Locker not working properly in Andriod 10 goes behind app

Open blazingdevil44 opened this issue 4 years ago • 1 comments

Applocker not working applocker goes on background

e.g when you open facebook app app locker shows first but facebook goes on top of it making it useless please help

blazingdevil44 avatar Feb 04 '21 08:02 blazingdevil44

private fun getForegroundObservableHigherLollipop(): Flowable<String> {
    return Flowable.interval(250, TimeUnit.MILLISECONDS)
        .filter { PermissionChecker.checkUsageAccessPermission(context) }
        .map {
            val mUsageStatsManager =
                context.getSystemService(Service.USAGE_STATS_SERVICE) as UsageStatsManager
            val time = System.currentTimeMillis()

            val usageEvents =
                mUsageStatsManager.queryUsageStats(INTERVAL_DAILY, time - 1000 * 10, time)
            val sortedUsageEvents = usageEvents.sortedBy { it.lastTimeUsed }
            val usageEvent = sortedUsageEvents.lastOrNull()

            UsageEventWrapper(usageEvent)
        }
        .filter { it.usageEvent != null }
        .map { it.usageEvent }
        .filter { it.packageName != null }
        .filter {
            it.packageName.contains(OverlayValidationActivity::class.java.simpleName).not()
        }
        .map { it.packageName }
        .distinctUntilChanged()
}

Update this code

aishik212 avatar Nov 28 '22 06:11 aishik212