am 7f416631: Merge "Check feature bits before loading optional services" into klp-modular-dev

* commit '7f416631413e75a1756bd316a2e1906725d72f24':
  Check feature bits before loading optional services
This commit is contained in:
Adam Lesinski
2014-02-06 20:16:30 +00:00
committed by Android Git Automerger
17 changed files with 94 additions and 91 deletions

View File

@ -18,8 +18,6 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-subdir-Iaidl-files) LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-subdir-Iaidl-files)
LOCAL_JAVA_LIBRARIES := services
LOCAL_PACKAGE_NAME := Keyguard LOCAL_PACKAGE_NAME := Keyguard
LOCAL_CERTIFICATE := platform LOCAL_CERTIFICATE := platform

View File

@ -1,27 +1,23 @@
LOCAL_PATH:= $(call my-dir) LOCAL_PATH:= $(call my-dir)
# the java library # merge all required services into one jar
# ============================================================ # ============================================================
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_SRC_FILES := LOCAL_MODULE := services
# TODO: Move this to the product makefiles LOCAL_SRC_FILES := $(call all-java-files-under,java)
REQUIRED_SERVICES := core accessibility appwidget backup devicepolicy print
include $(patsubst %,$(LOCAL_PATH)/%/java/service.mk,$(REQUIRED_SERVICES)) LOCAL_STATIC_JAVA_LIBRARIES := \
services.core \
LOCAL_MODULE:= services services.accessibility \
services.appwidget \
LOCAL_JAVA_LIBRARIES := android.policy conscrypt telephony-common services.backup \
services.devicepolicy \
#LOCAL_PROGUARD_ENABLED := full services.print
#LOCAL_PROGUARD_FLAG_FILES := proguard.flags
include $(BUILD_JAVA_LIBRARY) include $(BUILD_JAVA_LIBRARY)
include $(BUILD_DROIDDOC)
# native library # native library
# ============================================================= # =============================================================

View File

@ -0,0 +1,10 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := services.accessibility
LOCAL_SRC_FILES += \
$(call all-java-files-under,java)
include $(BUILD_STATIC_JAVA_LIBRARY)

View File

@ -1,11 +0,0 @@
# Include only if the service is required
ifneq ($(findstring accessibility,$(REQUIRED_SERVICES)),)
SUB_DIR := accessibility/java
LOCAL_SRC_FILES += \
$(call all-java-files-under,$(SUB_DIR))
#DEFINED_SERVICES += com.android.server.accessibility.AccessibilityManagerService
endif

View File

@ -0,0 +1,10 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := services.appwidget
LOCAL_SRC_FILES += \
$(call all-java-files-under,java)
include $(BUILD_STATIC_JAVA_LIBRARY)

View File

@ -1,11 +0,0 @@
# Include only if the service is required
ifneq ($(findstring appwidget,$(REQUIRED_SERVICES)),)
SUB_DIR := appwidget/java
LOCAL_SRC_FILES += \
$(call all-java-files-under,$(SUB_DIR))
#DEFINED_SERVICES += com.android.server.appwidget.AppWidgetService
endif

View File

@ -0,0 +1,12 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := services.backup
LOCAL_SRC_FILES += \
$(call all-java-files-under,java)
LOCAL_JAVA_LIBRARIES := services.core
include $(BUILD_STATIC_JAVA_LIBRARY)

View File

@ -1,11 +0,0 @@
# Include only if the service is required
ifneq ($(findstring backup,$(REQUIRED_SERVICES)),)
SUB_DIR := backup/java
LOCAL_SRC_FILES += \
$(call all-java-files-under,$(SUB_DIR))
#DEFINED_SERVICES += com.android.server.backup.BackupManagerService
endif

14
services/core/Android.mk Normal file
View File

@ -0,0 +1,14 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := services.core
LOCAL_SRC_FILES += \
$(call all-java-files-under,java) \
java/com/android/server/EventLogTags.logtags \
java/com/android/server/am/EventLogTags.logtags
LOCAL_JAVA_LIBRARIES := android.policy telephony-common
include $(BUILD_STATIC_JAVA_LIBRARY)

View File

@ -50,7 +50,6 @@ import com.android.server.AppOpsService;
import com.android.server.AttributeCache; import com.android.server.AttributeCache;
import com.android.server.IntentResolver; import com.android.server.IntentResolver;
import com.android.server.ServiceThread; import com.android.server.ServiceThread;
import com.android.server.SystemServer;
import com.android.server.SystemService; import com.android.server.SystemService;
import com.android.server.Watchdog; import com.android.server.Watchdog;
import com.android.server.am.ActivityStack.ActivityState; import com.android.server.am.ActivityStack.ActivityState;

View File

@ -1,6 +0,0 @@
SUB_DIR := core/java
LOCAL_SRC_FILES += \
$(call all-java-files-under,$(SUB_DIR)) \
$(SUB_DIR)/com/android/server/EventLogTags.logtags \
$(SUB_DIR)/com/android/server/am/EventLogTags.logtags

View File

@ -0,0 +1,12 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := services.devicepolicy
LOCAL_SRC_FILES += \
$(call all-java-files-under,java)
LOCAL_JAVA_LIBRARIES := conscrypt
include $(BUILD_STATIC_JAVA_LIBRARY)

View File

@ -1,11 +0,0 @@
# Include only if the service is required
ifneq ($(findstring devicepolicy,$(REQUIRED_SERVICES)),)
SUB_DIR := devicepolicy/java
LOCAL_SRC_FILES += \
$(call all-java-files-under,$(SUB_DIR))
#DEFINED_SERVICES += com.android.server.devicepolicy.DevicePolicyManagerService
endif

View File

@ -52,7 +52,6 @@ import android.view.WindowManager;
import com.android.internal.R; import com.android.internal.R;
import com.android.internal.os.BinderInternal; import com.android.internal.os.BinderInternal;
import com.android.internal.os.SamplingProfilerIntegration; import com.android.internal.os.SamplingProfilerIntegration;
import com.android.server.accessibility.AccessibilityManagerService;
import com.android.server.accounts.AccountManagerService; import com.android.server.accounts.AccountManagerService;
import com.android.server.am.ActivityManagerService; import com.android.server.am.ActivityManagerService;
import com.android.server.am.BatteryStatsService; import com.android.server.am.BatteryStatsService;
@ -482,8 +481,8 @@ public final class SystemServer {
try { try {
Slog.i(TAG, "Accessibility Manager"); Slog.i(TAG, "Accessibility Manager");
ServiceManager.addService(Context.ACCESSIBILITY_SERVICE, ServiceManager.addService(Context.ACCESSIBILITY_SERVICE, (IBinder)
new AccessibilityManagerService(context)); getClass().getClassLoader().loadClass("com.android.server.accessibility.AccessibilityManagerService").getConstructor(Context.class).newInstance(context));
} catch (Throwable e) { } catch (Throwable e) {
reportWtf("starting Accessibility Manager", e); reportWtf("starting Accessibility Manager", e);
} }
@ -536,8 +535,10 @@ public final class SystemServer {
} }
try { try {
Slog.i(TAG, "Device Policy"); if (pm.hasSystemFeature("android.software.device_admin")) {
mSystemServiceManager.startServiceIfExists(DEVICE_POLICY_MANAGER_SERVICE_CLASS); mSystemServiceManager.startServiceIfExists(
DEVICE_POLICY_MANAGER_SERVICE_CLASS);
}
} catch (Throwable e) { } catch (Throwable e) {
reportWtf("starting DevicePolicyService", e); reportWtf("starting DevicePolicyService", e);
} }
@ -787,15 +788,17 @@ public final class SystemServer {
if (!disableNonCoreServices) { if (!disableNonCoreServices) {
try { try {
Slog.i(TAG, "Backup Service"); if (pm.hasSystemFeature("android.software.backup")) {
mSystemServiceManager.startServiceIfExists(BACKUP_MANAGER_SERVICE_CLASS); mSystemServiceManager.startServiceIfExists(BACKUP_MANAGER_SERVICE_CLASS);
}
} catch (Throwable e) { } catch (Throwable e) {
Slog.e(TAG, "Failure starting Backup Service", e); Slog.e(TAG, "Failure starting Backup Service", e);
} }
try { try {
Slog.i(TAG, "AppWidget Service"); if (pm.hasSystemFeature("android.software.app_widgets")) {
mSystemServiceManager.startServiceIfExists(APPWIDGET_SERVICE_CLASS); mSystemServiceManager.startServiceIfExists(APPWIDGET_SERVICE_CLASS);
}
} catch (Throwable e) { } catch (Throwable e) {
reportWtf("starting AppWidget Service", e); reportWtf("starting AppWidget Service", e);
} }
@ -855,7 +858,7 @@ public final class SystemServer {
} }
} }
if (!disableNonCoreServices && if (!disableNonCoreServices &&
context.getResources().getBoolean(R.bool.config_dreamsSupported)) { context.getResources().getBoolean(R.bool.config_dreamsSupported)) {
try { try {
Slog.i(TAG, "Dreams Service"); Slog.i(TAG, "Dreams Service");
@ -885,8 +888,9 @@ public final class SystemServer {
} }
try { try {
Slog.i(TAG, "Print Service"); if (pm.hasSystemFeature("android.software.print")) {
mSystemServiceManager.startServiceIfExists(PRINT_MANAGER_SERVICE_CLASS); mSystemServiceManager.startServiceIfExists(PRINT_MANAGER_SERVICE_CLASS);
}
} catch (Throwable e) { } catch (Throwable e) {
reportWtf("starting Print Service", e); reportWtf("starting Print Service", e);
} }

10
services/print/Android.mk Normal file
View File

@ -0,0 +1,10 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := services.print
LOCAL_SRC_FILES += \
$(call all-java-files-under,java)
include $(BUILD_STATIC_JAVA_LIBRARY)

View File

@ -52,7 +52,6 @@ import com.android.internal.R;
import com.android.internal.content.PackageMonitor; import com.android.internal.content.PackageMonitor;
import com.android.internal.os.BackgroundThread; import com.android.internal.os.BackgroundThread;
import com.android.server.SystemService; import com.android.server.SystemService;
import com.android.server.devicepolicy.DevicePolicyManagerService;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.PrintWriter; import java.io.PrintWriter;

View File

@ -1,11 +0,0 @@
# Include only if the service is required
ifneq ($(findstring print,$(REQUIRED_SERVICES)),)
SUB_DIR := print/java
LOCAL_SRC_FILES += \
$(call all-java-files-under,$(SUB_DIR))
#DEFINED_SERVICES += com.android.server.print.PrintManagerService
endif