Commit 89348f53 authored by jyx's avatar jyx

体验任务添加使用记录权限

parent c48e1d96
......@@ -97,6 +97,11 @@ class TaskCpdHistoryFragment : LazyLoadBaseFragment(), TaskCpdHistoryView,
when (mFakeTaskList[position].state) {
// 1 去试玩, 2 领取奖励 3 已领取 4 继续试玩
1 -> {
if (!AppUtil.isOpenUsageStats()) {
AppTryPlayManager.openAppUsageStats(requireActivity())
return
}
mTaskAdapter?.let {
val currentPkgName = mFakeTaskList[it.getPosition()].currentPkgName
if (currentPkgName == null) {
......
......@@ -140,13 +140,6 @@ object AppUtil {
// 如果当前上次使用时间 小于 当前时间-5分钟,判断合规
if (paramString == (list[i] as UsageStats).packageName) {
if (BuildConfig.DEBUG) {
ToastUtil.showLong(paramContext,
"当前APP名称:" + getAppName(paramString, paramContext)
+ "\r\n" + "当前判定时间间隔:" + SimpleDateFormat().format(l - 5 * 60 * 1000L) + "至" + SimpleDateFormat().format(l)
+ "\r\n" + "当前APP上次打开时间:" + SimpleDateFormat().format((list[i] as UsageStats).lastTimeUsed)
+ "\r\n" + "当前APP使用时间:" + (list[i] as UsageStats).totalTimeInForeground.toInt() / 1000 + "秒")
}
return (list[i] as UsageStats).totalTimeInForeground.toInt() / 1000
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment