diff options
author | Adnan Begovic <adnan@cyngn.com> | 2015-05-05 17:37:05 -0700 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-05-12 17:40:49 -0700 |
commit | 37fc76fe96174402cdfbf02cf228639083c26bf7 (patch) | |
tree | ee77e9ce89f57e6e9f2f75a78f944d2336b92efd | |
parent | 8206b1352b28f06b451d7db58879b28bead547c4 (diff) | |
download | vendor_cmsdk-37fc76fe96174402cdfbf02cf228639083c26bf7.zip vendor_cmsdk-37fc76fe96174402cdfbf02cf228639083c26bf7.tar.gz vendor_cmsdk-37fc76fe96174402cdfbf02cf228639083c26bf7.tar.bz2 |
CMSDK: Create cyanogenmod platform resource package.
org.cyanogenmod.platform-res provides resources that,
if public, are globally accessible.
This allows us to declare public and internal permissions as
well as reference permissions declared by the android framework
core
Change-Id: Ia7d541f4b403585f7479ecd87895987b8471005b
-rw-r--r-- | Android.mk | 39 | ||||
-rw-r--r-- | cm/lib/main/java/org/cyanogenmod/platform/internal/CMStatusBarManagerService.java | 6 | ||||
-rw-r--r-- | cm/res/Android.mk | 39 | ||||
-rw-r--r-- | cm/res/AndroidManifest.xml | 45 | ||||
-rw-r--r-- | cm/res/res/values/cm_strings.xml | 29 | ||||
-rw-r--r-- | cm/res/res/values/cm_symbols.xml | 23 | ||||
-rw-r--r-- | tests/Android.mk | 15 |
7 files changed, 186 insertions, 10 deletions
@@ -11,9 +11,18 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - LOCAL_PATH := $(call my-dir) +# We have a special case here where we build the library's resources +# independently from its code, so we need to find where the resource +# class source got placed in the course of building the resources. +# Thus, the magic here. +# Also, this module cannot depend directly on the R.java file; if it +# did, the PRIVATE_* vars for R.java wouldn't be guaranteed to be correct. +# Instead, it depends on the R.stamp file, which lists the corresponding +# R.java file as a prerequisite. +cm_platform_res := APPS/org.cyanogenmod.platform-res_intermediates/src + # The CyanogenMod Platform Framework Library # ============================================================ include $(CLEAR_VARS) @@ -23,12 +32,13 @@ library_src := cm/lib/main/java LOCAL_MODULE := org.cyanogenmod.platform LOCAL_MODULE_TAGS := optional -LOCAL_JAVA_LIBRARIES := services -LOCAL_REQUIRED_MODULES := services + +LOCAL_JAVA_LIBRARIES := \ + services LOCAL_SRC_FILES := \ - $(call all-java-files-under, $(cyanogenmod_app_src)) \ - $(call all-java-files-under, $(library_src)) + $(call all-java-files-under, $(cyanogenmod_app_src)) \ + $(call all-java-files-under, $(library_src)) ## READ ME: ######################################################## ## @@ -41,13 +51,26 @@ LOCAL_SRC_FILES := \ ## ## READ ME: ######################################################## LOCAL_SRC_FILES += \ - $(call all-Iaidl-files-under, $(cyanogemod_app_src)) + $(call all-Iaidl-files-under, $(cyanogenmod_app_src)) + +LOCAL_INTERMEDIATE_SOURCES := \ + $(cm_platform_res)/cyanogenmod/R.java \ + $(cm_platform_res)/cyanogenmod/Manifest.java \ + $(cm_platform_res)/org/cyanogenmod/platform/internal/R.java # Include aidl files from cyanogenmod.app namespace as well as internal src aidl files LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/src/java include $(BUILD_JAVA_LIBRARY) -framework_module := $(LOCAL_INSTALLED_MODULE) +cm_framework_module := $(LOCAL_INSTALLED_MODULE) + +# Make sure that R.java and Manifest.java are built before we build +# the source for this library. +cm_framework_res_R_stamp := \ + $(call intermediates-dir-for,APPS,org.cyanogenmod.platform-res,,COMMON)/src/R.stamp +$(full_classes_compiled_jar): $(cm_framework_res_R_stamp) + +$(cm_framework_module): | $(dir $(cm_framework_module))org.cyanogenmod.platform-res.apk cm_framework_built := $(call java-lib-deps, org.cyanogenmod.platform) @@ -122,6 +145,8 @@ LOCAL_DROIDDOC_OPTIONS := \ $(full_target): $(cm_framework_built) $(gen) include $(BUILD_DROIDDOC) +include $(call first-makefiles-under,$(LOCAL_PATH)) + # Cleanup temp vars # =========================================================== cmplat.docs.src_files := diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/CMStatusBarManagerService.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/CMStatusBarManagerService.java index 433238a..6d9693c 100644 --- a/cm/lib/main/java/org/cyanogenmod/platform/internal/CMStatusBarManagerService.java +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/CMStatusBarManagerService.java @@ -45,7 +45,7 @@ import org.cyanogenmod.internal.statusbar.IStatusBarCustomTileHolder; import java.util.ArrayList; -import com.android.internal.R; +import org.cyanogenmod.platform.internal.R; /** * Internal service which manages interactions with system ui elements @@ -338,13 +338,13 @@ public class CMStatusBarManagerService extends SystemService { private void enforceCustomTilePublish() { mContext.enforceCallingOrSelfPermission( - android.Manifest.permission.PUBLISH_CUSTOM_TILE, + cyanogenmod.Manifest.permission.PUBLISH_CUSTOM_TILE, "StatusBarManagerService"); } private void enforceBindCustomTileListener() { mContext.enforceCallingOrSelfPermission( - android.Manifest.permission.BIND_CUSTOM_TILE_LISTENER_SERVICE, + cyanogenmod.Manifest.permission.BIND_CUSTOM_TILE_LISTENER_SERVICE, "StatusBarManagerService"); } diff --git a/cm/res/Android.mk b/cm/res/Android.mk new file mode 100644 index 0000000..b597d49 --- /dev/null +++ b/cm/res/Android.mk @@ -0,0 +1,39 @@ +# +# Copyright (C) 2015 The CyanogenMod Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_PACKAGE_NAME := org.cyanogenmod.platform-res +LOCAL_CERTIFICATE := platform +LOCAL_AAPT_FLAGS := --auto-add-overlay + +LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, res) + +# Tell aapt to create "extending (non-application)" resource IDs, +# since these resources will be used by many apps. +LOCAL_AAPT_FLAGS := -x + +LOCAL_MODULE_TAGS := optional + +# Install this alongside the libraries. +LOCAL_MODULE_PATH := $(TARGET_OUT_JAVA_LIBRARIES) + +# Create package-export.apk, which other packages can use to get +# PRODUCT-agnostic resource data like IDs and type definitions. +LOCAL_EXPORT_PACKAGE_RESOURCES := true + +include $(BUILD_PACKAGE) diff --git a/cm/res/AndroidManifest.xml b/cm/res/AndroidManifest.xml new file mode 100644 index 0000000..69b15f2 --- /dev/null +++ b/cm/res/AndroidManifest.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright 2015, CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="cyanogenmod" + coreApp="true" android:sharedUserId="android.uid.system" + android:sharedUserLabel="@string/cyanogenmod_system_label"> + + <!-- Must be required by an, to ensure that only the system can bind to it. + @hide --> + <permission android:name="cyanogenmod.permission.BIND_CUSTOM_TILE_LISTENER_SERVICE" + android:label="@string/permlab_bindCustomTileListenerService" + android:description="@string/permdesc_bindCustomTileListenerService" + android:protectionLevel="signature" /> + + <!-- Allows a 3rd party application to publish or unpublish a quick settings tile --> + <permission android:name="cyanogenmod.permission.PUBLISH_CUSTOM_TILE" + android:label="@string/permlab_publishCustomTile" + android:description="@string/permdesc_publishCustomTile" + android:protectionLevel="normal" /> + + <application android:process="system" + android:persistent="true" + android:hasCode="false" + android:label="@string/cyanogenmod_system_label" + android:allowClearUserData="false" + android:killAfterRestore="false" + android:supportsRtl="true"/> + +</manifest> diff --git a/cm/res/res/values/cm_strings.xml b/cm/res/res/values/cm_strings.xml new file mode 100644 index 0000000..a961906 --- /dev/null +++ b/cm/res/res/values/cm_strings.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Label for the CyanogenMod system components when they are shown to the user. --> + <string name="cyanogenmod_system_label">CyanogenMod System</string> + + <string name="permlab_publishCustomTile">create a custom tile within qs tiles</string> + <string name="permdesc_publishCustomTile">Allows an app to publish a quick settings tile</string> + + <string name="permlab_bindCustomTileListenerService">bind to a custom tile listener service</string> + <string name="permdesc_bindCustomTileListenerService">Allows the holder to bind to the top-level interface of a custom tile listener service.</string> + + <!-- Label to show for a service that is running because it is observing the user's custom tiles. --> + <string name="custom_tile_listener_binding_label">Custom tile listener</string> +</resources>
\ No newline at end of file diff --git a/cm/res/res/values/cm_symbols.xml b/cm/res/res/values/cm_symbols.xml new file mode 100644 index 0000000..664c203 --- /dev/null +++ b/cm/res/res/values/cm_symbols.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2015 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <!-- We don't want to publish private symbols in cyanogenmod.R as part of the + SDK. Instead, put them here. --> + <private-symbols package="org.cyanogenmod.platform.internal" /> + + <java-symbol type="string" name="custom_tile_listener_binding_label" /> +</resources> diff --git a/tests/Android.mk b/tests/Android.mk index 382e9cf..c6d67b5 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -1,3 +1,18 @@ +# +# Copyright (C) 2015 The CyanogenMod Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) |