Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Julian Dehm
briar
Commits
d64252aa
Verified
Commit
d64252aa
authored
Aug 15, 2018
by
Torsten Grote
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Screen Lock Timeout: Address review comments
parent
825ed451
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
15 deletions
+30
-15
briar-android/src/main/java/org/briarproject/briar/android/account/LockManagerImpl.java
...g/briarproject/briar/android/account/LockManagerImpl.java
+13
-4
briar-android/src/main/res/values/strings.xml
briar-android/src/main/res/values/strings.xml
+17
-11
No files found.
briar-android/src/main/java/org/briarproject/briar/android/account/LockManagerImpl.java
View file @
d64252aa
...
...
@@ -63,11 +63,15 @@ public class LockManagerImpl implements LockManager, Service, EventListener {
private
volatile
boolean
lockableSetting
=
false
;
private
volatile
int
timeoutMinutes
;
private
int
activitiesRunning
=
0
;
private
boolean
alarmSet
=
false
;
// This is to ensure that we don't start unlocked after a timeout and thus
// is set to the elapsed real time when no more activities are running.
// Its value is only relevant as long as no activity is running.
private
long
idleTime
;
private
final
MutableLiveData
<
Boolean
>
lockable
=
new
MutableLiveData
<>();
@Inject
public
LockManagerImpl
(
Application
app
,
SettingsManager
settingsManager
,
LockManagerImpl
(
Application
app
,
SettingsManager
settingsManager
,
AndroidNotificationManager
notificationManager
,
@DatabaseExecutor
Executor
dbExecutor
)
{
this
.
appContext
=
app
.
getApplicationContext
();
...
...
@@ -108,7 +112,10 @@ public class LockManagerImpl implements LockManager, Service, EventListener {
setLocked
(
true
);
}
activitiesRunning
++;
alarmManager
.
cancel
(
lockIntent
);
if
(
alarmSet
)
{
alarmManager
.
cancel
(
lockIntent
);
alarmSet
=
false
;
}
}
@UiThread
...
...
@@ -118,10 +125,11 @@ public class LockManagerImpl implements LockManager, Service, EventListener {
if
(
activitiesRunning
==
0
)
{
idleTime
=
elapsedRealtime
();
if
(!
locked
&&
timeoutEnabled
())
{
alarmManager
.
cancel
(
lockIntent
);
if
(
alarmSet
)
alarmManager
.
cancel
(
lockIntent
);
long
triggerAt
=
elapsedRealtime
()
+
MINUTES
.
toMillis
(
timeoutMinutes
);
alarmManager
.
set
(
ELAPSED_REALTIME
,
triggerAt
,
lockIntent
);
alarmSet
=
true
;
}
}
}
...
...
@@ -146,7 +154,8 @@ public class LockManagerImpl implements LockManager, Service, EventListener {
if
(
locked
&&
!
hasScreenLock
(
appContext
))
{
lockable
.
postValue
(
false
);
locked
=
false
;
}
else
if
(!
locked
&&
activitiesRunning
==
0
&&
timeoutEnabled
())
{
}
else
if
(!
locked
&&
activitiesRunning
==
0
&&
timeoutEnabled
()
&&
timedOut
())
{
setLocked
(
true
);
}
return
locked
;
...
...
briar-android/src/main/res/values/strings.xml
View file @
d64252aa
...
...
@@ -62,6 +62,7 @@
<string
name=
"groups_button"
>
Private Groups
</string>
<string
name=
"forums_button"
>
Forums
</string>
<string
name=
"blogs_button"
>
Blogs
</string>
<!-- This is part of the main menu. The app will be locked when this is tapped. -->
<string
name=
"lock_button"
>
Lock App
</string>
<string
name=
"settings_button"
>
Settings
</string>
<string
name=
"sign_out_button"
>
Sign Out
</string>
...
...
@@ -357,18 +358,23 @@
<!-- Settings Security and Panic -->
<string
name=
"security_settings_title"
>
Security
</string>
<string
name=
"pref_lock_title"
>
Screen
L
ock
</string>
<string
name=
"pref_lock_title"
>
Screen
l
ock
</string>
<string
name=
"pref_lock_summary"
>
Use the device\'s screen lock to protect Briar while signed in
</string>
<string
name=
"pref_lock_disabled_summary"
>
Set up a screen lock for your device to protect Briar while signed in
</string>
<string
name=
"pref_lock_timeout_title"
>
Screen Lock Inactivity Timeout
</string>
<!-- The %s placeholder is replaces with the following time spans, e.g. after 5 Minutes -->
<string
name=
"pref_lock_timeout_summary"
>
When not using Briar, automatically lock it %s
</string>
<string
name=
"pref_lock_timeout_1"
>
after 1 Minute
</string>
<string
name=
"pref_lock_timeout_5"
>
after 5 Minutes
</string>
<string
name=
"pref_lock_timeout_15"
>
after 15 Minutes
</string>
<string
name=
"pref_lock_timeout_30"
>
after 30 Minutes
</string>
<string
name=
"pref_lock_timeout_60"
>
after 1 Hour
</string>
<string
name=
"pref_lock_timeout_never"
>
never
</string>
<string
name=
"pref_lock_disabled_summary"
>
To use this feature, set up a screen lock for your device
</string>
<string
name=
"pref_lock_timeout_title"
>
Screen lock inactivity timeout
</string>
<!-- The %s placeholder is replaced with the following time spans, e.g. 5 Minutes, 1 Hour -->
<string
name=
"pref_lock_timeout_summary"
>
When not using Briar, automatically lock it after %s
</string>
<!-- Will be shown in a list of lock times. Should fit into the %s of "automatically lock it after %s" -->
<string
name=
"pref_lock_timeout_1"
>
1 minute
</string>
<!-- Will be shown in a list of lock times. Should fit into the %s of "automatically lock it after %s" -->
<string
name=
"pref_lock_timeout_5"
>
5 minutes
</string>
<!-- Will be shown in a list of lock times. Should fit into the %s of "automatically lock it after %s" -->
<string
name=
"pref_lock_timeout_15"
>
15 minutes
</string>
<!-- Will be shown in a list of lock times. Should fit into the %s of "automatically lock it after %s" -->
<string
name=
"pref_lock_timeout_30"
>
30 minutes
</string>
<!-- Will be shown in a list of lock times. Should fit into the %s of "automatically lock it after %s" -->
<string
name=
"pref_lock_timeout_60"
>
1 hour
</string>
<string
name=
"pref_lock_timeout_never"
>
Never
</string>
<string
name=
"pref_lock_timeout_never_summary"
>
Never lock Briar automatically
</string>
<string
name=
"change_password"
>
Change password
</string>
...
...
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