Skip to content

Commit

Permalink
[Refactor] Bypass screen-lock if auth is supplied
Browse files Browse the repository at this point in the history
Fixes issues with executing tasks from third-party applications.

Signed-off-by: Muntashir Al-Islam <muntashirakon@riseup.net>
  • Loading branch information
MuntashirAkon committed Sep 14, 2024
1 parent ab9088c commit ae2c23b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public abstract class BaseActivity extends AppCompatActivity {
}
}};

public static final String EXTRA_AUTH = "auth";

@Nullable
private AlertDialog mAlertDialog;
@Nullable
Expand Down Expand Up @@ -231,7 +233,17 @@ private void ensureSecurityAndModeOfOp() {
handleMigrationAndModeOfOp();
return;
}
Log.d(TAG, "Security enabled.");
if (getIntent().hasExtra(EXTRA_AUTH)) {
Log.i(TAG, "Screen lock-bypass enabled.");
// Check for auth
String auth = getIntent().getStringExtra(EXTRA_AUTH);
if (AuthManager.getKey().equals(auth)) {
// Auth successful
handleMigrationAndModeOfOp();
return;
} // else // Invalid authorization key, fallback to security
}
Log.i(TAG, "Screen lock enabled.");
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
if (keyguardManager.isKeyguardSecure()) {
// Screen lock enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import io.github.muntashirakon.AppManager.profiles.ProfileApplierActivity;

public class AuthFeatureDemultiplexer extends BaseActivity {
public static final String EXTRA_AUTH = "auth";
public static final String EXTRA_FEATURE = "feature";

@Override
Expand Down

0 comments on commit ae2c23b

Please sign in to comment.