Do not initialize the weaver service at boot
It can be initialized when needed. Some weaver HAL implementations aren't ready that early, so we don't want to try and initialize it then. Test: atest com.android.server.locksettings Bug: 252760591 Change-Id: I6eba59cc64025de496bdf91f9aa5eff53a515143
This commit is contained in:
@@ -814,7 +814,6 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
.hasSystemFeature(PackageManager.FEATURE_SECURE_LOCK_SCREEN);
|
.hasSystemFeature(PackageManager.FEATURE_SECURE_LOCK_SCREEN);
|
||||||
migrateOldData();
|
migrateOldData();
|
||||||
getGateKeeperService();
|
getGateKeeperService();
|
||||||
mSpManager.initWeaverService();
|
|
||||||
getAuthSecretHal();
|
getAuthSecretHal();
|
||||||
mDeviceProvisionedObserver.onSystemReady();
|
mDeviceProvisionedObserver.onSystemReady();
|
||||||
|
|
||||||
|
|||||||
@@ -499,40 +499,35 @@ class SyntheticPasswordManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void initWeaverService() {
|
private synchronized boolean isWeaverAvailable() {
|
||||||
if (mWeaver != null) {
|
if (mWeaver != null) {
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re-initialize weaver in case there was a transient error preventing access to it.
|
||||||
IWeaver weaver = getWeaverService();
|
IWeaver weaver = getWeaverService();
|
||||||
if (weaver == null) {
|
if (weaver == null) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the config
|
final WeaverConfig weaverConfig;
|
||||||
WeaverConfig weaverConfig = null;
|
|
||||||
try {
|
try {
|
||||||
weaverConfig = weaver.getConfig();
|
weaverConfig = weaver.getConfig();
|
||||||
} catch (RemoteException | ServiceSpecificException e) {
|
} catch (RemoteException | ServiceSpecificException e) {
|
||||||
Slog.e(TAG, "Failed to get weaver config", e);
|
Slog.e(TAG, "Failed to get weaver config", e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (weaverConfig == null || weaverConfig.slots <= 0) {
|
if (weaverConfig == null || weaverConfig.slots <= 0) {
|
||||||
Slog.e(TAG, "Failed to initialize weaver config");
|
Slog.e(TAG, "Invalid weaver config");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mWeaver = weaver;
|
mWeaver = weaver;
|
||||||
mWeaverConfig = weaverConfig;
|
mWeaverConfig = weaverConfig;
|
||||||
mPasswordSlotManager.refreshActiveSlots(getUsedWeaverSlots());
|
mPasswordSlotManager.refreshActiveSlots(getUsedWeaverSlots());
|
||||||
Slog.i(TAG, "Weaver service initialized");
|
Slog.i(TAG, "Weaver service initialized");
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized boolean isWeaverAvailable() {
|
return true;
|
||||||
if (mWeaver == null) {
|
|
||||||
//Re-initializing weaver in case there was a transient error preventing access to it.
|
|
||||||
initWeaverService();
|
|
||||||
}
|
|
||||||
return mWeaver != null && mWeaverConfig.slots > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -119,6 +119,5 @@ public class MockSyntheticPasswordManager extends SyntheticPasswordManager {
|
|||||||
|
|
||||||
public void enableWeaver() {
|
public void enableWeaver() {
|
||||||
mWeaverService = new MockWeaverService();
|
mWeaverService = new MockWeaverService();
|
||||||
initWeaverService();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user