Merge "Updates the cached service while the package re-enabling"

This commit is contained in:
TreeHugger Robot
2020-01-06 08:42:48 +00:00
committed by Android (Google) Code Review

View File

@@ -954,6 +954,35 @@ public abstract class AbstractMasterSystemService<M extends AbstractMasterSystem
onServicePackageRestartedLocked(userId);
}
@Override
public void onPackageModified(String packageName) {
if (verbose) Slog.v(mTag, "onPackageModified(): " + packageName);
final int userId = getChangingUserId();
final String serviceName = mServiceNameResolver.getDefaultServiceName(userId);
if (serviceName == null) {
return;
}
final ComponentName serviceComponentName =
ComponentName.unflattenFromString(serviceName);
if (serviceComponentName == null
|| !serviceComponentName.getPackageName().equals(packageName)) {
return;
}
// The default service package has changed, update the cached if the service
// exists but no active component.
final S service = peekServiceForUserLocked(userId);
if (service != null) {
final ComponentName componentName = service.getServiceComponentName();
if (componentName == null) {
if (verbose) Slog.v(mTag, "update cached");
updateCachedServiceLocked(userId);
}
}
}
private String getActiveServicePackageNameLocked() {
final int userId = getChangingUserId();
final S service = peekServiceForUserLocked(userId);