mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Use SystemClock.elapsedRealtime() instead of System.currentTimeMillis()
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
2c57e37097
commit
c612e2f547
4 changed files with 9 additions and 7 deletions
|
@ -24,6 +24,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.os.SystemClock;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
|
@ -102,7 +103,7 @@ public final class PassCodeManager {
|
|||
activity.startActivityForResult(i, PASSCODE_ACTIVITY);
|
||||
} else {
|
||||
if (!askedForPin && preferences.getLockTimestamp() != 0) {
|
||||
preferences.setLockTimestamp(System.currentTimeMillis());
|
||||
preferences.setLockTimestamp(SystemClock.elapsedRealtime());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.text.Html;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -57,7 +58,6 @@ import com.bumptech.glide.request.animation.GlideAnimation;
|
|||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.di.Injectable;
|
||||
import com.nextcloud.client.network.ClientFactory;
|
||||
import com.nextcloud.client.onboarding.FirstRunActivity;
|
||||
|
@ -71,7 +71,6 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
|
|||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.common.ExternalLink;
|
||||
import com.owncloud.android.lib.common.ExternalLinkType;
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
||||
import com.owncloud.android.lib.common.Quota;
|
||||
import com.owncloud.android.lib.common.UserInfo;
|
||||
import com.owncloud.android.lib.common.accounts.ExternalLinksOperation;
|
||||
|
@ -1435,7 +1434,7 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
@Override
|
||||
protected void onStop() {
|
||||
if (preferences.getLockTimestamp() != 0) {
|
||||
preferences.setLockTimestamp(System.currentTimeMillis());
|
||||
preferences.setLockTimestamp(SystemClock.elapsedRealtime());
|
||||
}
|
||||
EventBus.getDefault().unregister(this);
|
||||
super.onStop();
|
||||
|
|
|
@ -24,6 +24,7 @@ package com.owncloud.android.ui.activity;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
|
@ -239,7 +240,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
|
|||
if (ACTION_CHECK.equals(getIntent().getAction())) {
|
||||
if (checkPassCode()) {
|
||||
/// pass code accepted in request, user is allowed to access the app
|
||||
AppPreferencesImpl.fromContext(this).setLockTimestamp(System.currentTimeMillis());
|
||||
AppPreferencesImpl.fromContext(this).setLockTimestamp(SystemClock.elapsedRealtime());
|
||||
hideSoftKeyboard();
|
||||
finish();
|
||||
|
||||
|
@ -249,7 +250,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
|
|||
|
||||
} else if (ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) {
|
||||
if (checkPassCode()) {
|
||||
AppPreferencesImpl.fromContext(this).setLockTimestamp(System.currentTimeMillis());
|
||||
AppPreferencesImpl.fromContext(this).setLockTimestamp(SystemClock.elapsedRealtime());
|
||||
Intent resultIntent = new Intent();
|
||||
resultIntent.putExtra(KEY_CHECK_RESULT, true);
|
||||
setResult(RESULT_OK, resultIntent);
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.app.KeyguardManager;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.SystemClock;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
|
@ -53,7 +54,7 @@ public class RequestCredentialsActivity extends Activity {
|
|||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
AppPreferencesImpl.fromContext(this).setLockTimestamp(System.currentTimeMillis());
|
||||
AppPreferencesImpl.fromContext(this).setLockTimestamp(SystemClock.elapsedRealtime());
|
||||
finishWithResult(KEY_CHECK_RESULT_TRUE);
|
||||
} else if (resultCode == Activity.RESULT_CANCELED) {
|
||||
finishWithResult(KEY_CHECK_RESULT_CANCEL);
|
||||
|
|
Loading…
Reference in a new issue