Skip to content

Commit

Permalink
Do not require screenlock on ChromeOS for passwords sync
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyBarabash committed Dec 23, 2024
1 parent 7ad77ca commit fd01a46
Showing 1 changed file with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.chromium.chrome.browser.sync.settings;

import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
Expand All @@ -27,9 +28,7 @@
import java.util.Timer;
import java.util.TimerTask;

/**
* See org.brave.bytecode.BraveManageSyncSettingsClassAdapter
*/
/** See org.brave.bytecode.BraveManageSyncSettingsClassAdapter */
public class BraveManageSyncSettings extends ManageSyncSettings {
private static final String TAG = "BMSS";

Expand All @@ -49,6 +48,9 @@ public class BraveManageSyncSettings extends ManageSyncSettings {
private static final String VERBOSE_SYNC_PASSWORDS_PREF_COMMAND_LINE_KEY =
"verbose_sync_passwords_pref";

public static final String ARC_FEATURE = "org.chromium.arc";
public static final String ARC_DEVICE_MANAGEMENT_FEATURE = "org.chromium.arc.device_management";

private void verboseIfEnabled(String message) {
if (!mVerboseSyncPasswordsPref) {
return;
Expand Down Expand Up @@ -105,8 +107,19 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, String root
mPrefSyncPasswords = findPreference(PREF_SYNC_PASSWORDS);
assert mPrefSyncPasswords != null : "Something has changed in the upstream!";

overrideWithAuthConfirmationSyncPasswords();
overrideWithAuthConfirmationSyncEverything();
// We cannot require Android screenlock if browser runs at ChromeOS
// Google App Runtime emulator, because it is managed by ChromeOS and
// not by the Android subsystem
if (!isRunningOnChromeOS()) {
overrideWithAuthConfirmationSyncPasswords();
overrideWithAuthConfirmationSyncEverything();
}
}

private static boolean isRunningOnChromeOS() {
PackageManager pm = ContextUtils.getApplicationContext().getPackageManager();
return pm.hasSystemFeature(ARC_FEATURE)
|| pm.hasSystemFeature(ARC_DEVICE_MANAGEMENT_FEATURE);
}

private void showScreenLockToast() {
Expand Down

0 comments on commit fd01a46

Please sign in to comment.