android5.1平板或手机应用层一些常用的修改项及目录所在:
1、所以系统应用所在的目录:
\alps\packages\apps
\alps\build\tools\buildinfo.sh
\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
alps\out\target\product\elink8163_tb_l1\obj\CGEN\
\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
\alps\device\mediatek\common\overlay\tablet\packages\apps
\alps\device\mediatek\common\overlay\tablet\frameworks\base\core\res\res
\alps\device\mediatek\common\overlay\navbar\frameworks\base\core\res\res\values
\alps\device\mediatek\build\build\tools\emigen\项目\MemoryDeviceList_MT8163.xls
\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关机动画
\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 修改版本号,语言类
\alps\bootable\bootloader\lk\dev
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按需选购可能平板使用类似WSVGA的1024×576以及WXGA的1280×768等等,Google将设备分为small(2~3英寸)、normal(4英寸左右)、large(5~7英寸)、xlarge(7英寸以上)不同大小屏幕用不同大小的图片,low:medium:high:extra-high图片大小的比例为3:4:6:8;举例来说,对于中等密度(medium)的屏幕你的图片像素大小为48×48,那么低密度(low)屏幕的图片大小应为36×36,高(high)的为72×72,extra-high为96×96.
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
\alps\frameworks\base\core\res\res\drawable-nodpi\default_wallpaper
\alps\vendor\mediatek\proprietary\binary\3rd-party\free\Sina_Weibo 添加完后,打开文件device\mediatek\common\device.mk 将 Sina添加到 PRODUCT_PACKAGES 里面。PRODUCT_PACKAGES += Sina,然后重新build整个工程
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的.
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(); } };调用showGlobalActionDialog方法将会显示“飞行模式”、“静音”,“关机”,选项的对话框,这个时候我们就可以把位于此处的frameworks\policies\base\phone\com\android\internal\policy\impl\GlobalActions.java该文件的createDialog方法中代码
21、系统默认只有一张内置的静态壁纸,如如何修改可以内置多张静态壁纸:
KK版本:
1).在Launcher3/res/drawable-xxx 的文件夹下增加wallpaer的图片,每个wallpaper需要两种图片一张原图一张缩略图,如下形式
wallpaper_01.jpg wallpaper_01_small.jpg wallpaper_02.jpg wallpaper_02_small.jpg缩略图的文件名必须原图"文件名"+"_small"
<resources> <string-array name="wallpapers" translatable="false"> <item>wallpaper_01</item> <item>wallpaper_02</item> </string-array> </resources>L版本:
wallpaper_01.jpg wallpaper_01_small.jpg wallpaper_02.jpg wallpaper_02_small.jpg缩略图的文件名必须原图"文件名"+"_small"
<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>用来显示重新启动菜单项的字符串资源,如果需要添加其他语言的标识,请在其他可替换资源的res folder下添加对应资源。
zzzzz_ic_lock_power_reboot.png3)、 在alps\frameworks\base\policy\src\com\android\internal\policy\impl\GlobalActions.java
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); …… }4)、 在frameworks\base\core\java\android\view\WindowManagerPolicy.java文件中,找到WindowManagerFuncs这个interface的定义,增加如下function的声明:
public interface WindowManagerFuncs { public void reboot(boolean confirm); }
// Called by window manager policy. Not exposed externally. @Override public void reboot(boolean confirm) { ShutdownThread.reboot(mContext, confirm); }还需要在array.xml的config_globalActionsList添加reboot选项
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,编译后再重新加上继续编译)注:android5.1的config_globalActionsList在 X:\8163_eng\alps\frameworks\base\core\res\res\values\config.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同时再检查vendor/google/以下两个文件夹apps/ 和 frameworks/第一层目录下是否存在Android.mk如果不存在,也各新建一个,将以下内容拷贝进去:
include $(call all-subdir-makefiles)最后在build的时候带入"BUILD_GMS=yes",如:
source build/envsetup.sh && lunch full_<YourProjectName>-user && source ./mbldenv.sh && BUILD_GMS=yes make -j24若提示找不到mbldenv.sh,则使用如下命令:
source build/envsetup.sh && lunch full_<YourProjectName>-user && BUILD_GMS=yes make -j24注意,源代码的build文件中会有判断 BUILD_GMS 的值做不同build行为的语句,请不要修改,否则会造成GMS预置冲突或者预置不完整问题
24、预置apk到vendor/operator/app下面
预置apk到vendor/operator/app下面,有时候会编译不过
这种情况一般是apk本身没有对齐导致的,可以先使用zipalign重新对齐apk后再预置,具体做法如下:
out/host/linux-x86/bin/zipalign -f 4 unalign.apk aligned.apk其中,unalign.apk指当前source apk,aligned.apk指对齐后输出的apk.
25、mtk自带的一些工具文件,eg:工程模式
\alps\vendor\mediatek\proprietary\packages\apps\EngineerMode
\alps\device\mediatek\mt8163\device.mk
\alps\device\generic\goldfish\data\etc\apns-conf.mk
\alps\device\mediatek\common\device.mk
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
在\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; }接收在Settings.java的
<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);
32、Launcher3 桌面横屏显示:
1).修改AndroidManifest.xml
<activity android: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 -->
public static boolean isRotationEnabled(Context c) { return true;//直接返回true }此时旋转手机,Launcher会横竖屏切换。但hotseat会显示在屏幕的右方。如果要让hotseat显示在屏幕底部,可以按照如下步骤操作:
<!--hotseat --> <bool name="hotseat_transpose_layout_with_orientation">false</bool> <!--改为false-->
@Override protected void onFinishInflate() { super.onFinishInflate(); LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); mAllAppsButtonRank = 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(); }
\alps\kernel-3.10\drivers\misc\mediatek\mach\..\..\power\cust_battery_meter_table.h
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
\alps\kernel-3.10\arch\arm64\configs\**_e_debug_defconfig.mk \alps\device\..\..\ProjectConfig.mk