Move some system services to separate directories
Refactored the directory structure so that services can be optionally excluded. This is step 1. Will be followed by another change that makes it possible to remove services from the build. Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
This commit is contained in:
@ -184,7 +184,7 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/effects/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/framework-res_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/print/IPrintClient.*)
|
||||
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/services_intermediates)
|
||||
# ************************************************
|
||||
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
|
||||
# ************************************************
|
||||
|
@ -177,7 +177,8 @@ public final class AccessibilityManager {
|
||||
userId = UserHandle.myUserId();
|
||||
}
|
||||
IBinder iBinder = ServiceManager.getService(Context.ACCESSIBILITY_SERVICE);
|
||||
IAccessibilityManager service = IAccessibilityManager.Stub.asInterface(iBinder);
|
||||
IAccessibilityManager service = iBinder == null
|
||||
? null : IAccessibilityManager.Stub.asInterface(iBinder);
|
||||
sInstance = new AccessibilityManager(context, service, userId);
|
||||
}
|
||||
}
|
||||
@ -197,10 +198,14 @@ public final class AccessibilityManager {
|
||||
mHandler = new MyHandler(context.getMainLooper());
|
||||
mService = service;
|
||||
mUserId = userId;
|
||||
|
||||
if (mService == null) {
|
||||
mIsEnabled = false;
|
||||
}
|
||||
try {
|
||||
final int stateFlags = mService.addClient(mClient, userId);
|
||||
setState(stateFlags);
|
||||
if (mService != null) {
|
||||
final int stateFlags = mService.addClient(mClient, userId);
|
||||
setState(stateFlags);
|
||||
}
|
||||
} catch (RemoteException re) {
|
||||
Log.e(LOG_TAG, "AccessibilityManagerService is dead", re);
|
||||
}
|
||||
@ -322,14 +327,16 @@ public final class AccessibilityManager {
|
||||
public List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList() {
|
||||
List<AccessibilityServiceInfo> services = null;
|
||||
try {
|
||||
services = mService.getInstalledAccessibilityServiceList(mUserId);
|
||||
if (DEBUG) {
|
||||
Log.i(LOG_TAG, "Installed AccessibilityServices " + services);
|
||||
if (mService != null) {
|
||||
services = mService.getInstalledAccessibilityServiceList(mUserId);
|
||||
if (DEBUG) {
|
||||
Log.i(LOG_TAG, "Installed AccessibilityServices " + services);
|
||||
}
|
||||
}
|
||||
} catch (RemoteException re) {
|
||||
Log.e(LOG_TAG, "Error while obtaining the installed AccessibilityServices. ", re);
|
||||
}
|
||||
return Collections.unmodifiableList(services);
|
||||
return services != null ? Collections.unmodifiableList(services) : Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -349,14 +356,16 @@ public final class AccessibilityManager {
|
||||
int feedbackTypeFlags) {
|
||||
List<AccessibilityServiceInfo> services = null;
|
||||
try {
|
||||
services = mService.getEnabledAccessibilityServiceList(feedbackTypeFlags, mUserId);
|
||||
if (DEBUG) {
|
||||
Log.i(LOG_TAG, "Installed AccessibilityServices " + services);
|
||||
if (mService != null) {
|
||||
services = mService.getEnabledAccessibilityServiceList(feedbackTypeFlags, mUserId);
|
||||
if (DEBUG) {
|
||||
Log.i(LOG_TAG, "Installed AccessibilityServices " + services);
|
||||
}
|
||||
}
|
||||
} catch (RemoteException re) {
|
||||
Log.e(LOG_TAG, "Error while obtaining the installed AccessibilityServices. ", re);
|
||||
}
|
||||
return Collections.unmodifiableList(services);
|
||||
return services != null ? Collections.unmodifiableList(services) : Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -466,6 +475,9 @@ public final class AccessibilityManager {
|
||||
*/
|
||||
public int addAccessibilityInteractionConnection(IWindow windowToken,
|
||||
IAccessibilityInteractionConnection connection) {
|
||||
if (mService == null) {
|
||||
return View.NO_ID;
|
||||
}
|
||||
try {
|
||||
return mService.addAccessibilityInteractionConnection(windowToken, connection, mUserId);
|
||||
} catch (RemoteException re) {
|
||||
@ -482,7 +494,9 @@ public final class AccessibilityManager {
|
||||
*/
|
||||
public void removeAccessibilityInteractionConnection(IWindow windowToken) {
|
||||
try {
|
||||
mService.removeAccessibilityInteractionConnection(windowToken);
|
||||
if (mService != null) {
|
||||
mService.removeAccessibilityInteractionConnection(windowToken);
|
||||
}
|
||||
} catch (RemoteException re) {
|
||||
Log.e(LOG_TAG, "Error while removing an accessibility interaction connection. ", re);
|
||||
}
|
||||
|
45
services/Android.mk
Normal file
45
services/Android.mk
Normal file
@ -0,0 +1,45 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
# the java library
|
||||
# ============================================================
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES :=
|
||||
|
||||
# TODO: Move this to the product makefiles
|
||||
REQUIRED_SERVICES := core appwidget backup devicepolicy accessibility print
|
||||
|
||||
include $(patsubst %,$(LOCAL_PATH)/%/java/service.mk,$(REQUIRED_SERVICES))
|
||||
|
||||
LOCAL_MODULE:= services
|
||||
|
||||
LOCAL_JAVA_LIBRARIES := android.policy conscrypt telephony-common
|
||||
|
||||
#LOCAL_PROGUARD_ENABLED := full
|
||||
#LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
||||
|
||||
include $(BUILD_JAVA_LIBRARY)
|
||||
|
||||
include $(BUILD_DROIDDOC)
|
||||
|
||||
# native library
|
||||
# =============================================================
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES :=
|
||||
LOCAL_SHARED_LIBRARIES :=
|
||||
|
||||
# include all the jni subdirs to collect their sources
|
||||
include $(wildcard $(LOCAL_PATH)/*/jni/Android.mk)
|
||||
|
||||
LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES
|
||||
|
||||
ifeq ($(WITH_MALLOC_LEAK_CHECK),true)
|
||||
LOCAL_CFLAGS += -DMALLOC_LEAK_CHECK
|
||||
endif
|
||||
|
||||
LOCAL_MODULE:= libandroid_servers
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
11
services/accessibility/java/service.mk
Normal file
11
services/accessibility/java/service.mk
Normal file
@ -0,0 +1,11 @@
|
||||
# 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
|
11
services/appwidget/java/service.mk
Normal file
11
services/appwidget/java/service.mk
Normal file
@ -0,0 +1,11 @@
|
||||
# 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
|
11
services/backup/java/service.mk
Normal file
11
services/backup/java/service.mk
Normal file
@ -0,0 +1,11 @@
|
||||
# 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
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user