New API for getting enabledcomponent

Bluetooth can no longer call SystemConfig and need to use the manager.

Bug: 190440540
Bug: 199279027
Test: Manual
Tag: #refactor
Change-Id: I065ab407c83cd2edf2244e4170496b0979ac562c
This commit is contained in:
wescande
2021-09-03 12:57:46 +02:00
committed by William Escande
parent 730b6cfbc1
commit 29dbede144
4 changed files with 40 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import static java.util.stream.Collectors.toMap;
import android.Manifest;
import android.content.Context;
import android.os.ISystemConfig;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.SparseArray;
@@ -84,6 +85,21 @@ public class SystemConfigService extends SystemService {
}
return ArrayUtils.convertToIntArray(uids);
}
@Override
public List<String> getEnabledComponentOverrides(String packageName) {
ArrayMap<String, Boolean> systemComponents = SystemConfig.getInstance()
.getComponentsEnabledStates(packageName);
List<String> enabledComponent = new ArrayList<>();
if (systemComponents != null) {
for (Map.Entry<String, Boolean> entry : systemComponents.entrySet()) {
if (Boolean.TRUE.equals(entry.getValue())) {
enabledComponent.add(entry.getKey());
}
}
}
return enabledComponent;
}
};
public SystemConfigService(Context context) {