文章来源:http://blog.csdn.net/j086924/article/details/51613055
android5.1平板或手机应用层一些常用的修改项及目录所在:
1、所以系统应用所在的目录:
- \alps\packages\apps
2、一些系统属性的定义:并且可以仿写自行定义变量
- \alps\build\tools\buildinfo.sh
3、一些apk的添加和删除:
- \alps\build\target\product\generic.mk
- \alps\build\target\product\generic_no_telephony.mk
- \alps\build\target\product\telephony.mk
- \alps\build\target\product\core.mk
4、wifi,bt,sn的烧写位置:
- alps\out\target\product\elink8163_tb_l1\obj\CGEN\
5、第三方apps目录:
- \alps\vendor\mediatek\proprietary\operator\common\packages
- \alps\vendor\mediatek\proprietary\operator\common\frameworks
6、VideoPlayer、Stk1、Stk2、MTKThermalManager的values存放的目录:
- \alps\device\mediatek\common\overlay\tablet\vendor\mediatek\proprietary\packages\apps
- \alps\device\mediatek\common\overlay\tablet\vendor\mediatek\proprietary\frameworks
- \alps\device\mediatek\common\overlay\tablet\vendor\mediatek\proprietary\protect-app
7、Launcher3、Settings、DeskClock的values存放的位置(单wifi):
- \alps\device\mediatek\common\overlay\tablet\packages\apps
8、\frameworks values存放的位置:
- \alps\device\mediatek\common\overlay\tablet\frameworks\base\core\res\res
9、导航栏显示或隐藏config.xml:
- \alps\device\mediatek\common\overlay\navbar\frameworks\base\core\res\res\values
10、MemoryDeviceList对照表:
- \alps\device\mediatek\build\build\tools\emigen\项目\MemoryDeviceList_MT8163.xls
11、开机动画存放的目录Android.mk进行配置说明:
- \alps\vendor\mediatek\proprietary\operator\OP09\prebuilt\bootanim\bootanimation
- \alps\vendor\mediatek\proprietary\operator\OP09\prebuilt\bootanim\bootaudio开机铃声
- \alps\vendor\mediatek\proprietary\operator\OP09\prebuilt\bootanim\shutanimation关机动画
12、内存更改目录:
- \alps\bootable\bootloader\preloader\custom\elink8163_tb_l1\inc\custom_MemoryDevice.h
- \alps\bootable\bootloader\preloader\tools\emigen\MT8163\MemoryDeviceList_MT8163.xls
- \alps\bootable\bootloader\preloader\tools\emigen\MT8163\full_elink8163_e 修改版本号,语言类
13、lcm,logo等的配置目录:
- \alps\bootable\bootloader\lk\dev
14、对应的屏大小,配置不同的图标:
- wxga 竖屏
- wxgal 横屏
- </pre>都指显示模式其中WXGA是16:10宽屏,各显示模式支持分辨率如下<pre name="code" class="java">QVGA 240×320
- HVGA 480*320
- VGA 640X480
- SVGA 800X600
- XGA 1024X768
- SXGA 1280X1024
- SXGA+ 1400X1050
- UXGA 1600X1200
- WXGA 1280X800
- WXGA+ 1400X900
- WSXGA 1600X1024
- WSXGA+ 1680X1050
- WUXGA 1920X1200
- WQXGA 2560X1600
15、配置文件的修改(屏的宽高,logo的配置etc):
- \alps\device\elink\elink8163_e\ProjectConfig.mk
- CUSTOM_LK_LCM = KR070IA4T_DSI_VDO
- CUSTOM_UBOOT_LCM = KR070IA4T_DSI_VDO
- MTK_BUILD_VERNO = ALPS.**(自定义版本号)
- \alps\device\elink\elink8163_e\full_elink8163_e
- set locales & aapt config.
- PRODUCT_LOCALES := en_US es_ES zh_CN zh_TW ru_RU pt_BR fr_FR de_DE tr_TR it_IT in_ID ms_MY vi_VN ar_EG hi_IN th_TH bn_IN pt_PT ur_PK fa_IR nl_NL el_GR hu_HU tl_PH ro_RO cs_CZ iw_IL my_MM km_KH ko_KR pl_PL es_US bg_BG hr_HR lv_LV lt_LT sk_SK uk_UA de_AT da_DK fi_FI nb_NO sv_SE en_GB ja_JP
- #AAPT configuration
- PRODUCT_AAPT_CONFIG := normal large xlarge
- PRODUCT_AAPT_PREF_CONFIG := hdpi
- # Set those variables here to overwrite the inherited values.
- PRODUCT_MANUFACTURER := alps
- PRODUCT_NAME := **
- PRODUCT_DEVICE :=**
- PRODUCT_MODEL := **
- PRODUCT_POLICY := android.policy_phone
- PRODUCT_BRAND := alps
- DEFAULT_INPUT_METHOD = com.sohu.inputmethod.sogou.SogouIME //默认输入法
- DEFAULT_LATIN_IME_LANGUAGES = en-US fr ru
16、lcd密度的设置:
- \alps\device\elink\elink8163_e\system.prop
- ro.sf.lcd_density=213
17、默认壁纸的存放位置:
- \alps\frameworks\base\core\res\res\drawable-nodpi\default_wallpaper
18、第三方应用所在目录,eg:Sina微博
- \alps\vendor\mediatek\proprietary\binary\3rd-party\free\Sina_Weibo
- 添加完后,打开文件device\mediatek\common\device.mk
- 将 Sina添加到 PRODUCT_PACKAGES 里面。PRODUCT_PACKAGES += Sina,然后重新build整个工程
19、对应的drawable:
- 320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
- 480dp: a tweener tablet like the Streak (480x800 mdpi).
- 600dp: a 7” tablet (600x1024 mdpi).
- 720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
- 所以1280*720 就用720dp的.
20、长按power键弹出的选项:
- framework\policies\base\phone\com\android\internal\policy\impl\PhoneWindowManager.java
- Runnable mPowerLongPress = new Runnable() {
- public void run(){
- mShouldTurnOffOnKeyUp = false;
- performHapticsFeedbackLw(null,HapticFeedbackConstants.LONG_PRESS,false);
- sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
- showGlobalActionsDialog();
- } };
21、系统默认只有一张内置的静态壁纸,如如何修改可以内置多张静态壁纸:
KK版本:
1).在Launcher3/res/drawable-xxx 的文件夹下增加wallpaer的图片,每个wallpaper需要两种图片一张原图一张缩略图,如下形式
- wallpaper_01.jpg
- wallpaper_01_small.jpg
- wallpaper_02.jpg
- wallpaper_02_small.jpg
2).在Launcher3/res/values-nodpi的wallpapers.xml中修改如下:
- <resources>
- <string-array name="wallpapers" translatable="false">
- <item>wallpaper_01</item>
- <item>wallpaper_02</item>
- </string-array>
- </resources>
1).在Launcher3/WallpaperPicker/res/drawable-xxx 的文件夹下增加wallpaer的图片,每个wallpaper需要两种图片一张原图一张缩略图,如下形式
- wallpaper_01.jpg
- wallpaper_01_small.jpg
- wallpaper_02.jpg
- wallpaper_02_small.jpg
2).在Launcher3/WallpaperPicker/res/values-nodpi的wallpapers.xml中修改如下:
- <resources>
- <string-array name="wallpapers" translatable="false">
- <item>wallpaper_01</item>
- <item>wallpaper_02</item>
- </string-array>
- </resources>
如果需要添加重新启动菜单做重启手机的动作,可以参考如下步骤修改实现:
1)、 在alps\frameworks\base\core\res\res\values\strings.xml 中添加标签:
- <string name="zzzzz_global_action_power_reboot">Reboot</string>
请注意,为了保证资源文件能够被编译进去,请同步将此资源添加到symbols.xml中。
2)、 在alps\frameworks\base\core\res\res\drawable-hdpi中添加图标:
- zzzzz_ic_lock_power_reboot.png
文件中的createDialog()函数中添加:
- Private GlobalActionsDialog createDialog(){
- ……
- mItems = new ArrayList<Action>();
- // first: power off
- mItems.add(……);
- /////////////////////////////////////////////Added for reboot items start
- mItems.add(
- new SinglePressAction(
- com.android.internal.R. zzzzz_ic_lock_power_reboot,
- R.string.zzzzz_global_action_power_reboot) {
- public void onPress() {
- mWindowManagerFuncs.reboot(true);
- }
- public boolean onLongPress() {
- mWindowManagerFuncs.rebootSafeMode(true);
- return true;
- }
- public boolean showDuringKeyguard() {
- return true;
- }
- public boolean showBeforeProvisioning() {
- return true;
- }
- });
- /////////////////////////added end
- // next: airplane mode
- mItems.add(mAirplaneModeOn);
- ……
- }
- public interface WindowManagerFuncs {
- public void reboot(boolean confirm);
- }
5)、 在Frameworks\base\services\java\com\android\server\wm\WindowManagerService.java中,因为其实现了WindowManagerFuncs这个接口,需要在该文件中添加reboot()函数的实现体。
找到shutdown()函数,在其后面添加reboot()函数,函数内容如下:
- // Called by window manager policy. Not exposed externally.
- @Override
- public void reboot(boolean confirm) {
- ShutdownThread.reboot(mContext, confirm);
- }
public.xml中进行配置
字符串添加:(第一次可以编过,后面有碰到编译res找不到)
- strings.xml:
- <string name="reboot_confirm_question">"Do you want to reboot?"</string>
- <string name="global_action_reboot">"Reboot"</string>
- <string name="reboot_progress">"Rebooting..."</string>
- symbols.xml
- <java-symbol type="string" name="reboot_confirm_question" />
- <java-symbol type="string" name="global_action_reboot" />
- <java-symbol type="string" name="reboot_progress" />(遇到编译res找不到,先屏蔽掉symbols.xml,编译后再重新加上继续编译)
23、GMS预置:
L版本GMS预置比较简单,只需要把GMS需要预置内容放置在 alps/vendor/google/文件夹下(google文件夹需要自行创建)
然后检查vendor/google/下是否存在Android.mk文件,若没有此Android.mk,请新建一个,并把以下内容拷贝进去:
- ifdef BUILD_GMS
- ifeq ($(strip $(BUILD_GMS)), yes)
- include $(call all-subdir-makefiles)
- endif
- endif
- include $(call all-subdir-makefiles)
- source build/envsetup.sh && lunch full_<YourProjectName>-user && source ./mbldenv.sh && BUILD_GMS=yes make -j24
- source build/envsetup.sh && lunch full_<YourProjectName>-user && BUILD_GMS=yes make -j24
24、预置apk到vendor/operator/app下面
预置apk到vendor/operator/app下面,有时候会编译不过
这种情况一般是apk本身没有对齐导致的,可以先使用zipalign重新对齐apk后再预置,具体做法如下:
- out/host/linux-x86/bin/zipalign -f 4 unalign.apk aligned.apk
25、mtk自带的一些工具文件,eg:工程模式
- \alps\vendor\mediatek\proprietary\packages\apps\EngineerMode
26、Launcher3的添加所在目录:
- \alps\device\mediatek\mt8163\device.mk
27、apn配置文件所在目录:
- \alps\device\generic\goldfish\data\etc\apns-conf.mk
- \alps\device\mediatek\common\device.mk
29、可以在该目录下添加.jar和.so库(gms需要的库可在此添加)
- eg:\alps\vendor\**\libs\**\com.google.widevine.software.drm\com.google.widevine.software.drm.jar
30、hotseat布局排版,所在目录:default_workspace_5x6
- \alps\device\mediatek\common\overlay\wifi\packages\apps\Launcher3\res\xml\default_workspace_5x6.xml
31、工程测试模式指令(暗码)
在\alps\frameworks\base\telephony\Java\com\android\internal\telephony\TelephonyIntents.java 有接口(android.provider.Telephony.SECRET_CODE)
在packages/services/telephony/src/com/android/phone/SpecialCharSequenceMgr.java的handleSecretCode方法中对暗码就行了处理
\alps\vendor\mediatek\proprietary\packages\apps中添加FactoryMode,并在\alps\device\mediatek\common\device.mk文件中添加FactoryMode,
报莫名其妙的错误(后来问同事发现 , 必须对新增类中的函数或成员变量如果是public的话必须添加 /**{@hide}*/ 修饰. )
可在计算器中用如下demo进行暗码调用
- if(text.contains("(2586)")) {
- // mDisplay.setText(mResult, scroll);
- // setDeleteMode(DELETE_MODE_CLEAR);
- int len = text.length();
- // Intent intent = new Intent(TelephonyIntents.SECRET_CODE_ACTION,Uri.parse("android_secret_code://" + text.substring(1, len - 1)));
- Intent intent = new Intent("android.provider.Telephony.SECRET_CODE",Uri.parse("android_secret_code://" + text.substring(1, len - 1)));
- mContext.sendBroadcast(intent);
- return;
- }
- <receiver android:name="TestingSettingsBroadcastReceiver">
- <intent-filter>
- <action android:name="android.provider.Telephony.SECRET_CODE" />
- <data android:scheme="android_secret_code" android:host="4636" />
- </intent-filter>
- </receiver>
也可以自己写apk直接调用工厂模式:
- Intent intent=new Intent();
- intent.setComponent(new ComponentName("com.mediatek.engineermode", "com.mediatek.engineermode.EngineerMode"));
- startActivity(intent);
31、Launcher3中,android.mk文件中加入LOCAL_PRIVILEGED_MODULE := true,才能使Launcher3添加appwidget有效
32、Launcher3 桌面横屏显示:
1).修改AndroidManifest.xml
- <activity
- ndroid:name="com.android.launcher3.Launcher"
- android:launchMode="singleTask"
- android:clearTaskOnLaunch="true"
- android:stateNotNeeded="true"
- android:theme="@style/Theme"
- android:configChanges="mcc|mnc"
- android:windowSoftInputMode="adjustPan"
- android:screenOrientation="sensor"> <!--modify to sensor -->
2).修改Utilities.java的isRotationEnabled方法
- public static boolean isRotationEnabled(Context c)
- {
- return true;//直接返回true
- }
3).修改res/values/config.xml
- <!--hotseat -->
- <bool name="hotseat_transpose_layout_with_orientation">false</bool> <!--改为false-->
4).修改Hotseat.java的onFinishInflate方法
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- LauncherAppState app = LauncherAppState.getInstance();
- DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
- AllAppsButtonRank = grid.hotseatAllAppsRank;
- mContent = (CellLayout) findViewById(R.id.layout);
- if (grid.isLandscape && !grid.isLargeTablet()) {
- mContent.setGridSize((int) grid.numHotseatIcons, 1); //modify
- } else {
- mContent.setGridSize((int) grid.numHotseatIcons, 1);
- }
- mContent.setIsHotseat(true);
- Log.i(TAG, "onFinishInflate,(int) grid.numHotseatIcons: " + (int) grid.numHotseatIcons);
- resetLayout();
- }
33、电池曲线修改目录:
- \alps\kernel-3.10\drivers\misc\mediatek\mach\..\..\power\cust_battery_meter_table.h
34、配置内存大小:
excel表格对应位置:
- \alps\bootable\bootloader\preloader\tools\emigen\..\MemoryDeviceList_MT8163.xls
- \alps\bootable\bootloader\preloader\custom\..\inc\custom_MemoryDevice.h
- 添加 #define CS_PART_NUMBER[1] H5TC4G63AFR-PBA
35、变化设备屏幕尺寸:
- \alps\kernel-3.10\arch\arm64\configs\**_e_debug_defconfig.mk
- \alps\device\..\..\ProjectConfig.mk