ããå¦ä½ä¸ºAndroidç³»ç»æ·»å ä¸ä¸ªæ°çèµæºå
ããä¼ ç»çAndroidç³»ç»åªæä¸ä¸ªframework-res.apkèµæºå
ï¼ç¬¬ä¸æ¹ååå¨è¿è¡romå®å¶æ¶ä¼ç´æ¥ä¿®æ¹framework resèµæºï¼è¾¾å°ç¾åç®çãä½æ¯è¿ç§æ¹å¼è·åçèµæºçè¦å度è¿é«ï¼å¨ç³»ç»è¿ç§»æè
framework ui移æ¤æ¶éè¦è¿è¡äººå·¥mergeï¼å·¥ä½é巨大ãéè¿ä¸ºAndroidæ·»å ä¸ä¸ªæ°çç¬ç«çèµæºå
ï¼å¯ä»¥å°ååå®å¶èµæºç¬ç«åºæ¥ï¼å¯ç§»æ¤ãå¯ç»´æ¤æ§é常好ã
ããå
·ä½åæ³å¯ä»¥å为以ä¸å 个æ¥éª¤ï¼
ãã1. ä¿®æ¹build/core/clear_var.mk
ããLOCAL_USE_LETV_FRAMEWORK_RES:= true
ãã2. ä¿®æ¹build/core/package.mk
ãã以ä¸èæ¬å¯ä»¥å å¨ $(R_file_stamp): $(framework_res_package_export_deps) ä¹åï¼ç¶åä¿®æ¹$(R_file_stamp): $(framework_res_package_export_deps) å $(LOCAL_INTERMEDIATE_TARGETS): \
ããPRIVATE_AAPT_INCLUDES := $(framework_res_package_export)
ããå¦ä¸æ示ï¼
ããview sourceprint?
ãã1 ifeq ($(LOCAL_USE_LETV_FRAMEWORK_RES),true)
ãã2 letv_framework_res_package_export := \
ãã3 $(call intermediates-dir-for,APPS,letv-framework-res,,COMMON)/package-export.apk
ãã4 letv_framework_res_package_export_deps := \
ãã5 $(dir $(letv_framework_res_package_export))src/R.stamp
ãã6 else
ãã7 letv_framework_res_package_export :=
ãã8 letv_framework_res_package_export_deps :=
ãã9 endif # LOCAL_USE_LETV_FRAMEWORK_RES
ããview sourceprint?
ãã1 $(R_file_stamp): $(framework_res_package_export_deps) $(letv_framework_res_package_export_deps)
ãã2 $(LOCAL_INTERMEDIATE_TARGETS): \
ãã3 PRIVATE_AAPT_INCLUDES := $(framework_res_package_export) \
ãã4 $(letv_framework_res_package_export)
ãã5 endif # LOCAL_NO_STANDARD_LIBRARIES
ãã3. ä¿®æ¹build/target/product/core.mk
ããå¨PRODUCT_PACKAGESå¢å letv-framework-res
ãã4. æ·»å ä¸ä¸ªæ°çèµæºå
项ç®ï¼è¿éå¨framework/base/core/reså级ç®å½ä¸å»ºç«ä¸ä¸ªæ°çæ件夹letv_resç¨æ¥åæ¾æ们çèµæºãæresç®å½ä¸çAndroidManifest.xmlåAndroid.mkæ·è´è¿æ¥ï¼è¿è¡ä¿®æ¹ã
ããè®°å¾è®¾ç½®LOCAL_USE_MY_FRAMEWORK_RES为falseã
ããview sourceprint?
ãã01 LOCAL_PATH:= $(call my-dir)
ãã02 include $(CLEAR_VARS)
ãã03
ãã04 LOCAL_MODULE_TAGS := optional
ãã05
ãã06 LOCAL_PACKAGE_NAME := letv-framework-res
ãã07 LOCAL_CERTIFICATE := platform
ãã08
ãã09 # Set LOCAL_USE_LETV_FRAMEWORK_RES as false
ãã10 LOCAL_USE_LETV_FRAMEWORK_RES := false
ãã11
ãã12 # Tell aapt to create "extending (non-application)" resource IDs,
ãã13 # since these resources will be used by many apps.
ãã14 LOCAL_AAPT_FLAGS := -x
ãã15
ãã16 # Install this alongside the libraries.
ãã17 LOCAL_MODULE_PATH := $(TARGET_OUT_JAVA_LIBRARIES)
ãã18
ãã19 # Create package-export.apk, which other packages can use to get
ãã20 # PRODUCT-agnostic resource data like IDs and type definitions.
ãã21 LOCAL_EXPORT_PACKAGE_RESOURCES := true
ãã22
ãã23 # Include resources generated by system RenderScript files.
ãã24 framework_GENERATED_SOURCE_DIR := $(call intermediates-dir-for,JAVA_LIBRARIES,framework,,COMMON)/src
ãã25 framework_RenderScript_STAMP_FILE := $(framework_GENERATED_SOURCE_DIR)/RenderScript.stamp
ãã26 #LOCAL_RESOURCE_DIR := $(framework_GENERATED_SOURCE_DIR)/renderscript/res $(LOCAL_PATH)/res
ãã27
ãã28 include $(BUILD_PACKAGE)
ãã29
ãã30 # Make sure the system .rs files get compiled before building the package-export.apk.
ãã31 #$(resource_export_package): $(framework_RenderScript_STAMP_FILE)
ãã32
ãã33 # define a global intermediate target that other module may depend on.
ãã34 .PHONY: letv-framework-res-package-target
ãã35 letv-framework-res-package-target: $(LOCAL_BUILT_MODULE)
ããview sourceprint?
ãã01 <?xml version="1.0" encoding="utf-8"?>
ãã02 <manifest xmlns:android=""
ãã03 package="letv" coreApp="true" android:sharedUserId="android.uid.system"
ãã04 android:sharedUserLabel="@null">
ãã05
ãã06 <application android:process="system"
ãã07 android:persistent="true"
ãã08 android:hasCode="false"
ãã09 android:label="@null"
ãã10 android:allowClearUserData="false"
ãã11 android:killAfterRestore="false"
ãã12 android:icon="@null">
ãã13
ãã14 </application>
ãã15
ãã16 </manifest>
ããèµæºçæ¾ç½®è·resä¸ç类似ï¼è®°å¾valuesç®å½ä¸å建public.xmlï¼public.xml对idçç±»ååºåæ¯è¾ä¸¥æ ¼ï¼attrå¿
é¡»æ¯0x0x010000å¼å¤´ï¼drawableå¿
é¡»æ¯0x0x020000å¼å¤´ï¼å
¶ä»ç±»å好å就没æéå¶ï¼ç´æ¥ä¾æ¬¡0x0x030000ã0x0x040000å¼å§å³å¯ãå¦åï¼ç¼è¯è¿ç¨ä¸ä¼åºç°segmentation faulté误ã
ããview sourceprint?
ãã1 <resources>
ãã2 <public type="attr" name="cForeground" id="0x03010000" />
ãã3 <public type="drawable" name="ic_filemanager" id="0x03020000" />
ãã4 <public type="style" name="LetvTheme" id="0x03030000" />
ãã5 <public type="string" name="letv" id="0x03040000" />
ãã6 <public type="dimen" name="letv_width" id="0x03050000" />
ãã7 <public type="layout" name="letv_text" id="0x03060000" />
ãã8 </resources>
ãã5. 以ä¸åªæ¯è§£å³äºèµæºçç¼è¯ç¯å¢é®é¢ï¼èµæºçæ¥æ¾è¿ç¨ä¹éè¦è¿è¡ä¿®æ¹ï¼ä¿®æ¹ AssetManager.javaï¼å¨init()åæ·»å 代ç addAssetPath("/system/framework/letv-framework-res.apk");
ããview sourceprint?
ãã01 public AssetManager() {
ãã02 synchronized (this) {
ãã03 if (DEBUG_REFS) {
ãã04 mNumRefs = 0;
ãã05 incRefsLocked(this.hashCode());
ãã06 }
ãã07 init();
ãã08 addAssetPath("/system/framework/letv-framework-res.apk");
ãã09 if (localLOGV) Log.v(TAG, "New asset manager: " + this);
ãã10 ensureSystemAssets();
ãã11 }
ãã12 }
ãã6. æåå°±æ¯èµæºåºç¨é®é¢ãåºç¨ç¨åºå¨xmlæ件ä¸å¼ç¨letv-framework-res.apkä¸çèµæºæ¶å¯ä»¥ä½¿ç¨ä¸åçèµæºç±»ä¼¼ç访é®æ¹å¼ï¼é¦å
声æletv xmlns :
ããview sourceprint?
ãã1 xmlns:letv=""
ããç¶åå@android:drawable @android:dimenè¿ç§å¼ç¨æ¹å¼æ¹æ@letv:drawable @letv:dimenå³å¯ã
ããview sourceprint?
ãã01 <?xml version="1.0" encoding="utf-8"?>
ãã02 <LinearLayout
ãã03 xmlns:android=""
ãã04 xmlns:letv=""
ãã05 android:layout_width="fill_parent"
ãã06 android:layout_height="wrap_content"
ãã07 android:gravity="center"
ãã08 android:paddingTop="@letv:dimen/letv_width"
ãã09 android:orientation="horizontal" >
ãã10
ãã11 <ImageView android:id="@+id/file_icon"
ãã12 android:layout_width="wrap_content"
ãã13 android:layout_height="wrap_content"
ãã14 android:layout_gravity="center"
ãã15 android:layout_marginBottom="40dp"
ãã16 android:src="@letv:drawable/ic_filemanager" />
ãã17
ãã18 </LinearLayout>
ãã转载ï¼ä»
ä¾åèã
温馨提示:答案为网友推荐,仅供参考