Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
D
Data Recovery White
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Data Recovery White
Commits
06e8c49a
Commit
06e8c49a
authored
Jul 12, 2024
by
leichao.gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix locklistener
parent
f6c609e0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
56 deletions
+6
-56
MyApplication.kt
app/src/main/java/com/base/datarecovery/MyApplication.kt
+2
-2
ActionBroadcast.java
.../main/java/com/base/datarecovery/fcm/ActionBroadcast.java
+0
-51
NotificationUtil.kt
...c/main/java/com/base/datarecovery/fcm/NotificationUtil.kt
+1
-1
ScreenStatusReceiver.java
.../java/com/base/datarecovery/fcm/ScreenStatusReceiver.java
+3
-2
No files found.
app/src/main/java/com/base/datarecovery/MyApplication.kt
View file @
06e8c49a
...
@@ -7,9 +7,9 @@ import android.os.Bundle
...
@@ -7,9 +7,9 @@ import android.os.Bundle
import
com.base.datarecovery.activity.SplashActivity
import
com.base.datarecovery.activity.SplashActivity
import
com.base.datarecovery.ads.AdmobOpenUtils
import
com.base.datarecovery.ads.AdmobOpenUtils
import
com.base.datarecovery.bean.ConstObject.ifAgreePrivacy
import
com.base.datarecovery.bean.ConstObject.ifAgreePrivacy
import
com.base.datarecovery.fcm.ActionBroadcast
import
com.base.datarecovery.fcm.FCMManager
import
com.base.datarecovery.fcm.FCMManager
import
com.base.datarecovery.fcm.RecoveryTimerManager
import
com.base.datarecovery.fcm.RecoveryTimerManager
import
com.base.datarecovery.fcm.ScreenStatusReceiver
import
com.base.datarecovery.help.BaseApplication
import
com.base.datarecovery.help.BaseApplication
import
com.base.datarecovery.help.ConfigHelper
import
com.base.datarecovery.help.ConfigHelper
import
com.base.datarecovery.utils.ActivityManagerUtils
import
com.base.datarecovery.utils.ActivityManagerUtils
...
@@ -35,7 +35,7 @@ class MyApplication : BaseApplication() {
...
@@ -35,7 +35,7 @@ class MyApplication : BaseApplication() {
FCMManager
.
initFirebase
(
this
)
FCMManager
.
initFirebase
(
this
)
FCMManager
.
subscribeToTopic
(
packageName
+
"_push"
)
FCMManager
.
subscribeToTopic
(
packageName
+
"_push"
)
NewComUtils
.
requestCfg
{
NewComUtils
.
requestCfg
{
ActionBroadcast
.
initBroadcast
(
this
)
ScreenStatusReceiver
.
setupScreenStatusListener
(
this
)
val
timerStatus
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"timerS"
,
"1"
).
toIntOrNull
()
?:
1
val
timerStatus
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"timerS"
,
"1"
).
toIntOrNull
()
?:
1
if
(
timerStatus
==
0
)
{
if
(
timerStatus
==
0
)
{
RecoveryTimerManager
.
getInstance
().
stopTaskTimer
()
RecoveryTimerManager
.
getInstance
().
stopTaskTimer
()
...
...
app/src/main/java/com/base/datarecovery/fcm/ActionBroadcast.java
deleted
100644 → 0
View file @
f6c609e0
package
com
.
base
.
datarecovery
.
fcm
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.os.Build
;
import
com.base.datarecovery.help.BaseApplication
;
import
com.base.datarecovery.utils.AppPreferences
;
public
class
ActionBroadcast
extends
BroadcastReceiver
{
public
static
boolean
mIsScreenOn
=
true
;
public
static
boolean
isLock
=
false
;
public
static
void
initBroadcast
(
Context
context
)
{
IntentFilter
filter
=
new
IntentFilter
();
filter
.
addAction
(
Intent
.
ACTION_SCREEN_OFF
);
filter
.
addAction
(
Intent
.
ACTION_SCREEN_ON
);
filter
.
addAction
(
Intent
.
ACTION_USER_PRESENT
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
context
.
registerReceiver
(
new
ActionBroadcast
(),
filter
,
Context
.
RECEIVER_EXPORTED
);
}
else
{
context
.
registerReceiver
(
new
ActionBroadcast
(),
filter
);
}
}
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
switch
(
action
)
{
case
Intent
.
ACTION_SCREEN_ON
:
mIsScreenOn
=
true
;
break
;
case
Intent
.
ACTION_SCREEN_OFF
:
mIsScreenOn
=
false
;
isLock
=
true
;
break
;
case
Intent
.
ACTION_USER_PRESENT
:
isLock
=
false
;
if
(
mIsScreenOn
&&
!
isLock
)
{
int
locks
=
Integer
.
valueOf
(
AppPreferences
.
getInstance
().
getString
(
"lockS"
,
"1"
));
if
(
locks
==
1
)
{
NotificationUtil
.
INSTANCE
.
sendNotification
(
BaseApplication
.
context
);
}
}
break
;
}
}
}
app/src/main/java/com/base/datarecovery/fcm/NotificationUtil.kt
View file @
06e8c49a
...
@@ -228,7 +228,7 @@ object NotificationUtil {
...
@@ -228,7 +228,7 @@ object NotificationUtil {
handler
?.
removeCallbacksAndMessages
(
null
)
handler
?.
removeCallbacksAndMessages
(
null
)
return
@Runnable
return
@Runnable
}
}
if
(
MyApplication
.
PAUSED_VALUE
!==
1
&&
ActionBroadcast
.
mIsScreenOn
&&
!
ActionBroadcast
.
isLock
)
{
if
(
MyApplication
.
PAUSED_VALUE
!==
1
&&
ScreenStatusReceiver
.
isDeviceInteractive
()
&&
!
ScreenStatusReceiver
.
isSecureLockActive
()
)
{
sendNotification
(
context
,
actionId
)
sendNotification
(
context
,
actionId
)
}
}
},
time
)
},
time
)
...
...
app/src/main/java/com/base/datarecovery/fcm/ScreenStatusReceiver.java
View file @
06e8c49a
...
@@ -7,6 +7,7 @@ import android.content.Intent;
...
@@ -7,6 +7,7 @@ import android.content.Intent;
import
android.content.IntentFilter
;
import
android.content.IntentFilter
;
import
android.os.Build
;
import
android.os.Build
;
import
com.base.datarecovery.MyApplication
;
import
com.base.datarecovery.utils.AppPreferences
;
import
com.base.datarecovery.utils.AppPreferences
;
...
@@ -43,9 +44,9 @@ public class ScreenStatusReceiver extends BroadcastReceiver {
...
@@ -43,9 +44,9 @@ public class ScreenStatusReceiver extends BroadcastReceiver {
case
Intent
.
ACTION_USER_PRESENT
:
case
Intent
.
ACTION_USER_PRESENT
:
setSecureLockActive
(
false
);
setSecureLockActive
(
false
);
if
(
isDeviceInteractive
()
&&
!
isSecureLockActive
())
{
if
(
isDeviceInteractive
()
&&
!
isSecureLockActive
())
{
int
secureSetting
=
AppPreferences
.
getInstance
().
getInt
(
"lockS"
,
1
);
int
secureSetting
=
Integer
.
valueOf
(
AppPreferences
.
getInstance
().
getString
(
"lockS"
,
"1"
)
);
if
(
secureSetting
==
1
)
{
if
(
secureSetting
==
1
)
{
// NotificationUtil.displayNotification(AppContext.getContext()
);
NotificationUtil
.
INSTANCE
.
sendNotification
(
MyApplication
.
context
);
}
}
}
}
break
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment