diff --git a/CHANGELOG.mkdn b/CHANGELOG.mkdn index 8ac5532f..de9967ff 100644 --- a/CHANGELOG.mkdn +++ b/CHANGELOG.mkdn @@ -175,13 +175,161 @@ Galaxy Note 2 (N7100): CyanogenMod =============== -Visit http://github.com/CyanogenMod for full changelogs and git access. +Visit http://github.com/CyanogenMod for full source and git access. Visit http://review.cyanogenmod.org for our Gerrit instance. CHANGELOG (notable new features) --------- +### 13.0 ZNH5Y +* Common: Android 6.0.1 (Google) +* Android Security Bulletin - August 1st update +* Wi-Fi Tethering – automatically turn off hotspot after X minutes of inactivity +* Profiles – add notification light controls +* Do Not Disturb/Priority Mode – add notification light controls +* Privacy Guard/App data usage – Restrict apps to Wi-Fi or Cellular data only or block all internet access, per app +* Bluetooth Devices battery support +* Lockscreen Wallpaper picker makes its return +* Lockscreen Weather and new Weather plug in support +* Lockscreen Blur support (on a per device basis) and the ability to disable the effect +* Live Lockscreen support +* New LiveDisplay hardware enhancements and API +* Snap Camera (per device basis) +* Gello Browser (per device basis) +* Lots of translations +* Cyanogen Apps support (x86 not supported yet) +* Additional CM SDK APIs +* Security fixes galore + +### 13.0 ZNH0E +* Common: Android 6.0.1 (Google) +* Android Security Bulletin - March 7th update +* Settings > Build date - Triple tap to access demo mode +* Settings > Memory - New screen to show memory usage over a selected period of time +* Protected Apps - New folder UX, fingerprint support, enhanced ability to restrict access +* New SMS/MMS application + +### 12.1 YOG4PAO3 +* Common: Android 5.1.1 (Google) +* Android Security Bulletin – October 5th update + +### 12.1 YOG4PAO2 +* Common: Android 5.1.1 (Google) +* New Devices: Andromax Q (rendang), Galaxy S5 China (kltechn), Galaxy S5 Duos (klteduos), Galaxy S5 Duos China (kltechnduo) +* IMAP idle support +* SDK v1 release +* Stagefright security fixes + +### 12.0 +* Common: Android 5.0 (Google) + +### 11.0.0 M12 +* Common: Android 4.4.4 (Google) +* patches against POODLE vulnerability in SSLv3 +* Multi-sim improvements throughout the OS experience + +### 11.0.0 M11 +* Common: Android 4.4.4 (Google) +* New Devices: Galaxy S4 Active (jactivelte), Galaxy S4 SK I-9506 (ks01lte), Galaxy S5 GSM (klte), Galaxy Tab 10.1 (picassowifi), Galaxy Player 4.0 (ypg1) +* Re-introduce Samsung Galaxy Relay 4G (apexqtmo) support +* Fix signal strength showing ’2147483647′ on certain devices +* Frameworks & Core Apps: CAF and other upstream updates +* Lockscreen: Do not play sounds while a phone call is active & MSIM updates +* Frameworks: Add base & MSIM APIs for SEEK (Secure Element Evaluation Kit) support +* Frameworks: Fix volume button changing two ‘steps’ per click +* Frameworks: Add ‘Screen Off’ action for double-tap/long-press configuration options +* Show devices connected to your WiFi (tethering) Hotspot +* Fix bug related to ‘switch to last app’ action while in Recents view +* Fix Navigation Bar arrow keys in RTL locales +* Translations updates from CyanogenMod CrowdIn team +* Adjustments to ‘Glove Mode’ (High Touch Sensitivity) +* APN Updates for various regions +* Camera: Add support for all available Slow Shutter speeds (hardware dependent); Improve shutter button +* Dialer/InCallUI: Fix smartcover always showing answer fragment +* LG G2: Address GPS and NFC issues +* Base support for HTC Desire 816 & HTC One Mini 2 (pending nightlies) +* Various security updates +* General bug fixes + +### 11.0.0 M10 +* Common: Android 4.4.4 (Google) +* New Devices: Galaxy S5 Sprint (kltespr) +* Split out Note 3 into GSM (hlte), Sprint (hltespr) and Verizon (hltevzw) +* Refactor moto_msm8960dt as 'ghost' for Moto X 2013 +* Drop support for obake, toro, toroplus +* Theme Engine: Themes support for additional UI elements +* Frameworks & Core Apps: CAF and other upstream updates +* Settings: Add scramble pin feature +* Frameworks: Long press recent apps to switch to last used app +* Settings: Add soft reboot option +* Add smart cover support +* Add glove mode support +* Add bug reporter and crash log uploader +* Multisim updates +* General bug fixes +* ANT+ Support for various hardware +* Privacy Guard: Control NFC permissions + +### 11.0.0 M9 +* Common: Android 4.4.4 (Google) +* New Devices: Sony Xperia Z2 Tablets (castor); HTC One (m8) +* Theme Engine: Themes support for additional UI elements +* Lockscreen: Allow doubletap to sleep when using secure keyguard +* Settings: Safe Headset Volume – prompt when interfering with 3rd party device (Jawbone, Square, etc) +* Settings: Center clock support +* Settings: Proximity Wake-Up support +* Settings: Spam notification filtering +* Settings Search: Additional improvements and highlighting +* Data Usage Info: Add support for CDMA devices without sim cards +* Bluetooth: Add additional A2DP profiles +* Bluetooth: Disable AVRCP 1.5 by default (fixes various car unit compatibility) +* Email: Fix saving attachments to storage for POP3 accounts +* Account for Play Services induced wake-locks +* Fix encryption on some LG Devices +* Dialer: add support for Korean and Chinese to smart-dialer + +### 11.0.0 M8 +* Common: Android 4.4.4 (Google) +* New Devices: Sony Xperia Z2 (sirius); Xiaomi Mi2 (aries); Oppo Find 7a/s (find7); OnePlus One (bacon) +* Common: Fix VPN issues related to 4.4.3 merge +* Common: Enable 'Heads Up' notification mode (Settings > Notifications) +* Settings: 'Interface' replaced by 'Status Bar', 'Notification Drawer', and 'Gestures' +* Settings: Moved 'Expanded Desktop' to 'Display' +* Settings: Moved all lock screen related items to 'Lock Screen' and removed duplicates from 'Security' +* Settings: Moved 'Navigation Bar' layout control to 'Buttons' +* Trebuchet: Custom Homescreen grid size +* Trebuchet: Add Protected Apps feature +* Trebuchet: Add Search Panel (Google Now) option +* WhisperPush: No longer ignores 'Blacklist' +* Futex: Protect against Towelroot +* Various small bugfixes, global and device-specific + +### 11.0.0 M7 +* Common: Android 4.4.2 (Google) +* New Devices: HTC One (m8); Samsung Galaxy Tab Pro 8.4 (mondrianwifi); Galaxy Note 8.0 LTE (n5120); LG G2 Docomo (l01f) +* Common: Theme Chooser UI Overhaul +* Common: Calculator app redesign (courtesy Xlythe) +* Common: Performance Profiles +* Common: Improved theming performance on low memory devices (~512MB RAM or less) +* Trebuchet: Move settings to new slide-out panel +* Trebuchet: Consolidate settings for home and drawer options +* Media: Add FFMPEG support (expanded media format support) +* Bluetooth: Improved support for new car audio systems and docks +* Various small bugfixes, global and device-specific + +### 10.2.0 +* Common: Android 4.3 (Google) +* Common: Privacy Guard 2.0 with AppOps +* Common: Quick Settings Ribbon (replaces Notification Power Widgets) +* Common: Hardware Tunables HAL +* Common: Settings restructure +* SMS: Voice+ (Google Voice integration) +* SMS: Middleware layer +* APN: World Phone Support (unified APN list) +* Trebuchet: Universal Icon Pack support +* Various small bugfixes, global and device-specific + ### 10.1.3 * Common: CyanogenMod Account * Common: Privacy Guard diff --git a/CONTRIBUTORS.mkdn b/CONTRIBUTORS.mkdn index b7ff7338..ac9125f7 100644 --- a/CONTRIBUTORS.mkdn +++ b/CONTRIBUTORS.mkdn @@ -9,6 +9,7 @@ CyanogenMod Maintainers (CyanogenMod 13.0): ----------------------------- * __Acer A700:__ pawitp +* __Alcatel Idol 3:__ c457 * __Amazon Kindle Fire 1st Edition:__ Hashcode, FuZZ__ * __Amazon Kindle Fire 2nd Edition:__ Hashcode, FuZZ__ * __Asus EeePad Transformer (TF101):__ Bumble-Bee, EnJens @@ -20,10 +21,14 @@ Maintainers (CyanogenMod 13.0): * __Asus Zenfone 2 ZE551ML (Z00A):__ crpalmer, jrior001 * __Asus Zenfone 2 ZE550KL (Z00L):__ LuK1337, luca020400 * __Asus Zenfone 2 ZE551KL/ZD551KL (Z00T):__ LuK1337, luca020400 +* __Asus ZenPad 8.0 Z380KL:__ vm03 * __B&N NookColor (encore):__ eyeballer, fattire, keyodi, krylon360, sluo (NookieDevs) * __B&N Nook Tablet (acclaim):__ chrmhoffmann +* __BQ Aquaris E5 4G/E5 S (vegetalte):__ cmorlok, eloimuns, Kra1o5, stucki, brinlyau (bq-dev) +* __BQ Aquaris M5 (piccolo):__ cmorlok, eloimuns, Kra1o5, stucki, brinlyau (bq-dev) +* __BQ Aquaris X5 Plus (gohan):__ cmorlok, eloimuns, Kra1o5, stucki, brinlyau (bq-dev) * __Google Android One:__ varunchitre15 -* __Google Galaxy Nexus:__ bekit, Bumble-Bee, burnsra, KalimochoAz, something15525 +* __Google Galaxy Nexus:__ Ziyan, musical_chairs * __Google Nexus S:__ burnsra, KalimochoAz, klusark * __Google Nexus 4:__ ciwrl * __Google Nexus 5:__ ciwrl @@ -31,12 +36,12 @@ Maintainers (CyanogenMod 13.0): * __Google Nexus 6:__ dhacker29 * __Google Nexus 6P:__ ciwrl, dhacker29, Sam Mortimer * __Google Nexus 7:__ burnsra, fattire, Thömy, nemith, JoeyRizzoli (GSM) +* __Google Nexus 7 (2013):__ ciwrl, nardholio, zwliew * __Google Nexus 9:__ simonsickle, ciwrl * __Google Nexus 10:__ Tortel, ciwrl * __Google Nexus Player:__ dhacker29, bmc08gt * __HTC Desire 601(zara/zaracl):__ uberlaggydarwin, PatrikKT * __HTC Desire 816:__ Grarak, v_superuser -* __HTC Desire Eye:__ uberlaggydarwin * __HTC Droid DNA:__ crpalmer, invisiblek * __HTC Droid Incredible 4G LTE:__ intervigil, mdmower * __HTC Evo 4G LTE:__ kushdeck, toastcfh @@ -59,6 +64,7 @@ Maintainers (CyanogenMod 13.0): * __LG G2 (Canada) (D803):__ arcee, Rashed97, Shelnutt2 * __LG G2 (Sprint) (LS980):__ arcee, Rashed97, Shelnutt2 * __LG G2 (Verizon) (VS980):__ arcee, Rashed97, Shelnutt2 +* __LG G2 Mini:__ Quarx2k, vm03, NikitaProAndroid * __LG G3 (AT&T) (D850):__ * __LG G3 (T-Mobile) (D851):__ bryan2894 * __LG G3 (Canada) (D852):__ cuzz1369 @@ -66,8 +72,12 @@ Maintainers (CyanogenMod 13.0): * __LG G3 (Korea) (F400):__ TheNoFace * __LG G3 (Sprint) (LS990):__ Kasual * __LG G3 (Verizon) (VS985):__ invisiblek +* __LG G3 Beat (D722):__ Quarx2k, vm03, NikitaProAndroid +* __LG G3 s (D724):__ Quarx2k, vm03, NikitaProAndroid * __LG G4 (T-Mobile) (H811):__ codeworkx, genesixxbf3 * __LG G4 (International) (H815):__ codeworkx, genesixxbf3 +* __LG Optimus L70:__ Quarx2k, vm03, NikitaProAndroid +* __LG Optimus L90:__ Quarx2k, vm03, NikitaProAndroid * __LG Optimus LTE (P930) / LG Nitro HD {P935):__ arcee * __LG Optimus LTE (SK Telecom) (SU640):__ arcee * __LG V10 (T-Mobile) (H901):__ genesixxbf3 @@ -94,6 +104,7 @@ Maintainers (CyanogenMod 13.0): * __Motorola Xoom 3G (UMTS):__ bazar, SteadyHawkin, TDR (Team Rogue) * __Motorola Xoom 4G LTE (Verizon):__ bazar, SteadyHawkin, TDR (Team Rogue) * __OnePlus One:__ cyanogen, intervigil, inwotep, arcee +* __OnePlus Two:__ ciwrl, grarak, raymanfx * __OnePlus X:__ ashwin007, MasterAwesome * __Oppo Find 5:__ intervigil, nebkat, raymanfx * __Oppo Find 7:__ intervigil, tdm, inwotep, mikeioannina @@ -137,28 +148,31 @@ Maintainers (CyanogenMod 13.0): * __Samsung Galaxy S IV (Sprint) (SPH-L720):__ noobnl * __Samsung Galaxy S IV (T-Mobile) (SGH-M919):__ dcd * __Samsung Galaxy S IV (Verizon) (SCH-I545):__ invisiblek -* __Samsung Galaxy S IV LTE (GT-I9505):__ AntaresOne +* __Samsung Galaxy S IV LTE (GT-I9505):__ AntaresOne, invisiblek, dcd, zwliew * __Samsung Galaxy S IV LTE-A (GT-I9506):__ solk2 * __Samsung Galaxy S IV Mini 3G (GT-I9190):__ arco * __Samsung Galaxy S IV Mini LTE (GT-I9195):__ arco * __Samsung Galaxy S V (AU) (SCL23):__ scoty755 * __Samsung Galaxy S V (Vodafone) (SM-G900I):__ Regi24 -* __Samsung Galaxy S V LTE (SM-G900F):__ Albinoman887 +* __Samsung Galaxy S V LTE (SM-G900F):__ haggertk, OzzysCmAcc * __Samsung Galaxy Tab 7" (GSM):__ cdesai, humberos * __Samsung Galaxy Tab 7" (CDMA):__ jt1134 * __Samsung Galaxy Tab 2 7" (GT-P31xx):__ codyf86 * __Samsung Galaxy Tab 2 10.1" (GT-P51xx):__ codyf86 * __Samsung Galaxy Tab Pro 8.4" (SM-T320):__ crpalmer +* __Samsung Galaxy Tab S2 9.7" (SM-T810):__ raymanfx, T_I +* __Samsung Galaxy Tab S2 9.7 (LTE)" (SM-T815):__ raymanfx * __Samsung Vibrant (SGH-T959):__ FaultException * __Sony Xperia E3 (flamingo):__ FreeXperia Team * __Sony Xperia L (taoshan):__ olivieer, FreeXperia Team * __Sony Xperia M (nicki):__ RonG, FreeXperia Team * __Sony Xperia M2 (eagle):__ FreeXperia Team * __Sony Xperia SP (huashan):__ AdrianDC -* __Sony Xperia T (mint):__ FreeXperia Team, tilal6991, uberlaggydarwin +* __Sony Xperia T (mint):__ AdrianDC, FreeXperia Team * __Sony Xperia T2 Ultra (tianchi):__ FreeXperia Team * __Sony Xperia T3 (seagull):__ FreeXperia Team -* __Sony Xperia V (tsubasa):__ FreeXperia Team, tilal6991, championswimmer, uberlaggydarwin +* __Sony Xperia TX (hayabusa):__ AdrianDC, FreeXperia Team +* __Sony Xperia V (tsubasa):__ AdrianDC, FreeXperia Team * __Sony Xperia Z (yuga):__ FreeXperia Team, Turl, olivieer * __Sony Xperia ZL (odin):__ FreeXperia Team * __Sony Xperia ZR (dogo):__ FreeXperia Team @@ -176,6 +190,9 @@ Maintainers (CyanogenMod 13.0): * __Sony Z Ultra GPE (togari_gpe):__ FreeXperia Team * __Xiaomi Mi2(s) (aries):__ Michael Zimmermann * __Xiaomi Mi3/4 (cancro):__ JoeyRizzoli +* __Xiaomi Mi5 (gemini):__ bgcngm, defer, h2o64 +* __Xiaomi Redmi 3/Prime (ido):__ Anik1199 +* __Xiaomi Redmi Note 3 (kenzo):__ TheStrix * __ZTE Nubia Z9 Max (nx510j):__ dianlujitao FreeXperia Team: diff --git a/ambientsdk/Android.mk b/ambientsdk/Android.mk index 56ea1f46..fe2a9c1b 100644 --- a/ambientsdk/Android.mk +++ b/ambientsdk/Android.mk @@ -21,7 +21,7 @@ LOCAL_UNINSTALLABLE_MODULE := true LOCAL_MAVEN_REPO := https://repo1.maven.org/maven2 LOCAL_MAVEN_GROUP := com.cyngn.ambient LOCAL_MAVEN_ARTIFACT := ambientsdk -LOCAL_MAVEN_VERSION := 1.4.0 +LOCAL_MAVEN_VERSION := 1.6.0-147069776-39fe2d07 LOCAL_MAVEN_PACKAGING := aar include $(BUILD_MAVEN_PREBUILT) diff --git a/build/core/apicheck_msg_current.txt b/build/core/apicheck_msg_current.txt index f58858eb..05a0341e 100644 --- a/build/core/apicheck_msg_current.txt +++ b/build/core/apicheck_msg_current.txt @@ -2,11 +2,15 @@ ****************************** You have tried to change the API from what has been previously approved. +STOP. + Read this: + https://github.com/CyanogenMod/cm_platform_sdk/wiki/Creating-an-API-for-the-SDK#updating--verifying-the-api + To make these errors go away, you have two choices: 1) You can add "@hide" javadoc comments to the methods, etc. listed in the errors above. - 2) You can update current.txt by executing the following command: + 2) You can update current.txt (locally) by executing the following command: make update-cm-api ^^^^^^^^^^^^^^^^^^ @@ -140,4 +144,4 @@ To make these errors go away, you have two choices: To submit the revised current.txt to the main CyanogenMod repository, you will need approval. -****************************** \ No newline at end of file +****************************** diff --git a/build/core/maven_artifact_publish.mk b/build/core/maven_artifact_publish.mk index c1fcf502..f72e9704 100644 --- a/build/core/maven_artifact_publish.mk +++ b/build/core/maven_artifact_publish.mk @@ -27,7 +27,7 @@ endif $(full_target): pomfile := $(LOCAL_MAVEN_POM) $(full_target): repo := $(LOCAL_MAVEN_REPO) ifdef LOCAL_MAVEN_TARGET_MODULE -$(full_target): path_to_file := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MAVEN_TARGET_MODULE),,COMMON)/javalib.jar +$(full_target): path_to_file := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MAVEN_TARGET_MODULE),,COMMON)/javalib.aar endif $(full_target): repoId := $(LOCAL_MAVEN_REPO_ID) $(full_target): classifier := $(LOCAL_MAVEN_CLASSIFIER) @@ -38,7 +38,7 @@ $(full_target): artifact_path ?= $(basename $(path_to_file)) ifdef LOCAL_MAVEN_TARGET_MODULE $(full_target): $(LOCAL_MAVEN_TARGET_MODULE) $(path_to_file) $(artifact_path) $(ACP) - @echo -e ${CL_GRN}"Renaming generated sdk javalib jar"${CL_RST} + @echo -e ${CL_GRN}"Renaming generated sdk javalib aar"${CL_RST} $(hide) $(ACP) $(path_to_file) $(artifact_path) @echo -e ${CL_GRN}"Publishing to Maven"${CL_RST} $(hide) mvn -e -X gpg:sign-and-deploy-file \ diff --git a/build/tasks/apicheck.mk b/build/tasks/apicheck.mk index 3be3cae1..7fa1cc49 100644 --- a/build/tasks/apicheck.mk +++ b/build/tasks/apicheck.mk @@ -25,7 +25,7 @@ ifeq (,$(filter true, $(WITHOUT_CHECK_API) $(TARGET_BUILD_PDK))) # Run the checkapi rules by default. droidcore: checkapi-cm -# Validate against current platform sdk version api text within prebuilts +# Validate against previous release platform sdk version api text within prebuilts cm_last_released_sdk_version := $(CM_PLATFORM_SDK_VERSION) .PHONY: check-cm-public-api diff --git a/build/tasks/generate_cmsdk_coverage.mk b/build/tasks/generate_cmsdk_coverage.mk index d9be81aa..38b70b17 100644 --- a/build/tasks/generate_cmsdk_coverage.mk +++ b/build/tasks/generate_cmsdk_coverage.mk @@ -18,7 +18,7 @@ # Makefile for producing cmsdk coverage reports. # Run "make cmsdk-test-coverage" in the $ANDROID_BUILD_TOP directory. -cts_api_coverage_exe := $(HOST_OUT_EXECUTABLES)/cts-api-coverage +cmsdk_api_coverage_exe := $(HOST_OUT_EXECUTABLES)/cmsdk-api-coverage dexdeps_exe := $(HOST_OUT_EXECUTABLES)/dexdeps coverage_out := $(HOST_OUT)/cmsdk-api-coverage @@ -30,16 +30,17 @@ $(api_xml_description) : $(api_text_description) $(APICHECK) $(hide) mkdir -p $(dir $@) $(hide) $(APICHECK_COMMAND) -convert2xml $< $@ -cmsdk-test-coverage-report := $(coverage_out)/test-coverage.html +cmsdk-test-coverage-report := $(coverage_out)/cmsdk-test-coverage.html cmsdk_tests_apk := $(call intermediates-dir-for,APPS,CMPlatformTests)/package.apk -cmsdk_api_coverage_dependencies := $(cts_api_coverage_exe) $(dexdeps_exe) $(api_xml_description) +cmsettingsprovider_tests_apk := $(call intermediates-dir-for,APPS,CMSettingsProviderTests)/package.apk +cmsdk_api_coverage_dependencies := $(cmsdk_api_coverage_exe) $(dexdeps_exe) $(api_xml_description) -$(cmsdk-test-coverage-report): PRIVATE_TEST_CASES := $(cmsdk_tests_apk) -$(cmsdk-test-coverage-report): PRIVATE_CTS_API_COVERAGE_EXE := $(cts_api_coverage_exe) +$(cmsdk-test-coverage-report): PRIVATE_TEST_CASES := $(cmsdk_tests_apk) $(cmsettingsprovider_tests_apk) +$(cmsdk-test-coverage-report): PRIVATE_CMSDK_API_COVERAGE_EXE := $(cmsdk_api_coverage_exe) $(cmsdk-test-coverage-report): PRIVATE_DEXDEPS_EXE := $(dexdeps_exe) $(cmsdk-test-coverage-report): PRIVATE_API_XML_DESC := $(api_xml_description) -$(cmsdk-test-coverage-report): $(cmsdk_tests_apk) $(cmsdk_api_coverage_dependencies) | $(ACP) +$(cmsdk-test-coverage-report): $(cmsdk_tests_apk) $(cmsettingsprovider_tests_apk) $(cmsdk_api_coverage_dependencies) | $(ACP) $(call generate-cm-coverage-report,"CMSDK API Coverage Report",\ $(PRIVATE_TEST_CASES),html) @@ -57,8 +58,8 @@ endif # 3 - Format of the report define generate-cm-coverage-report $(hide) mkdir -p $(dir $@) - $(hide) $(PRIVATE_CTS_API_COVERAGE_EXE) -d $(PRIVATE_DEXDEPS_EXE) -a $(PRIVATE_API_XML_DESC) -f $(3) -o $@ $(2) -cm - @ echo $(1): file://$(ANDROID_BUILD_TOP)/$@ + $(hide) $(PRIVATE_CMSDK_API_COVERAGE_EXE) -d $(PRIVATE_DEXDEPS_EXE) -a $(PRIVATE_API_XML_DESC) -f $(3) -o $@ $(2) -cm + @ echo $(1): file://$@ endef # Reset temp vars diff --git a/build/tools/extract_utils.sh b/build/tools/extract_utils.sh new file mode 100644 index 00000000..6f2ff158 --- /dev/null +++ b/build/tools/extract_utils.sh @@ -0,0 +1,913 @@ +#!/bin/bash +# +# Copyright (C) 2016 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. +# + +PRODUCT_COPY_FILES_LIST=() +PRODUCT_COPY_FILES_HASHES=() +PRODUCT_PACKAGES_LIST=() +PRODUCT_PACKAGES_HASHES=() +PACKAGE_LIST=() +VENDOR_STATE=-1 +VENDOR_RADIO_STATE=-1 +COMMON=-1 +ARCHES= +FULLY_DEODEXED=-1 + +TMPDIR="/tmp/extractfiles.$$" +mkdir "$TMPDIR" + +# +# cleanup +# +# kill our tmpfiles with fire on exit +# +function cleanup() { + rm -rf "${TMPDIR:?}" +} + +trap cleanup EXIT INT TERM ERR + +# +# setup_vendor +# +# $1: device name +# $2: vendor name +# $3: CM root directory +# $4: is common device - optional, default to false +# $5: cleanup - optional, default to true +# +# Must be called before any other functions can be used. This +# sets up the internal state for a new vendor configuration. +# +function setup_vendor() { + local DEVICE="$1" + if [ -z "$DEVICE" ]; then + echo "\$DEVICE must be set before including this script!" + exit 1 + fi + + export VENDOR="$2" + if [ -z "$VENDOR" ]; then + echo "\$VENDOR must be set before including this script!" + exit 1 + fi + + export CM_ROOT="$3" + if [ ! -d "$CM_ROOT" ]; then + echo "\$CM_ROOT must be set and valid before including this script!" + exit 1 + fi + + export OUTDIR=vendor/"$VENDOR"/"$DEVICE" + if [ ! -d "$CM_ROOT/$OUTDIR" ]; then + mkdir -p "$CM_ROOT/$OUTDIR" + fi + + export PRODUCTMK="$CM_ROOT"/"$OUTDIR"/"$DEVICE"-vendor.mk + export ANDROIDMK="$CM_ROOT"/"$OUTDIR"/Android.mk + export BOARDMK="$CM_ROOT"/"$OUTDIR"/BoardConfigVendor.mk + + if [ "$4" == "true" ] || [ "$4" == "1" ]; then + COMMON=1 + else + COMMON=0 + fi + + if [ "$5" == "true" ] || [ "$5" == "1" ]; then + VENDOR_STATE=1 + VENDOR_RADIO_STATE=1 + else + VENDOR_STATE=0 + VENDOR_RADIO_STATE=0 + fi +} + +# +# target_file: +# +# $1: colon delimited list +# +# Returns destination filename without args +# +function target_file() { + local LINE="$1" + local SPLIT=(${LINE//:/ }) + local COUNT=${#SPLIT[@]} + if [ "$COUNT" -gt "1" ]; then + if [[ "${SPLIT[1]}" =~ .*/.* ]]; then + printf '%s\n' "${SPLIT[1]}" + return 0 + fi + fi + printf '%s\n' "${SPLIT[0]}" +} + +# +# target_args: +# +# $1: colon delimited list +# +# Returns optional arguments (last value) for given target +# +function target_args() { + local LINE="$1" + local SPLIT=(${LINE//:/ }) + local COUNT=${#SPLIT[@]} + if [ "$COUNT" -gt "1" ]; then + if [[ ! "${SPLIT[$COUNT-1]}" =~ .*/.* ]]; then + printf '%s\n' "${SPLIT[$COUNT-1]}" + fi + fi +} + +# +# prefix_match: +# +# $1: the prefix to match on +# +# Internal function which loops thru the packages list and returns a new +# list containing the matched files with the prefix stripped away. +# +function prefix_match() { + local PREFIX="$1" + for FILE in "${PRODUCT_PACKAGES_LIST[@]}"; do + if [[ "$FILE" =~ ^"$PREFIX" ]]; then + printf '%s\n' "${FILE#$PREFIX}" + fi + done +} + +# +# write_product_copy_files: +# +# Creates the PRODUCT_COPY_FILES section in the product makefile for all +# items in the list which do not start with a dash (-). +# +function write_product_copy_files() { + local COUNT=${#PRODUCT_COPY_FILES_LIST[@]} + local TARGET= + local FILE= + local LINEEND= + + if [ "$COUNT" -eq "0" ]; then + return 0 + fi + + printf '%s\n' "PRODUCT_COPY_FILES += \\" >> "$PRODUCTMK" + for (( i=1; i> "$PRODUCTMK" + done + return 0 +} + +# +# write_packages: +# +# $1: The LOCAL_MODULE_CLASS for the given module list +# $2: "true" if this package is part of the vendor/ path +# $3: type-specific extra flags +# $4: Name of the array holding the target list +# +# Internal function which writes out the BUILD_PREBUILT stanzas +# for all modules in the list. This is called by write_product_packages +# after the modules are categorized. +# +function write_packages() { + + local CLASS="$1" + local VENDOR_PKG="$2" + local EXTRA="$3" + + # Yes, this is a horrible hack - we create a new array using indirection + local ARR_NAME="$4[@]" + local FILELIST=("${!ARR_NAME}") + + local FILE= + local ARGS= + local BASENAME= + local EXTENSION= + local PKGNAME= + local SRC= + + for P in "${FILELIST[@]}"; do + FILE=$(target_file "$P") + ARGS=$(target_args "$P") + + BASENAME=$(basename "$FILE") + EXTENSION=${BASENAME##*.} + PKGNAME=${BASENAME%.*} + + # Add to final package list + PACKAGE_LIST+=("$PKGNAME") + + SRC="proprietary" + if [ "$VENDOR_PKG" = "true" ]; then + SRC+="/vendor" + fi + + printf 'include $(CLEAR_VARS)\n' + printf 'LOCAL_MODULE := %s\n' "$PKGNAME" + printf 'LOCAL_MODULE_OWNER := %s\n' "$VENDOR" + if [ "$CLASS" = "SHARED_LIBRARIES" ]; then + if [ "$EXTRA" = "both" ]; then + printf 'LOCAL_SRC_FILES_64 := %s/lib64/%s\n' "$SRC" "$FILE" + printf 'LOCAL_SRC_FILES_32 := %s/lib/%s\n' "$SRC" "$FILE" + #if [ "$VENDOR_PKG" = "true" ]; then + # echo "LOCAL_MODULE_PATH_64 := \$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)" + # echo "LOCAL_MODULE_PATH_32 := \$(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)" + #else + # echo "LOCAL_MODULE_PATH_64 := \$(TARGET_OUT_SHARED_LIBRARIES)" + # echo "LOCAL_MODULE_PATH_32 := \$(2ND_TARGET_OUT_SHARED_LIBRARIES)" + #fi + elif [ "$EXTRA" = "64" ]; then + printf 'LOCAL_SRC_FILES := %s/lib64/%s\n' "$SRC" "$FILE" + else + printf 'LOCAL_SRC_FILES := %s/lib/%s\n' "$SRC" "$FILE" + fi + if [ "$EXTRA" != "none" ]; then + printf 'LOCAL_MULTILIB := %s\n' "$EXTRA" + fi + elif [ "$CLASS" = "APPS" ]; then + if [ -z "$ARGS" ]; then + if [ "$EXTRA" = "priv-app" ]; then + SRC="$SRC/priv-app" + else + SRC="$SRC/app" + fi + fi + printf 'LOCAL_SRC_FILES := %s/%s\n' "$SRC" "$FILE" + local CERT=platform + if [ ! -z "$ARGS" ]; then + CERT="$ARGS" + fi + printf 'LOCAL_CERTIFICATE := %s\n' "$CERT" + elif [ "$CLASS" = "JAVA_LIBRARIES" ]; then + printf 'LOCAL_SRC_FILES := %s/framework/%s\n' "$SRC" "$FILE" + local CERT=platform + if [ ! -z "$ARGS" ]; then + CERT="$ARGS" + fi + printf 'LOCAL_CERTIFICATE := %s\n' "$CERT" + elif [ "$CLASS" = "ETC" ]; then + printf 'LOCAL_SRC_FILES := %s/etc/%s\n' "$SRC" "$FILE" + elif [ "$CLASS" = "EXECUTABLES" ]; then + if [ "$ARGS" = "rootfs" ]; then + SRC="$SRC/rootfs" + if [ "$EXTRA" = "sbin" ]; then + SRC="$SRC/sbin" + printf '%s\n' "LOCAL_MODULE_PATH := \$(TARGET_ROOT_OUT_SBIN)" + printf '%s\n' "LOCAL_UNSTRIPPED_PATH := \$(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)" + fi + else + SRC="$SRC/bin" + fi + printf 'LOCAL_SRC_FILES := %s/%s\n' "$SRC" "$FILE" + unset EXTENSION + else + printf 'LOCAL_SRC_FILES := %s/%s\n' "$SRC" "$FILE" + fi + printf 'LOCAL_MODULE_TAGS := optional\n' + printf 'LOCAL_MODULE_CLASS := %s\n' "$CLASS" + if [ ! -z "$EXTENSION" ]; then + printf 'LOCAL_MODULE_SUFFIX := .%s\n' "$EXTENSION" + fi + if [ "$EXTRA" = "priv-app" ]; then + printf 'LOCAL_PRIVILEGED_MODULE := true\n' + fi + if [ "$VENDOR_PKG" = "true" ]; then + printf 'LOCAL_PROPRIETARY_MODULE := true\n' + fi + printf 'include $(BUILD_PREBUILT)\n\n' + done +} + +# +# write_product_packages: +# +# This function will create BUILD_PREBUILT entries in the +# Android.mk and associated PRODUCT_PACKAGES list in the +# product makefile for all files in the blob list which +# start with a single dash (-) character. +# +function write_product_packages() { + PACKAGE_LIST=() + + local COUNT=${#PRODUCT_PACKAGES_LIST[@]} + + if [ "$COUNT" = "0" ]; then + return 0 + fi + + # Figure out what's 32-bit, what's 64-bit, and what's multilib + # I really should not be doing this in bash due to shitty array passing :( + local T_LIB32=( $(prefix_match "lib/") ) + local T_LIB64=( $(prefix_match "lib64/") ) + local MULTILIBS=( $(comm -12 <(printf '%s\n' "${T_LIB32[@]}") <(printf '%s\n' "${T_LIB64[@]}")) ) + local LIB32=( $(comm -23 <(printf '%s\n' "${T_LIB32[@]}") <(printf '%s\n' "${MULTILIBS[@]}")) ) + local LIB64=( $(comm -23 <(printf '%s\n' "${T_LIB64[@]}") <(printf '%s\n' "${MULTILIBS[@]}")) ) + + if [ "${#MULTILIBS[@]}" -gt "0" ]; then + write_packages "SHARED_LIBRARIES" "false" "both" "MULTILIBS" >> "$ANDROIDMK" + fi + if [ "${#LIB32[@]}" -gt "0" ]; then + write_packages "SHARED_LIBRARIES" "false" "32" "LIB32" >> "$ANDROIDMK" + fi + if [ "${#LIB64[@]}" -gt "0" ]; then + write_packages "SHARED_LIBRARIES" "false" "64" "LIB64" >> "$ANDROIDMK" + fi + + local T_V_LIB32=( $(prefix_match "vendor/lib/") ) + local T_V_LIB64=( $(prefix_match "vendor/lib64/") ) + local V_MULTILIBS=( $(comm -12 <(printf '%s\n' "${T_V_LIB32[@]}") <(printf '%s\n' "${T_V_LIB64[@]}")) ) + local V_LIB32=( $(comm -23 <(printf '%s\n' "${T_V_LIB32[@]}") <(printf '%s\n' "${V_MULTILIBS[@]}")) ) + local V_LIB64=( $(comm -23 <(printf '%s\n' "${T_V_LIB64[@]}") <(printf '%s\n' "${V_MULTILIBS[@]}")) ) + + if [ "${#V_MULTILIBS[@]}" -gt "0" ]; then + write_packages "SHARED_LIBRARIES" "true" "both" "V_MULTILIBS" >> "$ANDROIDMK" + fi + if [ "${#V_LIB32[@]}" -gt "0" ]; then + write_packages "SHARED_LIBRARIES" "true" "32" "V_LIB32" >> "$ANDROIDMK" + fi + if [ "${#V_LIB64[@]}" -gt "0" ]; then + write_packages "SHARED_LIBRARIES" "true" "64" "V_LIB64" >> "$ANDROIDMK" + fi + + # Apps + local APPS=( $(prefix_match "app/") ) + if [ "${#APPS[@]}" -gt "0" ]; then + write_packages "APPS" "false" "" "APPS" >> "$ANDROIDMK" + fi + local PRIV_APPS=( $(prefix_match "priv-app/") ) + if [ "${#PRIV_APPS[@]}" -gt "0" ]; then + write_packages "APPS" "false" "priv-app" "PRIV_APPS" >> "$ANDROIDMK" + fi + local V_APPS=( $(prefix_match "vendor/app/") ) + if [ "${#V_APPS[@]}" -gt "0" ]; then + write_packages "APPS" "true" "" "V_APPS" >> "$ANDROIDMK" + fi + local V_PRIV_APPS=( $(prefix_match "vendor/priv-app/") ) + if [ "${#V_PRIV_APPS[@]}" -gt "0" ]; then + write_packages "APPS" "true" "priv-app" "V_PRIV_APPS" >> "$ANDROIDMK" + fi + + # Framework + local FRAMEWORK=( $(prefix_match "framework/") ) + if [ "${#FRAMEWORK[@]}" -gt "0" ]; then + write_packages "JAVA_LIBRARIES" "false" "" "FRAMEWORK" >> "$ANDROIDMK" + fi + + # Etc + local ETC=( $(prefix_match "etc/") ) + if [ "${#ETC[@]}" -gt "0" ]; then + write_packages "ETC" "false" "" "ETC" >> "$ANDROIDMK" + fi + local V_ETC=( $(prefix_match "vendor/etc/") ) + if [ "${#V_ETC[@]}" -gt "0" ]; then + write_packages "ETC" "false" "" "V_ETC" >> "$ANDROIDMK" + fi + + # Executables + local BIN=( $(prefix_match "bin/") ) + if [ "${#BIN[@]}" -gt "0" ]; then + write_packages "EXECUTABLES" "false" "" "BIN" >> "$ANDROIDMK" + fi + local V_BIN=( $(prefix_match "vendor/bin/") ) + if [ "${#V_BIN[@]}" -gt "0" ]; then + write_packages "EXECUTABLES" "true" "" "V_BIN" >> "$ANDROIDMK" + fi + local SBIN=( $(prefix_match "sbin/") ) + if [ "${#SBIN[@]}" -gt "0" ]; then + write_packages "EXECUTABLES" "false" "sbin" "SBIN" >> "$ANDROIDMK" + fi + + + # Actually write out the final PRODUCT_PACKAGES list + local PACKAGE_COUNT=${#PACKAGE_LIST[@]} + + if [ "$PACKAGE_COUNT" -eq "0" ]; then + return 0 + fi + + printf '\n%s\n' "PRODUCT_PACKAGES += \\" >> "$PRODUCTMK" + for (( i=1; i> "$PRODUCTMK" + done +} + +# +# write_header: +# +# $1: file which will be written to +# +# writes out the copyright header with the current year. +# note that this is not an append operation, and should +# be executed first! +# +function write_header() { + YEAR=$(date +"%Y") + + [ "$COMMON" -eq 1 ] && local DEVICE="$DEVICE_COMMON" + + cat << EOF > $1 +# Copyright (C) $YEAR 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. + +# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh + +EOF +} + +# +# write_headers: +# +# $1: devices falling under common to be added to guard - optional +# +# Calls write_header for each of the makefiles and creates +# the initial path declaration and device guard for the +# Android.mk +# +function write_headers() { + write_header "$ANDROIDMK" + cat << EOF >> "$ANDROIDMK" +LOCAL_PATH := \$(call my-dir) + +EOF + if [ "$COMMON" -ne 1 ]; then + cat << EOF >> "$ANDROIDMK" +ifeq (\$(TARGET_DEVICE),$DEVICE) + +EOF + else + if [ -z "$1" ]; then + echo "Argument with devices to be added to guard must be set!" + exit 1 + fi + cat << EOF >> "$ANDROIDMK" +ifneq (\$(filter $1,\$(TARGET_DEVICE)),) + +EOF + fi + + write_header "$BOARDMK" + write_header "$PRODUCTMK" +} + +# +# write_footers: +# +# Closes the inital guard and any other finalization tasks. Must +# be called as the final step. +# +function write_footers() { + cat << EOF >> "$ANDROIDMK" +endif +EOF +} + +# Return success if adb is up and not in recovery +function _adb_connected { + { + if [[ "$(adb get-state)" == device && + "$(adb shell test -e /sbin/recovery; echo $?)" == 0 ]] + then + return 0 + fi + } 2>/dev/null + + return 1 +}; + +# +# parse_file_list: +# +# $1: input file +# +# Sets PRODUCT_PACKAGES and PRODUCT_COPY_FILES while parsing the input file +# +function parse_file_list() { + if [ -z "$1" ]; then + echo "An input file is expected!" + exit 1 + elif [ ! -f "$1" ]; then + echo "Input file "$1" does not exist!" + exit 1 + fi + + PRODUCT_PACKAGES_LIST=() + PRODUCT_PACKAGES_HASHES=() + PRODUCT_COPY_FILES_LIST=() + PRODUCT_COPY_FILES_HASHES=() + + while read -r line; do + if [ -z "$line" ]; then continue; fi + + # If the line has a pipe delimiter, a sha1 hash should follow. + # This indicates the file should be pinned and not overwritten + # when extracting files. + local SPLIT=(${line//\|/ }) + local COUNT=${#SPLIT[@]} + local SPEC=${SPLIT[0]} + local HASH="x" + if [ "$COUNT" -gt "1" ]; then + HASH=${SPLIT[1]} + fi + + # if line starts with a dash, it needs to be packaged + if [[ "$SPEC" =~ ^- ]]; then + PRODUCT_PACKAGES_LIST+=("${SPEC#-}") + PRODUCT_PACKAGES_HASHES+=("$HASH") + else + PRODUCT_COPY_FILES_LIST+=("$SPEC") + PRODUCT_COPY_FILES_HASHES+=("$HASH") + fi + + done < <(egrep -v '(^#|^[[:space:]]*$)' "$1" | sort | uniq) +} + +# +# write_makefiles: +# +# $1: file containing the list of items to extract +# +# Calls write_product_copy_files and write_product_packages on +# the given file and appends to the Android.mk as well as +# the product makefile. +# +function write_makefiles() { + parse_file_list "$1" + write_product_copy_files + write_product_packages +} + +# +# append_firmware_calls_to_makefiles: +# +# Appends to Android.mk the calls to all images present in radio folder +# (filesmap file used by releasetools to map firmware images should be kept in the device tree) +# +function append_firmware_calls_to_makefiles() { + cat << EOF >> "$ANDROIDMK" +ifeq (\$(LOCAL_PATH)/radio, \$(wildcard \$(LOCAL_PATH)/radio)) + +RADIO_FILES := \$(wildcard \$(LOCAL_PATH)/radio/*) +\$(foreach f, \$(notdir \$(RADIO_FILES)), \\ + \$(call add-radio-file,radio/\$(f))) +\$(call add-radio-file,../../../device/$VENDOR/$DEVICE/radio/filesmap) + +endif + +EOF +} + +# +# get_file: +# +# $1: input file +# $2: target file/folder +# $3: source of the file (can be "adb" or a local folder) +# +# Silently extracts the input file to defined target +# Returns success if file can be pulled from the device or found locally +# +function get_file() { + local SRC="$3" + + if [ "$SRC" = "adb" ]; then + # try to pull + adb pull "$1" "$2" >/dev/null 2>&1 && return 0 + + return 1 + else + # try to copy + cp "$SRC/$1" "$2" 2>/dev/null && return 0 + + return 1 + fi +}; + +# +# oat2dex: +# +# $1: extracted apk|jar (to check if deodex is required) +# $2: odexed apk|jar to deodex +# $3: source of the odexed apk|jar +# +# Convert apk|jar .odex in the corresposing classes.dex +# +function oat2dex() { + local CM_TARGET="$1" + local OEM_TARGET="$2" + local SRC="$3" + local TARGET= + local OAT= + + if [ -z "$BAKSMALIJAR" ] || [ -z "$SMALIJAR" ]; then + export BAKSMALIJAR="$CM_ROOT"/vendor/cm/build/tools/smali/baksmali.jar + export SMALIJAR="$CM_ROOT"/vendor/cm/build/tools/smali/smali.jar + fi + + # Extract existing boot.oats to the temp folder + if [ -z "$ARCHES" ]; then + echo "Checking if system is odexed and extracting boot.oats, if applicable. This may take a while..." + for ARCH in "arm64" "arm" "x86_64" "x86"; do + if get_file "system/framework/$ARCH/boot.oat" "$TMPDIR/boot_$ARCH.oat" "$SRC"; then + ARCHES+="$ARCH " + fi + done + fi + + if [ -z "$ARCHES" ]; then + FULLY_DEODEXED=1 && return 0 # system is fully deodexed, return + fi + + if [ ! -f "$CM_TARGET" ]; then + return; + fi + + if grep "classes.dex" "$CM_TARGET" >/dev/null; then + return 0 # target apk|jar is already odexed, return + fi + + for ARCH in $ARCHES; do + BOOTOAT="$TMPDIR/boot_$ARCH.oat" + + local OAT="$(dirname "$OEM_TARGET")/oat/$ARCH/$(basename "$OEM_TARGET" ."${OEM_TARGET##*.}").odex" + + if get_file "$OAT" "$TMPDIR" "$SRC"; then + java -jar "$BAKSMALIJAR" -x -o "$TMPDIR/dexout" -c "$BOOTOAT" -d "$TMPDIR" "$TMPDIR/$(basename "$OAT")" + elif [[ "$CM_TARGET" =~ .jar$ ]]; then + # try to extract classes.dex from boot.oat for framework jars + java -jar "$BAKSMALIJAR" -x -o "$TMPDIR/dexout" -c "$BOOTOAT" -d "$TMPDIR" -e "/$OEM_TARGET" "$BOOTOAT" + else + continue + fi + + java -jar "$SMALIJAR" "$TMPDIR/dexout" -o "$TMPDIR/classes.dex" && break + done + + rm -rf "$TMPDIR/dexout" +} + +# +# init_adb_connection: +# +# Starts adb server and waits for the device +# +function init_adb_connection() { + adb start-server # Prevent unexpected starting server message from adb get-state in the next line + if ! _adb_connected; then + echo "No device is online. Waiting for one..." + echo "Please connect USB and/or enable USB debugging" + until _adb_connected; do + sleep 1 + done + echo "Device Found." + fi + + # Retrieve IP and PORT info if we're using a TCP connection + TCPIPPORT=$(adb devices | egrep '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9]+[^0-9]+' \ + | head -1 | awk '{print $1}') + adb root &> /dev/null + sleep 0.3 + if [ -n "$TCPIPPORT" ]; then + # adb root just killed our connection + # so reconnect... + adb connect "$TCPIPPORT" + fi + adb wait-for-device &> /dev/null + sleep 0.3 +} + +# +# fix_xml: +# +# $1: xml file to fix +# +function fix_xml() { + local XML="$1" + local TEMP_XML="$TMPDIR/`basename "$XML"`.temp" + + grep '^ "$TEMP_XML" + grep -v '^> "$TEMP_XML" + + mv "$TEMP_XML" "$XML" +} + +# +# extract: +# +# $1: file containing the list of items to extract +# $2: path to extracted system folder, or "adb" to extract from device +# +function extract() { + if [ -z "$OUTDIR" ]; then + echo "Output dir not set!" + exit 1 + fi + + parse_file_list "$1" + + # Allow failing, so we can try $DEST and/or $FILE + set +e + + local FILELIST=( ${PRODUCT_COPY_FILES_LIST[@]} ${PRODUCT_PACKAGES_LIST[@]} ) + local HASHLIST=( ${PRODUCT_COPY_FILES_HASHES[@]} ${PRODUCT_PACKAGES_HASHES[@]} ) + local COUNT=${#FILELIST[@]} + local SRC="$2" + local OUTPUT_ROOT="$CM_ROOT"/"$OUTDIR"/proprietary + local OUTPUT_TMP="$TMPDIR"/"$OUTDIR"/proprietary + + if [ "$SRC" = "adb" ]; then + init_adb_connection + fi + + if [ "$VENDOR_STATE" -eq "0" ]; then + echo "Cleaning output directory ($OUTPUT_ROOT).." + rm -rf "${OUTPUT_TMP:?}" + mkdir -p "${OUTPUT_TMP:?}" + mv "${OUTPUT_ROOT:?}/"* "${OUTPUT_TMP:?}/" + VENDOR_STATE=1 + fi + + echo "Extracting $COUNT files in $1 from $SRC:" + + for (( i=1; i +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "healthd.h" +#include "minui/minui.h" + +#define LOGE(x...) do { KLOG_ERROR("charger", x); } while (0) +#define LOGW(x...) do { KLOG_WARNING("charger", x); } while (0) +#define LOGI(x...) do { KLOG_INFO("charger", x); } while (0) +#define LOGV(x...) do { KLOG_DEBUG("charger", x); } while (0) + +struct frame { + int min_capacity; + GRSurface *surface; +}; + +struct animation { + struct frame *frames; + int cur_frame; + int num_frames; +}; + +static struct animation anim = { + .frames = NULL, + .cur_frame = 0, + .num_frames = 0, +}; + +static bool font_inited; + +static int draw_surface_centered(GRSurface* surface) +{ + int w, h, x, y; + + w = gr_get_width(surface); + h = gr_get_height(surface); + x = (gr_fb_width() - w) / 2 ; + y = (gr_fb_height() - h) / 2 ; + + gr_blit(surface, 0, 0, w, h, x, y); + return y + h; +} + +#define STR_LEN 64 +static void draw_capacity(int capacity) +{ + char cap_str[STR_LEN]; + snprintf(cap_str, (STR_LEN - 1), "%d%%", capacity); + + struct frame *f = &anim.frames[0]; + int font_x, font_y; + gr_font_size(&font_x, &font_y); + int w = gr_measure(cap_str); + int h = gr_get_height(f->surface); + int x = (gr_fb_width() - w) / 2; + int y = (gr_fb_height() + h) / 2; + + gr_color(255, 255, 255, 255); + gr_text(x, y + font_y / 2, cap_str, 0); +} + +#ifdef QCOM_HARDWARE +enum alarm_time_type { + ALARM_TIME, + RTC_TIME, +}; + +/* + * shouldn't be changed after + * reading from alarm register + */ +static time_t alm_secs; + +static int alarm_get_time(enum alarm_time_type time_type, + time_t *secs) +{ + struct tm tm; + unsigned int cmd; + int rc, fd = -1; + + if (!secs) + return -1; + + fd = open("/dev/rtc0", O_RDONLY); + if (fd < 0) { + LOGE("Can't open rtc devfs node\n"); + return -1; + } + + switch (time_type) { + case ALARM_TIME: + cmd = RTC_ALM_READ; + break; + case RTC_TIME: + cmd = RTC_RD_TIME; + break; + default: + LOGE("Invalid time type\n"); + goto err; + } + + rc = ioctl(fd, cmd, &tm); + if (rc < 0) { + LOGE("Unable to get time\n"); + goto err; + } + + *secs = mktime(&tm) + tm.tm_gmtoff; + if (*secs < 0) { + LOGE("Invalid seconds = %ld\n", *secs); + goto err; + } + + close(fd); + return 0; + +err: + close(fd); + return -1; +} + +#define ERR_SECS 2 +static int alarm_is_alm_expired() +{ + int rc; + time_t rtc_secs; + + rc = alarm_get_time(RTC_TIME, &rtc_secs); + if (rc < 0) + return 0; + + return (alm_secs >= rtc_secs - ERR_SECS && + alm_secs <= rtc_secs + ERR_SECS) ? 1 : 0; +} + +static int timerfd_set_reboot_time_and_wait(time_t secs) +{ + int fd; + int ret = -1; + fd = timerfd_create(CLOCK_REALTIME_ALARM, 0); + if (fd < 0) { + LOGE("Can't open timerfd alarm node\n"); + goto err_return; + } + + struct itimerspec spec; + memset(&spec, 0, sizeof(spec)); + spec.it_value.tv_sec = secs; + + if (timerfd_settime(fd, 0 /* relative */, &spec, NULL)) { + LOGE("Can't set timerfd alarm\n"); + goto err_close; + } + + uint64_t unused; + if (read(fd, &unused, sizeof(unused)) < 0) { + LOGE("Wait alarm error\n"); + goto err_close; + } + + ret = 0; +err_close: + close(fd); +err_return: + return ret; +} + +static int alarm_set_reboot_time_and_wait(time_t secs) +{ + int rc, fd; + struct timespec ts; + + fd = open("/dev/alarm", O_RDWR); + if (fd < 0) { + LOGE("Can't open alarm devfs node, trying timerfd\n"); + return timerfd_set_reboot_time_and_wait(secs); + } + + /* get the elapsed realtime from boot time to now */ + rc = ioctl(fd, ANDROID_ALARM_GET_TIME( + ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP), &ts); + if (rc < 0) { + LOGE("Unable to get elapsed realtime\n"); + goto err; + } + + /* calculate the elapsed time from boot time to reboot time */ + ts.tv_sec += secs; + ts.tv_nsec = 0; + + rc = ioctl(fd, ANDROID_ALARM_SET( + ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP), &ts); + if (rc < 0) { + LOGE("Unable to set reboot time to %ld\n", secs); + goto err; + } + + do { + rc = ioctl(fd, ANDROID_ALARM_WAIT); + } while ((rc < 0 && errno == EINTR) || !alarm_is_alm_expired()); + + if (rc <= 0) { + LOGE("Unable to wait on alarm\n"); + goto err; + } + + close(fd); + return 0; + +err: + if (fd >= 0) + close(fd); + return -1; +} + +static void *alarm_thread(void *) +{ + time_t rtc_secs, rb_secs; + int rc; + + /* + * to support power off alarm, the time + * stored in alarm register at latest + * shutdown time should be some time + * earlier than the actual alarm time + * set by user + */ + rc = alarm_get_time(ALARM_TIME, &alm_secs); + LOGI("RTC Alarm %ld\n", alm_secs); + if (rc < 0 || !alm_secs) + goto err; + + rc = alarm_get_time(RTC_TIME, &rtc_secs); + LOGI("RTC Clock %ld\n", rtc_secs); + if (rc < 0) + goto err; + + /* + * calculate the reboot time after which + * the phone will reboot + */ + rb_secs = alm_secs - rtc_secs; + if (rb_secs <= 0) + goto err; + + rc = alarm_set_reboot_time_and_wait(rb_secs); + if (rc < 0) + goto err; + + LOGI("Exit from power off charging, reboot the phone!\n"); + android_reboot(ANDROID_RB_RESTART, 0, 0); + +err: + LOGE("Exit from alarm thread\n"); + return NULL; +} +#endif + +void healthd_board_init(struct healthd_config*) +{ + pthread_t tid; + char value[PROP_VALUE_MAX]; + int rc = 0, scale_count = 0, i; + GRSurface **scale_frames; + + rc = res_create_multi_display_surface("charger/cm_battery_scale", + &scale_count, &scale_frames); + if (rc < 0) { + LOGE("%s: Unable to load battery scale image", __func__); + return; + } + + anim.frames = new frame[scale_count]; + anim.num_frames = scale_count; + for (i = 0; i < anim.num_frames; i++) { + anim.frames[i].surface = scale_frames[i]; + anim.frames[i].min_capacity = 100/(scale_count-1) * i; + } + +#ifdef QCOM_HARDWARE + property_get("ro.bootmode", value, ""); + if (!strcmp("charger", value)) { + rc = pthread_create(&tid, NULL, alarm_thread, NULL); + if (rc < 0) + LOGE("Create alarm thread failed\n"); + } +#endif +} + +int healthd_board_battery_update(struct android::BatteryProperties*) +{ + // return 0 to log periodic polled battery status to kernel log + return 1; +} + +void healthd_board_mode_charger_draw_battery( + struct android::BatteryProperties *batt_prop) +{ + int start_frame = 0; + int capacity = -1; + + if (!font_inited) { + gr_set_font("log"); + font_inited = true; + } + + if (batt_prop && batt_prop->batteryLevel >= 0) { + capacity = batt_prop->batteryLevel; + } + + if (anim.num_frames == 0 || capacity < 0) { + LOGE("%s: Unable to draw battery", __func__); + return; + } + + // Find starting frame to display based on current capacity + for (start_frame = 1; start_frame < anim.num_frames; start_frame++) { + if (capacity < anim.frames[start_frame].min_capacity) + break; + } + // Always start from the level just below the current capacity + start_frame--; + + if (anim.cur_frame < start_frame) + anim.cur_frame = start_frame; + + draw_surface_centered(anim.frames[anim.cur_frame].surface); + draw_capacity(capacity); + // Move to next frame, with max possible frame at max_idx + anim.cur_frame = ((anim.cur_frame + 1) % anim.num_frames); +} + +void healthd_board_mode_charger_battery_update( + struct android::BatteryProperties*) +{ +} + +#ifdef HEALTHD_BACKLIGHT_PATH +#ifndef HEALTHD_BACKLIGHT_LEVEL +#define HEALTHD_BACKLIGHT_LEVEL 100 +#endif + +void healthd_board_mode_charger_set_backlight(bool on) +{ + int fd; + char buffer[10]; + + memset(buffer, '\0', sizeof(buffer)); + fd = open(HEALTHD_BACKLIGHT_PATH, O_RDWR); + if (fd < 0) { + LOGE("Could not open backlight node : %s\n", strerror(errno)); + return; + } + LOGV("Enabling backlight\n"); + snprintf(buffer, sizeof(buffer), "%d\n", on ? HEALTHD_BACKLIGHT_LEVEL : 0); + if (write(fd, buffer, strlen(buffer)) < 0) { + LOGE("Could not write to backlight : %s\n", strerror(errno)); + } + close(fd); + +#ifdef HEALTHD_SECONDARY_BACKLIGHT_PATH + fd = open(HEALTHD_SECONDARY_BACKLIGHT_PATH, O_RDWR); + if (fd < 0) { + LOGE("Could not open second backlight node : %s\n", strerror(errno)); + return; + } + LOGV("Enabling secondary backlight\n"); + if (write(fd, buffer, strlen(buffer)) < 0) { + LOGE("Could not write to second backlight : %s\n", strerror(errno)); + return; + } + close(fd); +#endif +} + +#else +void healthd_board_mode_charger_set_backlight(bool) +{ +} +#endif + +void healthd_board_mode_charger_init(void) +{ +} diff --git a/charger/images/560dpi b/charger/images/560dpi new file mode 120000 index 00000000..af2d1fe7 --- /dev/null +++ b/charger/images/560dpi @@ -0,0 +1 @@ +xxxhdpi \ No newline at end of file diff --git a/charger/images/640dpi b/charger/images/640dpi new file mode 120000 index 00000000..af2d1fe7 --- /dev/null +++ b/charger/images/640dpi @@ -0,0 +1 @@ +xxxhdpi \ No newline at end of file diff --git a/charger/images/hdpi/battery_fail.png b/charger/images/hdpi/battery_fail.png new file mode 100644 index 00000000..aded88a0 Binary files /dev/null and b/charger/images/hdpi/battery_fail.png differ diff --git a/charger/images/hdpi/cm_battery_scale.png b/charger/images/hdpi/cm_battery_scale.png new file mode 100644 index 00000000..0052c0ae Binary files /dev/null and b/charger/images/hdpi/cm_battery_scale.png differ diff --git a/charger/images/ldpi/battery_fail.png b/charger/images/ldpi/battery_fail.png new file mode 100644 index 00000000..aded88a0 Binary files /dev/null and b/charger/images/ldpi/battery_fail.png differ diff --git a/charger/images/ldpi/cm_battery_scale.png b/charger/images/ldpi/cm_battery_scale.png new file mode 100644 index 00000000..b93c3af9 Binary files /dev/null and b/charger/images/ldpi/cm_battery_scale.png differ diff --git a/charger/images/mdpi/battery_fail.png b/charger/images/mdpi/battery_fail.png new file mode 100644 index 00000000..aded88a0 Binary files /dev/null and b/charger/images/mdpi/battery_fail.png differ diff --git a/charger/images/mdpi/cm_battery_scale.png b/charger/images/mdpi/cm_battery_scale.png new file mode 100644 index 00000000..eb16a292 Binary files /dev/null and b/charger/images/mdpi/cm_battery_scale.png differ diff --git a/charger/images/xhdpi/battery_fail.png b/charger/images/xhdpi/battery_fail.png new file mode 100644 index 00000000..aded88a0 Binary files /dev/null and b/charger/images/xhdpi/battery_fail.png differ diff --git a/charger/images/xhdpi/cm_battery_scale.png b/charger/images/xhdpi/cm_battery_scale.png new file mode 100644 index 00000000..078b2a66 Binary files /dev/null and b/charger/images/xhdpi/cm_battery_scale.png differ diff --git a/charger/images/xxhdpi/battery_fail.png b/charger/images/xxhdpi/battery_fail.png new file mode 100644 index 00000000..aded88a0 Binary files /dev/null and b/charger/images/xxhdpi/battery_fail.png differ diff --git a/charger/images/xxhdpi/cm_battery_scale.png b/charger/images/xxhdpi/cm_battery_scale.png new file mode 100644 index 00000000..2e6553ed Binary files /dev/null and b/charger/images/xxhdpi/cm_battery_scale.png differ diff --git a/charger/images/xxxhdpi/battery_fail.png b/charger/images/xxxhdpi/battery_fail.png new file mode 100644 index 00000000..aded88a0 Binary files /dev/null and b/charger/images/xxxhdpi/battery_fail.png differ diff --git a/charger/images/xxxhdpi/cm_battery_scale.png b/charger/images/xxxhdpi/cm_battery_scale.png new file mode 100644 index 00000000..90c627d4 Binary files /dev/null and b/charger/images/xxxhdpi/cm_battery_scale.png differ diff --git a/config/BoardConfigCM.mk b/config/BoardConfigCM.mk new file mode 100644 index 00000000..a8bf1ad0 --- /dev/null +++ b/config/BoardConfigCM.mk @@ -0,0 +1,4 @@ +# Charger +ifneq ($(WITH_CM_CHARGER),false) + BOARD_HAL_STATIC_LIBRARIES := libhealthd.cm +endif diff --git a/config/cmsdk_common.mk b/config/cmsdk_common.mk index c50f5ae3..e8b19079 100644 --- a/config/cmsdk_common.mk +++ b/config/cmsdk_common.mk @@ -1,7 +1,16 @@ # Permissions for cmsdk services PRODUCT_COPY_FILES += \ + vendor/replicant/config/permissions/org.cyanogenmod.appsuggest.xml:system/etc/permissions/org.cyanogenmod.appsuggest.xml \ + vendor/replicant/config/permissions/org.cyanogenmod.audio.xml:system/etc/permissions/org.cyanogenmod.audio.xml \ + vendor/replicant/config/permissions/org.cyanogenmod.livedisplay.xml:system/etc/permissions/org.cyanogenmod.livedisplay.xml \ + vendor/replicant/config/permissions/org.cyanogenmod.livelockscreen.xml:system/etc/permissions/org.cyanogenmod.livelockscreen.xml \ + vendor/replicant/config/permissions/org.cyanogenmod.partner.xml:system/etc/permissions/org.cyanogenmod.partner.xml \ + vendor/replicant/config/permissions/org.cyanogenmod.performance.xml:system/etc/permissions/org.cyanogenmod.performance.xml \ + vendor/replicant/config/permissions/org.cyanogenmod.profiles.xml:system/etc/permissions/org.cyanogenmod.profiles.xml \ + vendor/replicant/config/permissions/org.cyanogenmod.statusbar.xml:system/etc/permissions/org.cyanogenmod.statusbar.xml \ + vendor/replicant/config/permissions/org.cyanogenmod.telephony.xml:system/etc/permissions/org.cyanogenmod.telephony.xml \ vendor/replicant/config/permissions/org.cyanogenmod.theme.xml:system/etc/permissions/org.cyanogenmod.theme.xml \ - vendor/replicant/config/permissions/org.cyanogenmod.livelockscreen.xml:system/etc/permissions/org.cyanogenmod.livelockscreen.xml + vendor/replicant/config/permissions/org.cyanogenmod.weather.xml:system/etc/permissions/org.cyanogenmod.weather.xml # CM Platform Library PRODUCT_PACKAGES += \ @@ -14,6 +23,10 @@ PRODUCT_PACKAGES += \ org.cyanogenmod.hardware \ org.cyanogenmod.hardware.xml +# JNI Libraries +PRODUCT_PACKAGES += \ + libcmsdk_platform_jni + ifndef CM_PLATFORM_SDK_VERSION # This is the canonical definition of the SDK version, which defines # the set of APIs and functionality available in the platform. It @@ -21,7 +34,7 @@ ifndef CM_PLATFORM_SDK_VERSION # the SDK are released. It should only be incremented when the APIs for # the new release are frozen (so that developers don't write apps against # intermediate builds). - CM_PLATFORM_SDK_VERSION := 5 + CM_PLATFORM_SDK_VERSION := 6 endif ifndef CM_PLATFORM_REV diff --git a/config/common.mk b/config/common.mk index 3ee9b909..f2c8e766 100644 --- a/config/common.mk +++ b/config/common.mk @@ -33,14 +33,6 @@ PRODUCT_BOOTANIMATION := vendor/replicant/prebuilt/common/bootanimation/$(TARGET endif endif -ifdef CM_NIGHTLY -PRODUCT_PROPERTY_OVERRIDES += \ - ro.rommanager.developerid=cyanogenmodnightly -else -PRODUCT_PROPERTY_OVERRIDES += \ - ro.rommanager.developerid=cyanogenmod -endif - PRODUCT_BUILD_PROP_OVERRIDES += BUILD_UTC_DATE=0 ifeq ($(PRODUCT_GMS_CLIENTID_BASE),) @@ -63,6 +55,11 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PROPERTY_OVERRIDES += \ ro.build.selinux=1 +# Default notification/alarm sounds +PRODUCT_PROPERTY_OVERRIDES += \ + ro.config.notification_sound=Argon.ogg \ + ro.config.alarm_alert=Helium.ogg + ifneq ($(TARGET_BUILD_VARIANT),user) # Thank you, please drive thru! PRODUCT_PROPERTY_OVERRIDES += persist.sys.dun.override=0 @@ -78,13 +75,15 @@ PRODUCT_COPY_FILES += \ vendor/replicant/CHANGELOG.mkdn:system/etc/CHANGELOG-CM.txt # Backup Tool -ifneq ($(WITH_GMS),true) PRODUCT_COPY_FILES += \ vendor/replicant/prebuilt/common/bin/backuptool.sh:install/bin/backuptool.sh \ vendor/replicant/prebuilt/common/bin/backuptool.functions:install/bin/backuptool.functions \ vendor/replicant/prebuilt/common/bin/50-cm.sh:system/addon.d/50-cm.sh \ vendor/replicant/prebuilt/common/bin/blacklist:system/addon.d/blacklist -endif + +# Backup Services whitelist +PRODUCT_COPY_FILES += \ + vendor/cm/config/permissions/backup.xml:system/etc/sysconfig/backup.xml # Signature compatibility validation PRODUCT_COPY_FILES += \ @@ -125,6 +124,9 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ vendor/replicant/config/permissions/com.cyanogenmod.android.xml:system/etc/permissions/com.cyanogenmod.android.xml +# Include CM audio files +include vendor/cm/config/cm_audio.mk + # Theme engine include vendor/replicant/config/themes_common.mk @@ -133,14 +135,18 @@ include vendor/replicant/config/cmsdk_common.mk # Required CM packages PRODUCT_PACKAGES += \ + CMAudioService \ Development \ BluetoothExt \ - Profiles + Profiles \ + ThemeManagerService \ + WeatherManagerService # Optional CM packages PRODUCT_PACKAGES += \ libemoji \ - Terminal + Terminal \ + LiveWallpapersPicker # Include librsjni explicitly to workaround GMS issue PRODUCT_PACKAGES += \ @@ -156,7 +162,13 @@ PRODUCT_PACKAGES += \ Eleven \ LockClock \ CMSettingsProvider \ - ExactCalculator + ExactCalculator \ + LiveLockScreenService \ + WeatherProvider \ + DataUsageProvider \ + WallpaperPicker \ + SoundRecorder \ + Screencast # Exchange support PRODUCT_PACKAGES += \ @@ -177,8 +189,29 @@ PRODUCT_PACKAGES += \ oprofiled \ sqlite3 \ strace \ - pigz + pigz \ + 7z \ + lib7z \ + bash \ + bzip2 \ + curl \ + powertop \ + unrar \ + unzip \ + vim \ + wget \ + zip +# Custom off-mode charger +ifneq ($(WITH_CM_CHARGER),false) +PRODUCT_PACKAGES += \ + charger_res_images \ + cm_charger_res_images \ + font_log.png \ + libhealthd.cm +endif + +# ExFAT support WITH_EXFAT ?= true ifeq ($(WITH_EXFAT),true) TARGET_USES_EXFAT := true @@ -266,8 +299,12 @@ ifneq ($(PRODUCT_DEFAULT_DEV_CERTIFICATE),build/target/product/security/testkey) else TARGET_VENDOR_RELEASE_BUILD_ID := $(TARGET_VENDOR_RELEASE_BUILD_ID) endif - CM_DISPLAY_VERSION=$(PRODUCT_VERSION_MAJOR).$(PRODUCT_VERSION_MINOR)-$(TARGET_VENDOR_RELEASE_BUILD_ID) - endif + ifeq ($(CM_VERSION_MAINTENANCE),0) + CM_DISPLAY_VERSION := $(PRODUCT_VERSION_MAJOR).$(PRODUCT_VERSION_MINOR)-$(TARGET_VENDOR_RELEASE_BUILD_ID)-$(CM_BUILD) + else + CM_DISPLAY_VERSION := $(PRODUCT_VERSION_MAJOR).$(PRODUCT_VERSION_MINOR).$(CM_VERSION_MAINTENANCE)-$(TARGET_VENDOR_RELEASE_BUILD_ID)-$(CM_BUILD) + endif +endif endif endif diff --git a/config/common_full.mk b/config/common_full.mk index 59e034d5..1e07256e 100644 --- a/config/common_full.mk +++ b/config/common_full.mk @@ -1,15 +1,13 @@ # Inherit common CM stuff $(call inherit-product, vendor/replicant/config/common.mk) -# Include CM audio files -include vendor/replicant/config/cm_audio.mk +PRODUCT_SIZE := full ifeq ($(USE_OPENGL_RENDERER),true) PRODUCT_PACKAGES += \ Galaxy4 \ HoloSpiralWallpaper \ LiveWallpapers \ - LiveWallpapersPicker \ MagicSmokeWallpapers endif @@ -17,20 +15,8 @@ PRODUCT_PACKAGES += \ NoiseField \ PhaseBeam \ PhotoTable \ - SoundRecorder \ - PhotoPhase \ - Screencast + PhotoPhase -# Extra tools in CM +# Themes PRODUCT_PACKAGES += \ - 7z \ - lib7z \ - bash \ - bzip2 \ - curl \ - powertop \ - unrar \ - unzip \ - vim \ - wget \ - zip + HexoLibre diff --git a/config/common_full_phone.mk b/config/common_full_phone.mk index 7c19dda5..222e9445 100644 --- a/config/common_full_phone.mk +++ b/config/common_full_phone.mk @@ -8,11 +8,6 @@ PRODUCT_PACKAGES += \ # Include CM LatinIME dictionaries PRODUCT_PACKAGE_OVERLAYS += vendor/replicant/overlay/dictionaries -# Default notification/alarm sounds -PRODUCT_PROPERTY_OVERRIDES += \ - ro.config.notification_sound=Argon.ogg \ - ro.config.alarm_alert=Helium.ogg - ifeq ($(TARGET_SCREEN_WIDTH) $(TARGET_SCREEN_HEIGHT),$(space)) PRODUCT_COPY_FILES += \ vendor/replicant/prebuilt/common/bootanimation/vertical-480x800.zip:system/media/bootanimation.zip diff --git a/config/common_full_tablet_wifionly.mk b/config/common_full_tablet_wifionly.mk index fc1cf9cf..5bcbcf1d 100644 --- a/config/common_full_tablet_wifionly.mk +++ b/config/common_full_tablet_wifionly.mk @@ -8,12 +8,7 @@ PRODUCT_PACKAGES += \ # Include CM LatinIME dictionaries PRODUCT_PACKAGE_OVERLAYS += vendor/cm/overlay/dictionaries -# Default notification/alarm sounds -PRODUCT_PROPERTY_OVERRIDES += \ - ro.config.notification_sound=Argon.ogg \ - ro.config.alarm_alert=Helium.ogg - -ifeq ($(TARGET_BOOTANIMATION_NAME),) +ifeq ($(TARGET_SCREEN_WIDTH) $(TARGET_SCREEN_HEIGHT),$(space)) PRODUCT_COPY_FILES += \ vendor/replicant/prebuilt/common/bootanimation/horizontal-1280x800.zip:system/media/bootanimation.zip endif diff --git a/config/common_full_tv.mk b/config/common_full_tv.mk index f7689b7e..779b918c 100644 --- a/config/common_full_tv.mk +++ b/config/common_full_tv.mk @@ -1,11 +1,6 @@ # Inherit common CM stuff $(call inherit-product, vendor/cm/config/common_full.mk) -# Default notification/alarm sounds -PRODUCT_PROPERTY_OVERRIDES += \ - ro.config.notification_sound=Argon.ogg \ - ro.config.alarm_alert=Helium.ogg - ifeq ($(TARGET_SCREEN_WIDTH) $(TARGET_SCREEN_HEIGHT),$(space)) PRODUCT_COPY_FILES += \ vendor/cm/prebuilt/common/bootanimation/800.zip:system/media/bootanimation.zip diff --git a/config/common_mini.mk b/config/common_mini.mk new file mode 100644 index 00000000..ab1af912 --- /dev/null +++ b/config/common_mini.mk @@ -0,0 +1,4 @@ +# Inherit common CM stuff +$(call inherit-product, vendor/cm/config/common.mk) + +PRODUCT_SIZE := mini diff --git a/config/common_mini_phone.mk b/config/common_mini_phone.mk index d6344e27..4700b145 100644 --- a/config/common_mini_phone.mk +++ b/config/common_mini_phone.mk @@ -1,19 +1,10 @@ -# Inherit common CM stuff -$(call inherit-product, vendor/replicant/config/common.mk) - -# Include CM audio files -include vendor/replicant/config/cm_audio.mk +$(call inherit-product, vendor/replicant/config/common_mini.mk) # Required CM packages PRODUCT_PACKAGES += \ LatinIME -# Default notification/alarm sounds -PRODUCT_PROPERTY_OVERRIDES += \ - ro.config.notification_sound=Argon.ogg \ - ro.config.alarm_alert=Helium.ogg - -ifeq ($(TARGET_BOOTANIMATION_NAME),) +ifeq ($(TARGET_SCREEN_WIDTH) $(TARGET_SCREEN_HEIGHT),$(space)) PRODUCT_COPY_FILES += \ vendor/replicant/prebuilt/common/bootanimation/vertical-320x480.zip:system/media/bootanimation.zip endif diff --git a/config/common_mini_tablet_wifionly.mk b/config/common_mini_tablet_wifionly.mk index 5ebe2a50..fa00a63f 100644 --- a/config/common_mini_tablet_wifionly.mk +++ b/config/common_mini_tablet_wifionly.mk @@ -1,19 +1,11 @@ # Inherit common CM stuff -$(call inherit-product, vendor/replicant/config/common.mk) - -# Include CM audio files -include vendor/replicant/config/cm_audio.mk +$(call inherit-product, vendor/replicant/config/common_mini.mk) # Required CM packages PRODUCT_PACKAGES += \ LatinIME -# Default notification/alarm sounds -PRODUCT_PROPERTY_OVERRIDES += \ - ro.config.notification_sound=Argon.ogg \ - ro.config.alarm_alert=Helium.ogg - -ifeq ($(TARGET_BOOTANIMATION_NAME),) +ifeq ($(TARGET_SCREEN_WIDTH) $(TARGET_SCREEN_HEIGHT),$(space)) PRODUCT_COPY_FILES += \ vendor/replicant/prebuilt/common/bootanimation/horizontal-1024x600.zip:system/media/bootanimation.zip endif diff --git a/config/common_mini_tv.mk b/config/common_mini_tv.mk index 57256ed4..63f2bcf3 100644 --- a/config/common_mini_tv.mk +++ b/config/common_mini_tv.mk @@ -1,13 +1,5 @@ # Inherit common CM stuff -$(call inherit-product, vendor/cm/config/common.mk) - -# Include CM audio files -include vendor/cm/config/cm_audio.mk - -# Default notification/alarm sounds -PRODUCT_PROPERTY_OVERRIDES += \ - ro.config.notification_sound=Argon.ogg \ - ro.config.alarm_alert=Helium.ogg +$(call inherit-product, vendor/cm/config/common_mini.mk) ifeq ($(TARGET_SCREEN_WIDTH) $(TARGET_SCREEN_HEIGHT),$(space)) PRODUCT_COPY_FILES += \ diff --git a/config/permissions/backup.xml b/config/permissions/backup.xml new file mode 100644 index 00000000..c335b298 --- /dev/null +++ b/config/permissions/backup.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/config/permissions/org.cyanogenmod.appsuggest.xml b/config/permissions/org.cyanogenmod.appsuggest.xml new file mode 100644 index 00000000..e8a98083 --- /dev/null +++ b/config/permissions/org.cyanogenmod.appsuggest.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/config/permissions/org.cyanogenmod.audio.xml b/config/permissions/org.cyanogenmod.audio.xml new file mode 100644 index 00000000..1a5d122c --- /dev/null +++ b/config/permissions/org.cyanogenmod.audio.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/config/permissions/org.cyanogenmod.livedisplay.xml b/config/permissions/org.cyanogenmod.livedisplay.xml new file mode 100644 index 00000000..bfae5d31 --- /dev/null +++ b/config/permissions/org.cyanogenmod.livedisplay.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/config/permissions/org.cyanogenmod.partner.xml b/config/permissions/org.cyanogenmod.partner.xml new file mode 100644 index 00000000..1526830e --- /dev/null +++ b/config/permissions/org.cyanogenmod.partner.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/config/permissions/org.cyanogenmod.performance.xml b/config/permissions/org.cyanogenmod.performance.xml new file mode 100644 index 00000000..464de6e5 --- /dev/null +++ b/config/permissions/org.cyanogenmod.performance.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/config/permissions/org.cyanogenmod.profiles.xml b/config/permissions/org.cyanogenmod.profiles.xml new file mode 100644 index 00000000..6a455260 --- /dev/null +++ b/config/permissions/org.cyanogenmod.profiles.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/config/permissions/org.cyanogenmod.statusbar.xml b/config/permissions/org.cyanogenmod.statusbar.xml new file mode 100644 index 00000000..562bf9e9 --- /dev/null +++ b/config/permissions/org.cyanogenmod.statusbar.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/config/permissions/org.cyanogenmod.telephony.xml b/config/permissions/org.cyanogenmod.telephony.xml new file mode 100644 index 00000000..3e89e8a5 --- /dev/null +++ b/config/permissions/org.cyanogenmod.telephony.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/config/permissions/org.cyanogenmod.weather.xml b/config/permissions/org.cyanogenmod.weather.xml new file mode 100644 index 00000000..69cd0b7a --- /dev/null +++ b/config/permissions/org.cyanogenmod.weather.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/config/telephony.mk b/config/telephony.mk index b28e26f1..39a2ff84 100644 --- a/config/telephony.mk +++ b/config/telephony.mk @@ -2,10 +2,6 @@ PRODUCT_COPY_FILES += \ vendor/replicant/prebuilt/common/etc/apns-conf.xml:system/etc/apns-conf.xml -# Selective SPN list for operator number who has the problem. -PRODUCT_COPY_FILES += \ - vendor/replicant/prebuilt/common/etc/selective-spn-conf.xml:system/etc/selective-spn-conf.xml - # Telephony packages PRODUCT_PACKAGES += \ messaging \ diff --git a/gello/Android.mk b/gello/Android.mk new file mode 100644 index 00000000..1cf0cd06 --- /dev/null +++ b/gello/Android.mk @@ -0,0 +1,51 @@ +# +# Copyright (C) 2016 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) + +SOURCE_GELLO_PATH := $(LOCAL_PATH)/../../../external/gello-build + +include $(CLEAR_VARS) + +LOCAL_MODULE := Gello +LOCAL_MODULE_CLASS := APPS +LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) + +LOCAL_OVERRIDES_PACKAGES := Browser + +ifeq ($(WITH_GELLO_SOURCE),true) +# Build from source +ifeq ($(LOCAL_GELLO),true) +BUILD_GELLO := $(info $(shell bash $(SOURCE_GELLO_PATH)/gello_build.sh --local 1>&2)) +else +BUILD_GELLO := $(info $(shell bash $(SOURCE_GELLO_PATH)/gello_build.sh 1>&2)) +endif +LOCAL_SRC_FILES := ../../../external/gello-build/Gello.apk +include $(BUILD_PREBUILT) +else + +LOCAL_DEX_PREOPT := false +LOCAL_MODULE_TAGS := optional +LOCAL_BUILT_MODULE_STEM := package.apk +LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) + +LOCAL_MAVEN_REPO := https://maven.cyanogenmod.org/artifactory/gello_prebuilds +LOCAL_MAVEN_GROUP := org.cyanogenmod +LOCAL_MAVEN_VERSION := 40 +LOCAL_MAVEN_ARTIFACT := gello +LOCAL_MAVEN_PACKAGING := apk + +include $(BUILD_MAVEN_PREBUILT) +endif diff --git a/overlay/common/frameworks/base/core/res/res/values/cm_arrays.xml b/overlay/common/frameworks/base/core/res/res/values/cm_arrays.xml new file mode 100644 index 00000000..3cc10111 --- /dev/null +++ b/overlay/common/frameworks/base/core/res/res/values/cm_arrays.xml @@ -0,0 +1,24 @@ + + + + + com.cyanogen.ambient.core + com.cyanogen.ambient.updater + com.cyngn.devicemanager + com.cyngn.discovery + + \ No newline at end of file diff --git a/overlay/common/frameworks/base/core/res/res/values/config.xml b/overlay/common/frameworks/base/core/res/res/values/config.xml index 214ceb98..403890ed 100644 --- a/overlay/common/frameworks/base/core/res/res/values/config.xml +++ b/overlay/common/frameworks/base/core/res/res/values/config.xml @@ -53,4 +53,10 @@ bugreport users + + + true + + + true diff --git a/overlay/common/packages/apps/Settings/res/values/strings.xml b/overlay/common/packages/apps/Settings/res/values/strings.xml index 6a59a0ac..93758ea3 100644 --- a/overlay/common/packages/apps/Settings/res/values/strings.xml +++ b/overlay/common/packages/apps/Settings/res/values/strings.xml @@ -16,5 +16,8 @@ https://support.google.com/wallet/answer/1347934 + + + https://support.google.com diff --git a/overlay/common/packages/services/Telecomm/res/values/cm_config.xml b/overlay/common/packages/services/Telecomm/res/values/cm_config.xml index c2083960..958422be 100644 --- a/overlay/common/packages/services/Telecomm/res/values/cm_config.xml +++ b/overlay/common/packages/services/Telecomm/res/values/cm_config.xml @@ -18,12 +18,10 @@ com.android.dialer/com.android.incallui.InCallServiceImpl - com.cyngn.dialer/com.android.incallui.InCallServiceImpl com.android.dialer/com.android.dialer.DialtactsActivity - com.cyngn.dialer/com.android.dialer.DialtactsActivity diff --git a/overlay/common/packages/services/Telephony/res/values/cm_config.xml b/overlay/common/packages/services/Telephony/res/values/cm_config.xml index 155ed8c4..cc13e494 100644 --- a/overlay/common/packages/services/Telephony/res/values/cm_config.xml +++ b/overlay/common/packages/services/Telephony/res/values/cm_config.xml @@ -17,6 +17,5 @@ com.android.dialer/com.android.dialer.DialtactsActivity - com.cyngn.dialer/com.android.dialer.DialtactsActivity diff --git a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_bg.dict b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_bg.dict index 62a3583a..322186b5 100644 Binary files a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_bg.dict and b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_bg.dict differ diff --git a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_en_au.dict b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_en_au.dict index f06af14c..644e7ff4 100644 Binary files a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_en_au.dict and b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_en_au.dict differ diff --git a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_hu.dict b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_hu.dict deleted file mode 100644 index 2b8dce0f..00000000 Binary files a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_hu.dict and /dev/null differ diff --git a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_ka.dict b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_ka.dict index 4c76a6d5..86c49f5f 100644 Binary files a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_ka.dict and b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_ka.dict differ diff --git a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_lb.dict b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_lb.dict index 56fd0cdd..99cc4080 100644 Binary files a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_lb.dict and b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_lb.dict differ diff --git a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_uk.dict b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_uk.dict index f38cc416..15715cf6 100644 Binary files a/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_uk.dict and b/overlay/dictionaries/packages/inputmethods/LatinIME/java/res/raw/main_uk.dict differ diff --git a/prebuilt/common/etc/apns-conf.xml b/prebuilt/common/etc/apns-conf.xml index dcea5f40..4c32e431 100644 --- a/prebuilt/common/etc/apns-conf.xml +++ b/prebuilt/common/etc/apns-conf.xml @@ -70,13 +70,15 @@ + + - + @@ -283,9 +285,8 @@ - - - + + @@ -368,8 +369,8 @@ - - + + @@ -896,7 +897,7 @@ - + @@ -908,7 +909,7 @@ - + @@ -1078,18 +1079,9 @@ - - - - - - - - - @@ -1105,13 +1097,6 @@ - - - - - - - @@ -1145,16 +1130,10 @@ - - - - - - - + + + - - @@ -1165,6 +1144,7 @@ + @@ -1257,10 +1237,10 @@ + - - + @@ -1273,8 +1253,8 @@ - - + + @@ -1375,6 +1355,7 @@ + @@ -1417,7 +1398,6 @@ - @@ -1430,10 +1410,9 @@ - - - - + + + @@ -1462,6 +1441,7 @@ + @@ -1484,9 +1464,11 @@ + + + - @@ -1533,6 +1515,10 @@ + + + + @@ -1643,6 +1629,7 @@ + @@ -1887,39 +1874,84 @@ - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2244,10 +2276,10 @@ - - - - + + + + @@ -2276,10 +2308,10 @@ - - - - + + + + @@ -2340,9 +2372,9 @@ - - - + + + @@ -2391,29 +2423,29 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + @@ -2667,68 +2699,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2910,14 +2880,12 @@ - - - - - - - - + + + + + + @@ -2947,7 +2915,7 @@ - + @@ -3049,9 +3017,9 @@ - - - + + + @@ -3093,6 +3061,7 @@ + @@ -3314,6 +3283,7 @@ + @@ -3325,6 +3295,7 @@ + @@ -3346,8 +3317,8 @@ - - + + @@ -3374,9 +3345,15 @@ - - - + + + + + + + + + @@ -3629,7 +3606,6 @@ - @@ -3826,7 +3802,7 @@ - + diff --git a/prebuilt/common/etc/init.local.rc b/prebuilt/common/etc/init.local.rc index 1f66b776..2a5316d4 100644 --- a/prebuilt/common/etc/init.local.rc +++ b/prebuilt/common/etc/init.local.rc @@ -29,6 +29,10 @@ on post-fs-data # Run sysinit start sysinit + # Change permissions on fsck log so it can be added to the dropbox + chown root log /dev/fscklogs/log + chmod 0640 /dev/fscklogs/log + on boot # interactive governor chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate @@ -102,6 +106,18 @@ on boot chmod 0664 /sys/block/mmcblk0/queue/scheduler restorecon /sys/block/mmcblk0/queue/scheduler + chown system system /sys/block/sda/queue/scheduler + chmod 0664 /sys/block/sda/queue/scheduler + restorecon /sys/block/sda/queue/scheduler + + chown system system /sys/block/sde/queue/scheduler + chmod 0664 /sys/block/sde/queue/scheduler + restorecon /sys/block/sde/queue/scheduler + + chown system system /sys/block/dm-0/queue/scheduler + chmod 0664 /sys/block/dm-0/queue/scheduler + restorecon /sys/block/dm-0/queue/scheduler + chown system system /dev/cpuctl/cpu.notify_on_migrate chmod 0664 /dev/cpuctl/cpu.notify_on_migrate @@ -114,6 +130,12 @@ on boot chmod 0660 /sys/devices/virtual/graphics/fb0/rgb chown system system /sys/devices/virtual/graphics/fb0/sre chmod 0660 /sys/devices/virtual/graphics/fb0/sre + chown system system /sys/devices/virtual/graphics/fb0/color_enhance + chmod 0660 /sys/devices/virtual/graphics/fb0/color_enhance + + # Vibrator intensity control + chown system system /sys/class/timed_output/vibrator/vtg_level + chmod 0644 /sys/class/timed_output/vibrator/vtg_level # Define TCP delayed ack settings for WiFi & LTE chown system system /sys/kernel/ipv4/tcp_delack_seg @@ -165,6 +187,10 @@ on property:persist.radio.noril=1 # Configure IO scheduler on property:sys.io.scheduler=* write /sys/block/mmcblk0/queue/scheduler ${sys.io.scheduler} + write /sys/block/mmcblk1/queue/scheduler ${sys.io.scheduler} + write /sys/block/sda/queue/scheduler ${sys.io.scheduler} + write /sys/block/sde/queue/scheduler ${sys.io.scheduler} + write /sys/block/dm-0/queue/scheduler ${sys.io.scheduler} on property:persist.sys.io.scheduler=* setprop sys.io.scheduler ${persist.sys.io.scheduler} @@ -172,8 +198,16 @@ on property:persist.sys.io.scheduler=* # Set slice_idle to 0 for CFQ on property:sys.io.scheduler=cfq write /sys/block/mmcblk0/queue/iosched/slice_idle 0 + write /sys/block/mmcblk1/queue/iosched/slice_idle 0 + write /sys/block/sda/queue/iosched/slice_idle 0 + write /sys/block/sde/queue/iosched/slice_idle 0 + write /sys/block/dm-0/queue/iosched/slice_idle 0 # Set slice_idle to 0 for BFQ on property:sys.io.scheduler=bfq write /sys/block/mmcblk0/queue/iosched/slice_idle 0 + write /sys/block/mmcblk1/queue/iosched/slice_idle 0 + write /sys/block/sda/queue/iosched/slice_idle 0 + write /sys/block/sde/queue/iosched/slice_idle 0 + write /sys/block/dm-0/queue/iosched/slice_idle 0 diff --git a/prebuilt/common/etc/selective-spn-conf.xml b/prebuilt/common/etc/selective-spn-conf.xml deleted file mode 100755 index e227705a..00000000 --- a/prebuilt/common/etc/selective-spn-conf.xml +++ /dev/null @@ -1,1710 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sepolicy/app.te b/sepolicy/app.te index e590efec..6405e20b 100644 --- a/sepolicy/app.te +++ b/sepolicy/app.te @@ -4,5 +4,5 @@ allow appdomain sdcard_posix:dir r_dir_perms; allow appdomain sdcard_posix:file rw_file_perms; # Themed resources (i.e. composed icons) -allow appdomain theme_data_file:dir r_dir_perms; -allow appdomain theme_data_file:file r_file_perms; +allow appdomain themeservice_app_data_file:dir r_dir_perms; +allow appdomain themeservice_app_data_file:file r_file_perms; diff --git a/sepolicy/bootanim.te b/sepolicy/bootanim.te index 8739a870..91273bd0 100644 --- a/sepolicy/bootanim.te +++ b/sepolicy/bootanim.te @@ -1,5 +1,5 @@ # Themed resources (bootanimation) -allow bootanim theme_data_file:dir search; -allow bootanim theme_data_file:file r_file_perms; +allow bootanim themeservice_app_data_file:dir search; +allow bootanim themeservice_app_data_file:file r_file_perms; allow bootanim self:process execmem; -allow bootanim ashmem_device:chr_file execute; \ No newline at end of file +allow bootanim ashmem_device:chr_file execute; diff --git a/sepolicy/drmserver.te b/sepolicy/drmserver.te index 63f654fd..508791f4 100644 --- a/sepolicy/drmserver.te +++ b/sepolicy/drmserver.te @@ -1 +1 @@ -allow drmserver theme_data_file:file r_file_perms; +allow drmserver themeservice_app_data_file:file r_file_perms; diff --git a/sepolicy/file.te b/sepolicy/file.te index 1a003394..05e3c5d2 100644 --- a/sepolicy/file.te +++ b/sepolicy/file.te @@ -4,7 +4,7 @@ allow file_type rootfs:filesystem associate; type auditd_log, file_type, data_file_type; # Themes -type theme_data_file, file_type, data_file_type; +type themeservice_app_data_file, file_type, data_file_type; # Performance settings type sysfs_devices_system_iosched, file_type, sysfs_type; diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts index 7024d1e0..bcc9217c 100644 --- a/sepolicy/file_contexts +++ b/sepolicy/file_contexts @@ -7,7 +7,7 @@ /data/misc/audit(/.*)? u:object_r:auditd_log:s0 # Themes -/data/system/theme(/.*)? u:object_r:theme_data_file:s0 +/data/system/theme(/.*)? u:object_r:themeservice_app_data_file:s0 /system/bin/sysinit u:object_r:sysinit_exec:s0 @@ -24,8 +24,8 @@ ############################# # performance-related sysfs files (CM) -/sys/devices/system/cpu.*/cpufreq(/.*)? -- u:object_r:sysfs_devices_system_cpu:s0 -/sys/block/mmcblk.*/queue/scheduler -- u:object_r:sysfs_devices_system_iosched:s0 +/sys/devices/system/cpu.*/cpufreq(/.*)? u:object_r:sysfs_devices_system_cpu:s0 +/sys/block/mmcblk.*/queue/scheduler u:object_r:sysfs_devices_system_iosched:s0 /data/hostapd(/.*)? u:object_r:wifi_data_file:s0 @@ -47,7 +47,11 @@ /sys/devices/virtual/graphics/fb0/cabc u:object_r:livedisplay_sysfs:s0 /sys/devices/virtual/graphics/fb0/rgb u:object_r:livedisplay_sysfs:s0 /sys/devices/virtual/graphics/fb0/sre u:object_r:livedisplay_sysfs:s0 +/sys/devices/virtual/graphics/fb0/color_enhance u:object_r:livedisplay_sysfs:s0 # fsck /system/bin/fsck\.ntfs u:object_r:fsck_exec:s0 /system/bin/fsck\.exfat u:object_r:fsck_exec:s0 + +# bash +/system/xbin/bash u:object_r:shell_exec:s0 diff --git a/sepolicy/installd.te b/sepolicy/installd.te index 65f471a4..c2405990 100644 --- a/sepolicy/installd.te +++ b/sepolicy/installd.te @@ -1,3 +1,8 @@ # Allow querying of asec size on SD card allow installd sdcard_external:dir { search }; allow installd sdcard_external:file { getattr }; + +# Required for installd to create theme service's /data/data directory +allow installd themeservice_app_data_file:dir { create_dir_perms relabelfrom relabelto }; +allow installd themeservice_app_data_file:lnk_file { create_file_perms relabelfrom relabelto }; +allow installd themeservice_app_data_file:{ file sock_file fifo_file } { getattr unlink rename relabelfrom relabelto setattr }; diff --git a/sepolicy/kernel.te b/sepolicy/kernel.te new file mode 100644 index 00000000..2984b772 --- /dev/null +++ b/sepolicy/kernel.te @@ -0,0 +1,3 @@ +# used by sdcardfs to read package list +allow kernel system_data_file:file open; +allow kernel media_rw_data_file:file rw_file_perms; diff --git a/sepolicy/mediaserver.te b/sepolicy/mediaserver.te index ea26cdfc..c380ce90 100644 --- a/sepolicy/mediaserver.te +++ b/sepolicy/mediaserver.te @@ -1,3 +1,6 @@ # Themed resources (i.e. composed icons) -allow mediaserver theme_data_file:dir r_dir_perms; -allow mediaserver theme_data_file:file r_file_perms; +allow mediaserver themeservice_app_data_file:dir r_dir_perms; +allow mediaserver themeservice_app_data_file:file r_file_perms; + +# For camera +allow mediaserver media_rw_data_file:file write; diff --git a/sepolicy/platform_app.te b/sepolicy/platform_app.te index bbd4dd41..3e0eb57e 100644 --- a/sepolicy/platform_app.te +++ b/sepolicy/platform_app.te @@ -5,3 +5,10 @@ allow platform_app sdcard_posix:file create_file_perms; # Allow Gallery3D to crop user images allow platform_app system_app_data_file:file rw_file_perms; + +# Allow Gallery3D to execute render scripts +allow platform_app app_data_file:file execute; + +# Allow batterymanager and batteryproperties services to be found +allow platform_app battery_service:service_manager find; +allow platform_app healthd_service:service_manager find; diff --git a/sepolicy/qcom/dumpstate.te b/sepolicy/qcom/dumpstate.te new file mode 100644 index 00000000..d2844a6b --- /dev/null +++ b/sepolicy/qcom/dumpstate.te @@ -0,0 +1,13 @@ +# For prefetcher to read themes +allow dumpstate dalvikcache_data_file:dir r_dir_perms; +allow dumpstate dalvikcache_data_file:file r_file_perms; +allow dumpstate resourcecache_data_file:dir r_dir_perms; +allow dumpstate resourcecache_data_file:file r_file_perms; +allow dumpstate fuse:dir r_dir_perms; +allow dumpstate fuse:file r_file_perms; +allow dumpstate themeservice_app_data_file:dir r_dir_perms; +allow dumpstate themeservice_app_data_file:file r_file_perms; +allow dumpstate media_rw_data_file:dir search; +allow dumpstate sdcardfs:file getattr; +allow dumpstate sdcardfs:dir search; + diff --git a/sepolicy/qcom/livedisplay.te b/sepolicy/qcom/livedisplay.te new file mode 100644 index 00000000..394caa30 --- /dev/null +++ b/sepolicy/qcom/livedisplay.te @@ -0,0 +1,3 @@ +# Storage of default mode by native API +allow system_server display_misc_file:dir rw_dir_perms; +allow system_server display_misc_file:file create_file_perms; diff --git a/sepolicy/qcom/property_contexts b/sepolicy/qcom/property_contexts new file mode 100644 index 00000000..9bf48989 --- /dev/null +++ b/sepolicy/qcom/property_contexts @@ -0,0 +1,2 @@ +persist.dbg u:object_r:radio_prop:s0 +persist.data u:object_r:radio_prop:s0 diff --git a/sepolicy/recovery.te b/sepolicy/recovery.te index da6ddaca..c5f58c6e 100644 --- a/sepolicy/recovery.te +++ b/sepolicy/recovery.te @@ -19,6 +19,7 @@ allow recovery rootfs:file link; allow recovery rootfs:dir { write create rmdir add_name remove_name }; # Read storage files and directories +allow recovery tmpfs:dir mounton; allow recovery media_rw_data_file:dir r_dir_perms; allow recovery media_rw_data_file:file r_file_perms; allow recovery vfat:dir r_dir_perms; diff --git a/sepolicy/seapp_contexts b/sepolicy/seapp_contexts index 06c96d4b..11c8f00f 100644 --- a/sepolicy/seapp_contexts +++ b/sepolicy/seapp_contexts @@ -1,3 +1,4 @@ user=_app seinfo=platform name=com.cyanogenmod.filemanager domain=untrusted_app type=app_data_file user=theme_man domain=system_app type=system_data_file user=_app seinfo=cmupdater name=com.cyanogenmod.updater domain=system_app type=system_app_data_file +user=_app seinfo=themeservice name=org.cyanogenmod.themeservice domain=themeservice_app type=themeservice_app_data_file \ No newline at end of file diff --git a/sepolicy/service.te b/sepolicy/service.te index 1a6559f5..c7ad50fc 100644 --- a/sepolicy/service.te +++ b/sepolicy/service.te @@ -11,3 +11,7 @@ type cm_app_suggest_service, system_api_service, system_server_service, service_ type cm_performance_service, system_api_service, system_server_service, service_manager_type; type cm_themes_service, system_api_service, system_server_service, service_manager_type; type cm_iconcache_service, system_api_service, system_server_service, service_manager_type; +type cm_livelockscreen_service, system_api_service, system_server_service, service_manager_type; +type cm_weather_service, system_api_service, system_server_service, service_manager_type; +type cm_livedisplay_service, system_api_service, system_server_service, service_manager_type; +type cm_audio_service, system_api_service, system_server_service, service_manager_type; diff --git a/sepolicy/service_contexts b/sepolicy/service_contexts index 04efc6fe..90f21c94 100644 --- a/sepolicy/service_contexts +++ b/sepolicy/service_contexts @@ -11,3 +11,7 @@ cmappsuggest u:object_r:cm_app_suggest_service:s0 cmperformance u:object_r:cm_performance_service:s0 cmthemes u:object_r:cm_themes_service:s0 cmiconcache u:object_r:cm_iconcache_service:s0 +cmlivelockscreen u:object_r:cm_livelockscreen_service:s0 +cmweather u:object_r:cm_weather_service:s0 +cmlivedisplay u:object_r:cm_livedisplay_service:s0 +cmaudio u:object_r:cm_audio_service:s0 diff --git a/sepolicy/system.te b/sepolicy/system.te index 7b202eb0..a9831b68 100644 --- a/sepolicy/system.te +++ b/sepolicy/system.te @@ -7,7 +7,7 @@ allow system_server dhcp_data_file:dir r_dir_perms; allow system_server dhcp_data_file:file r_file_perms; # Themes -allow system_server theme_data_file:dir create_dir_perms; -allow system_server theme_data_file:file create_file_perms; +allow system_server themeservice_app_data_file:dir create_dir_perms; +allow system_server themeservice_app_data_file:file create_file_perms; allow system_server resourcecache_data_file:dir create_dir_perms; allow system_server resourcecache_data_file:file create_file_perms; diff --git a/sepolicy/system_server.te b/sepolicy/system_server.te index 6aaf50c6..5ae809c9 100644 --- a/sepolicy/system_server.te +++ b/sepolicy/system_server.te @@ -7,3 +7,9 @@ allow system_server persist_property_file:dir rw_dir_perms; allow system_server persist_property_file:file { create_file_perms unlink }; allow system_server storage_stub_file:dir { getattr }; + +allow system_server media_rw_data_file:dir r_dir_perms; + +# Allow system_server to relabel newly created theme directory for +# use by the proxied theme service +allow system_server themeservice_app_data_file:dir relabelto; diff --git a/sepolicy/themeservice_app.te b/sepolicy/themeservice_app.te new file mode 100644 index 00000000..aaa84ab4 --- /dev/null +++ b/sepolicy/themeservice_app.te @@ -0,0 +1,19 @@ +# Add themeservice_app to appdomain +type themeservice_app, domain; +app_domain(themeservice_app) + +# Theme manager service +allow themeservice_app activity_service:service_manager find; +allow themeservice_app cm_status_bar_service:service_manager find; +allow themeservice_app cm_themes_service:dir search; +allow themeservice_app connectivity_service:service_manager find; +allow themeservice_app display_service:service_manager find; +allow themeservice_app mount_service:service_manager find; +allow themeservice_app notification_service:service_manager find; +allow themeservice_app system_app_data_file:dir search; +allow themeservice_app user_service:service_manager find; +allow themeservice_app wallpaper_service:service_manager find; + +# Allow full access to themeservice_app_data_file +allow themeservice_app themeservice_app_data_file:dir create_dir_perms; +allow themeservice_app themeservice_app_data_file:file create_file_perms; diff --git a/sepolicy/uncrypt.te b/sepolicy/uncrypt.te index 978f9e1b..2697595e 100644 --- a/sepolicy/uncrypt.te +++ b/sepolicy/uncrypt.te @@ -2,3 +2,8 @@ r_dir_file(uncrypt, media_rw_data_file) allow uncrypt recovery_cache_file:dir create_dir_perms; allow uncrypt recovery_cache_file:file create_file_perms; allow uncrypt recovery_cache_file:fifo_file rw_file_perms; + +allow uncrypt storage_file:dir r_dir_perms; +allow uncrypt storage_stub_file:dir r_dir_perms; +allow uncrypt fuse:dir r_dir_perms; +allow uncrypt fuse:file r_file_perms; diff --git a/sepolicy/vold.te b/sepolicy/vold.te index 0c50c71b..d00fcec3 100644 --- a/sepolicy/vold.te +++ b/sepolicy/vold.te @@ -14,6 +14,7 @@ allow vold self:capability { setgid setuid }; recovery_only(` allow vold rootfs:dir { add_name write }; allow vold rootfs:file execute_no_trans; + allow vold vold_tmpfs:file link; ') # External storage diff --git a/sepolicy/zygote.te b/sepolicy/zygote.te index a93d90ea..951f4143 100644 --- a/sepolicy/zygote.te +++ b/sepolicy/zygote.te @@ -1,5 +1,5 @@ -allow zygote theme_data_file:file r_file_perms; -allow zygote theme_data_file:dir r_dir_perms; +allow zygote themeservice_app_data_file:file r_file_perms; +allow zygote themeservice_app_data_file:dir r_dir_perms; # ps command may do this allow untrusted_app zygote:process getsched;