Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b690f0d5 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Clean up user activity handling

- Only call userActivity in down touch event
- Use normal timeout when QS is open
- Clean up old code regarding user activity in Keyguard

Change-Id: I968eeed33fef44def37b68eb1ddc63f1a531ab35
parent e05a56bf
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -66,10 +66,6 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
    // mRunning and mServiceRunning.  I'd just rather wait to change that logic.
    private volatile boolean mIsRunning = false;

    // So the user has a consistent amount of time when brought to the backup method from Face
    // Unlock
    private final int BACKUP_LOCK_TIMEOUT = 5000;

    KeyguardSecurityCallback mKeyguardScreenCallback;

    /**
@@ -268,7 +264,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
                // When switching between portrait and landscape view while Face Unlock is running,
                // the screen will eventually go dark unless we poke the wakelock when Face Unlock
                // is restarted.
                mKeyguardScreenCallback.userActivity(0);
                mKeyguardScreenCallback.userActivity();

                int[] position;
                position = new int[2];
@@ -325,7 +321,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {

        mKeyguardScreenCallback.showBackupSecurity();
        stop();
        mKeyguardScreenCallback.userActivity(BACKUP_LOCK_TIMEOUT);
        mKeyguardScreenCallback.userActivity();
    }

    /**
@@ -347,7 +343,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
    void handlePokeWakelock(int millis) {
      PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
      if (powerManager.isScreenOn()) {
        mKeyguardScreenCallback.userActivity(millis);
        mKeyguardScreenCallback.userActivity();
      }
    }

+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        mCallback.userActivity(0);
        mCallback.userActivity();
        return false;
    }

+4 −5
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ import java.io.IOException;
 */
public class KeyguardAccountView extends LinearLayout implements KeyguardSecurityView,
        View.OnClickListener, TextWatcher {
    private static final int AWAKE_POKE_MILLIS = 30000;
    private static final String LOCK_PATTERN_PACKAGE = "com.android.settings";
    private static final String LOCK_PATTERN_CLASS = LOCK_PATTERN_PACKAGE + ".ChooseLockGeneric";

@@ -119,7 +118,7 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit

    public void onTextChanged(CharSequence s, int start, int before, int count) {
        if (mCallback != null) {
            mCallback.userActivity(AWAKE_POKE_MILLIS);
            mCallback.userActivity();
        }
    }

@@ -154,7 +153,7 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit
    }

    public void onClick(View v) {
        mCallback.userActivity(0);
        mCallback.userActivity();
        if (v == mOk) {
            asyncCheckPassword();
        }
@@ -258,7 +257,7 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit
    }

    private void asyncCheckPassword() {
        mCallback.userActivity(AWAKE_POKE_MILLIS);
        mCallback.userActivity();
        final String login = mLogin.getText().toString();
        final String password = mPassword.getText().toString();
        Account account = findIntendedAccount(login);
@@ -273,7 +272,7 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit
                new AccountManagerCallback<Bundle>() {
            public void run(AccountManagerFuture<Bundle> future) {
                try {
                    mCallback.userActivity(AWAKE_POKE_MILLIS);
                    mCallback.userActivity();
                    final Bundle result = future.getResult();
                    final boolean verified = result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT);
                    postOnCheckPasswordResult(verified);
+0 −3
Original line number Diff line number Diff line
@@ -26,7 +26,4 @@ public class KeyguardConstants {
     * be used temporarily for debugging.
     */
    public static final boolean DEBUG = false;

    /** Timeout used for key presses. */
    public static final int DIGIT_PRESS_WAKE_MILLIS = 5000;
}
+4 −4
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
        // Poke the wakelock any time the text is selected or modified
        mPasswordEntry.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                mCallback.userActivity(0); // TODO: customize timeout for text?
                mCallback.userActivity();
            }
        });

@@ -127,7 +127,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView

            public void afterTextChanged(Editable s) {
                if (mCallback != null) {
                    mCallback.userActivity(0);
                    mCallback.userActivity();
                }
            }
        });
@@ -141,7 +141,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
            imeOrDeleteButtonVisible = true;
            switchImeButton.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    mCallback.userActivity(0); // Leave the screen on a bit longer
                    mCallback.userActivity(); // Leave the screen on a bit longer
                    mImm.showInputMethodPicker();
                }
            });
@@ -247,7 +247,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        if (mCallback != null) {
            mCallback.userActivity(KeyguardConstants.DIGIT_PRESS_WAKE_MILLIS);
            mCallback.userActivity();
        }
    }

Loading