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

Commit 898c13df authored by Adam Lesinski's avatar Adam Lesinski
Browse files

Check feature bits before loading optional services

At startup, we check with PackageManager whether a system service is
available before attempting to load it. A system service is available
if its associated feature (similar to hardware features) is present.
This does not remove unavailable services from the compiled jar.

Change-Id: I13571805083aa4e65519a74acb52efd17b9fb3d7
parent df88d730
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-subdir-Iaidl-files)

LOCAL_JAVA_LIBRARIES := services

LOCAL_PACKAGE_NAME := Keyguard

LOCAL_CERTIFICATE := platform
+10 −14
Original line number Diff line number Diff line
LOCAL_PATH:= $(call my-dir)

# the java library
# merge all required services into one jar
# ============================================================
include $(CLEAR_VARS)

LOCAL_SRC_FILES :=

# TODO: Move this to the product makefiles
REQUIRED_SERVICES := core accessibility appwidget backup devicepolicy print

include $(patsubst %,$(LOCAL_PATH)/%/java/service.mk,$(REQUIRED_SERVICES))

LOCAL_MODULE := services

LOCAL_JAVA_LIBRARIES := android.policy conscrypt telephony-common
LOCAL_SRC_FILES := $(call all-java-files-under,java)

#LOCAL_PROGUARD_ENABLED := full
#LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_STATIC_JAVA_LIBRARIES := \
    services.core \
    services.accessibility \
    services.appwidget \
    services.backup \
    services.devicepolicy \
    services.print

include $(BUILD_JAVA_LIBRARY)

include $(BUILD_DROIDDOC)

# native library
# =============================================================

+10 −0
Original line number Diff line number Diff line
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)
+0 −11
Original line number Diff line number Diff line
# 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
+10 −0
Original line number Diff line number Diff line
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)
Loading