Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 007d37bc authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents d89d8d3d 9376b90d
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -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);