Fixing implicit app deactivation for apps loaded from disk.

Apps loaded from disk will be marked as having been
activated explicitly, which means they won't deactivate
implicitly when all dependent apps have been deactivated.

Change-Id: I831befdd26615b241da8fdbdb35d21359d3a8665
diff --git a/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java b/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
index eb3a3a6..2a45c09 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
@@ -243,6 +243,10 @@
         getApplicationNames().forEach(appName -> {
             Application app = loadFromDisk(appName);
             if (app != null && isActive(app.id().name())) {
+                // For now, apps loaded from disk will be marked as having been
+                // activated explicitly, which means they won't deactivate
+                // implicitly when all dependent apps have been deactivated.
+                requiredBy.put(app.id(), coreAppId);
                 activate(app.id(), false);
                 // TODO Load app permissions
             }