Loading core/java/com/android/internal/widget/LockPatternChecker.java +31 −0 Original line number Diff line number Diff line Loading @@ -2,13 +2,22 @@ package com.android.internal.widget; import android.annotation.NonNull; import android.os.AsyncTask; import android.os.Process; import android.util.Log; import com.android.internal.widget.LockPatternUtils.RequestThrottledException; import static com.android.internal.widget.flags.Flags.runCheckCredentialWithHigherPriority; /** * Helper class to check/verify PIN/Password/Pattern asynchronously. */ public final class LockPatternChecker { private static final String TAG = "LockPatternChecker"; private static final int INVALID_PRIORITY = -21; /** * Interface for a callback to be invoked after security check. */ Loading Loading @@ -106,11 +115,33 @@ public final class LockPatternChecker { @Override protected Boolean doInBackground(Void... args) { int originalPriority = INVALID_PRIORITY; try { if (runCheckCredentialWithHigherPriority()) { originalPriority = Process.getThreadPriority(Process.myTid()); try { Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND); } catch (SecurityException e) { Log.e(TAG, "Failed to boost checkCredential thread priority to " + "priority display", e); } } return utils.checkCredential(credentialCopy, userId, callback::onEarlyMatched); } catch (RequestThrottledException ex) { mThrottleTimeout = ex.getTimeoutMs(); return false; } finally { if (runCheckCredentialWithHigherPriority() && originalPriority != INVALID_PRIORITY) { try { Process.setThreadPriority(originalPriority); } catch (SecurityException e) { Log.e(TAG, "Failed to restore checkCredential thread priority to " + "original priority", e); } } } } Loading core/java/com/android/internal/widget/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -7,3 +7,10 @@ flag { description: "Feature flag for changing the default of hiding the last interacted symbol when a physical input device is present" bug: "339270220" } flag { name: "run_check_credential_with_higher_priority" namespace: "wear_system_health" description: "Feature flag for changing the priority of the check credential task" bug: "407716215" } Loading
core/java/com/android/internal/widget/LockPatternChecker.java +31 −0 Original line number Diff line number Diff line Loading @@ -2,13 +2,22 @@ package com.android.internal.widget; import android.annotation.NonNull; import android.os.AsyncTask; import android.os.Process; import android.util.Log; import com.android.internal.widget.LockPatternUtils.RequestThrottledException; import static com.android.internal.widget.flags.Flags.runCheckCredentialWithHigherPriority; /** * Helper class to check/verify PIN/Password/Pattern asynchronously. */ public final class LockPatternChecker { private static final String TAG = "LockPatternChecker"; private static final int INVALID_PRIORITY = -21; /** * Interface for a callback to be invoked after security check. */ Loading Loading @@ -106,11 +115,33 @@ public final class LockPatternChecker { @Override protected Boolean doInBackground(Void... args) { int originalPriority = INVALID_PRIORITY; try { if (runCheckCredentialWithHigherPriority()) { originalPriority = Process.getThreadPriority(Process.myTid()); try { Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND); } catch (SecurityException e) { Log.e(TAG, "Failed to boost checkCredential thread priority to " + "priority display", e); } } return utils.checkCredential(credentialCopy, userId, callback::onEarlyMatched); } catch (RequestThrottledException ex) { mThrottleTimeout = ex.getTimeoutMs(); return false; } finally { if (runCheckCredentialWithHigherPriority() && originalPriority != INVALID_PRIORITY) { try { Process.setThreadPriority(originalPriority); } catch (SecurityException e) { Log.e(TAG, "Failed to restore checkCredential thread priority to " + "original priority", e); } } } } Loading
core/java/com/android/internal/widget/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -7,3 +7,10 @@ flag { description: "Feature flag for changing the default of hiding the last interacted symbol when a physical input device is present" bug: "339270220" } flag { name: "run_check_credential_with_higher_priority" namespace: "wear_system_health" description: "Feature flag for changing the priority of the check credential task" bug: "407716215" }