å¦ä½ä¸º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>
转载ï¼ä»
ä¾åèã
温馨提示:答案为网友推荐,仅供参考