全部博文(207)
分类: Android平台
2016-01-04 17:31:19
Launcher 总结:
1、launcher的布局太居中,要想两边拉伸
<\packages\apps\Launcher2\res\values\dimens.xml>
apps tab栏的宽度( Launcher2icon 数目、大小)
\packages\apps\Launcher2\res\layout-sw720dp\workspace.xml>
launcher:cellCountX="10"
launcher:cellCountY="6"
2、或者不想改数目:
<\packages\apps\Launcher2\src\com\android\launcher2\AppsCustomizeTabHost.java>
protected void onMeasure(intwidthMeasureSpec, int heightMeasureSpec) {
mTabs.getLayoutParams().width= contentWidth + 108;
3、workspace、AppsCustomize的cell大小:
<\packages\apps\Launcher2\res\values-sw600dp\dimens.xml>
4、里面icon的大小:
<\packages\apps\Launcher2\res\values-sw600dp\dimens.xml>
5、workspace没有拖动,第二页第一个icon出现在第一页的最右边:
加大workspace的宽度,或间距:
workspace的paddingLeft、paddingRight:
<\packages\apps\Launcher2\res\values-sw600dp-land\dimens.xml>
workspace两屏间距:
修改workspace的字体大小:
如果没有就添加:
<\packages\apps\Launcher2\res\values-sw480dp\styles.xml>
6、加wallpaper:
1.<\packages\apps\Launcher2\res\values-sw600dp\wallpapers.xml>
加wallpaper的名字
2.<\packages\apps\Launcher2\res\drawable-nodpi>
加如wallpaper
7、gallery的widget默认添加到workspace上:
<\packages\apps\Launcher2\res\xml\default_workspace.xml>
launcher:className="com.android.gallery3d.gadget.PhotoAppWidgetProvider"
launcher:screen="2"
launcher:x="1"
launcher:y="0"
launcher:spanX="3"
launcher:spanY="3" />
<\packages\apps\Gallery2\src\com\android\gallery3d\gadget\PhotoAppWidgetProvider.java>
@Override
public void onUpdate(Contextcontext,
for (int id : appWidgetIds) {
if(id == 2){
helper.setWidget(id,WidgetDatabaseHelper.TYPE_SHUFFLE,null);
}
}
8、在桌面上添加网页的快捷方式:
<\packages\apps\Launcher2\res\xml\default_workspace.xml>
launcher:title="@string/application_name"
launcher:icon="@drawable/ic_no_applications"
launcher:uri=""
launcher:screen="0"
launcher:x="0"
launcher:y="3" />
9、在桌面上默认放文件夹:
<\packages\apps\Launcher2\res\xml\default_workspace.xml>
launcher:x="2"
launcher:y="2"
launcher:title ="@string/application_name" >
launcher:packageName="com.android.deskclock"
launcher:container="1"
launcher:x="0"
launcher:y="0"/>
launcher:packageName="com.android.calculator2"
launcher:container="1"
launcher:x="0"
launcher:y="0"/>
10、桌面上添加快捷方式,点击播放视频:
<\packages\apps\Launcher2\res\xml-sw720dp\default_workspace.xml>
launcher:icon="@drawable/ic_launcher_application"
launcher:uri="file:///mnt/sdcard/external_sdcard/1...playermenu;end"
launcher:screen="2"
launcher:x="1"
launcher:y="1"/>
11、安装apk,显示隐藏的google play:
1.写google显示的apk:
GooglePlayShow的activity:
ComponentName componentname = newComponentName("com.android.vending","com.android.vending.AssetBrowserActivity");
packagemanager.setComponentEnabledSetting(componentname, 1, 1);
componentname = new ComponentName("com.example.googleplayshow","com.example.googleplayshow.MainActivity");
packagemanager.setComponentEnabledSetting(componentname, 2, 1);
2.<\packages\apps\Launcher2\src\com\android\launcher2\LauncherModel.java>
} else if(Intent.ACTION_PACKAGE_ADDED.equals(action)) {
if (!replacing) {
if(packageName.equals("com.example.googleplayshow")){
context.startActivity(new
Intent().setComponent(new
ComponentName("com.example.googleplayshow","com.example.googleplayshow.MainActivity")).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
op = PackageUpdatedTask.OP_ADD;
} else {
op = PackageUpdatedTask.OP_UPDATE;
}
}
隐藏google search:
<\packages\apps\Launcher2\src\com\android\launcher2\Launcher.java>
private void setupViews() {
mSearchDropTargetBar = (SearchDropTargetBar)mDragLayer.findViewById(R.id.qsb_bar);
mSearchDropTargetBar.hideSearchBar(false);
void showWorkspace(boolean animated, Runnable onCompleteRunnable) {
//mSearchDropTargetBar.showSearchBar(wasInSpringLoadedMode);
12、widget中隐藏google play:
<\packages\apps\Launcher2\src\com\android\launcher2\AppsCustomizePagedView.java>
updatePackages里面添加:
if(!widget.provider.getPackageName().equals("com.android.vending")&&!widget.provider.getPackageName().equals("com.android.vending.MarketWidgetProvider")){
mWidgets.add(widget);
}
13、clock的widget下部分显示不全,向上调
<\packages\amlogic\Launcher2\res\values\dimens.xml>
修改widget的text的size:
<\packages\amlogic\Launcher2\res\layout\apps_customize_widget.xml>
android:id="@+id/widget_name"
android:textSize="20sp" />
14、launcher中隐藏一个app:
需要该app的packageName,例如要隐藏settings:
<\packages\apps\Launcher2\src\com\android\launcher2\LauncherModel.java>
private void loadAllAppsByBatch() {
apps =packageManager.queryIntentActivities(mainIntent, 0);
ResolveInfo removeApp =null;
for(ResolveInfoinfo:apps){
if(info.activityInfo.packageName.equals("com.android.settings")){
removeApp = info;
}
}
if(removeApp != null){
apps.remove(removeApp);
}
15、launcher中隐藏多个app:红色为改动部分
<\packages\apps\Launcher2\src\com\android\launcher2\LauncherModel.java>
private void loadAllAppsByBatch() {
final PackageManager packageManager = mContext.getPackageManager();
List
List
int N = Integer.MAX_VALUE;
int startIndex;
int i=0;
int batchSize = -1;
while (i < N && !mStopped) {
if (i == 0) {
mAllAppsList.clear();
final long qiaTime =DEBUG_LOADERS ? SystemClock.uptimeMillis() : 0;
allApps =packageManager.queryIntentActivities(mainIntent, 0);
for(ResolveInfo info :allApps){
if(info.activityInfo != null
&& !info.activityInfo.packageName.equalsIgnoreCase("com.android.email")
&&!info.activityInfo.packageName.equalsIgnoreCase("com.android.providers.downloads.ui")
&& !info.activityInfo.packageName.equalsIgnoreCase("com.adobe.flashplayer")){
apps.add(info);
}
}
settings 问题总结:
1.入口,设置分屏显示
frameworks\base\core\res\res\values\bools.xml下的 preferences_prefer_dual_pane 为true.
2.top level headers--这里可以去掉左边的headers
private voidupdateHeaderList(List
if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) {
target.remove(header);
}
3.默认字体:
public voidreadFontSizePreference(ListPreference pref) {
ActivityManagerNative.getDefault().getConfiguration()
系统的Configuration是从ActivityManagerService设置的:
<\frameworks\base\services\java\com\android\server\am\ActivityManagerService.java>
mConfiguration.setToDefaults();
fontScale =Float.parseFloat(SystemProperties.get("ro.fontScale","1"));
4.settings的theme:
<\packages\apps\Settings\AndroidManifest.xml>
android:taskAffinity=""
android:theme=" :style/Theme.Holo"
android:uiOptions="splitActionBarWhenNarrow"
android:hardwareAccelerated="true">
<\frameworks\base\core\res\res\values\themes.xml>
字体颜色
加亮框的颜色:
触摸框的颜色:
左边背景:
右边的背景:
title的背景:
5.设置--》开发者选项--修改后台进程限制
frameworks/base/services/java/com/android/server$vi ./am/ActivityManagerService.java
大概839行 把int mProcessLimitOverride = -1;改成4(不得超过4个进程)
标准限制对应 -1
不允许后台进程对应 0
不得超过1个进程 对应 1
不得超过2个进程 对应 2
不得超过3个进程 对应 3
6. 默认不要锁屏,设置-安全--屏幕锁定 (无)
overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
7. 位置服务--- 默认Google的位置服务为勾选
overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
改成
常用修改
一. 修改默认(Settting.apk 中选项默认值一般存在于frameworks\base\packages\SettingsProvider\res\values\defaults.xml)
1. 默认勾选未知来源
2. 默认铃声, 通知, 闹钟音乐
可以在system.prop 分别配置
ro.config.ringtone=Playa.ogg(默认铃声设置,文件在/system/media/audio/ringtones 把喜欢的铃声放这里,比如123.MP3放入ringtones文件夹中,这里代码改为ro.config.ringtone=123.mp3)
ro.config.notification_sound=regulus.ogg(默认提示音,文件在/system/media/audio/notifications 修改方法同上)
ro.config.alarm_alert=Alarm_Beep_03.ogg(默认闹铃,文件在/system/media/audio/alarms 修改方法同上)
3. 壁纸不跟随滑动
packages/apps/Launcher2/./src/com/android/launcher2/Workspace.java 大概 875行
private float wallpaperOffsetForCurrentScroll()
修改 wallpaperOffsetForCurrentScroll 的返回值。改成 return 0.5f;
二.隐藏或删除某项
1.去掉设置中Wifi选项
device/amlogic/xxxref/xxxref.mk 文件中
# Device specific system feature description
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/tablet_core_hardware.xml:system/etc/permissions/tablet_core_hardware.xml\
frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml\ (删除)
2.去掉设置中蓝牙选项
参考 wifi。
在 tablet_core_hardware.xml 删除
3. HDMI 部分
1)去掉HDMI选项 在system.prop中加入 ro.hdmi.autoswitch=false
2)去掉480p 选项在prop中设置 ro.hdmi480p.enable=false
4. 去掉 powerwidget 中某一项
以去掉 gps 为例
在 packages\apps\Settings\res\layout\widget.xml 下,移除
android:layout_width="1dip"
android:layout_height="match_parent"
android:background="@drawable/appwidget_settings_divider_holo"
android:contentDescription="@null"
/>
android:id="@+id/btn_bluetooth"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="match_parent"
android:paddingTop="12dp"
android:background="@drawable/appwidget_button_center"
android:clickable="true"
android:focusable="true"
android:orientation="vertical">
android:id="@+id/img_bluetooth"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:scaleType="center"
android:contentDescription="@null"
/>
android:id="@+id/ind_bluetooth"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:contentDescription="@null"
/>
然后 com.android.settings.widget.SettingsAppWidgetProvider.java
注释 views.setOnClickPendingIntent(R.id.btn_gps, getLaunchPendingIntent(context,BUTTON_GPS)); 这一行。
5. 去掉 Setting widget 中某一项
以去掉 "网络共享与便携式热点" 为例
根据"网络共享与便携式热点" 这个关键词在 values-zh_rCN 中搜索到的 key值,然后在AndroidManifest.xml 搜索这个 key值。找到对于的Activity 配置
移除
6. 修改浏览器默认浏览器模式
packages\apps\Browser\res\xml-sw600dp\advanced_preferences.xml
android:key="user_agent"
android:title="@string/pref_development_uastring"
android:entries="@array/pref_development_ua_choices"
android:entryValues="@array/pref_development_ua_values"
android:defaultValue="3"/>
修改 android:defaultValue="3" 具体的值参考一下选项
7. workspace 预置文件夹
范例
folder 放到最前面。launcher:container 的值是folder的数据库中的id。一般从1开始。
launcher:screen="2"
launcher:x="1"
launcher:y="1"
launcher:title="@string/application_name" >
launcher:className="com.android.settings"
launcher:packageName="com.android.settings.Settings"
launcher:container="2"
launcher:x="0"
launcher:y="0" />
launcher:className="com.fb.FileBrower"
launcher:packageName="com.fb.FileBrower.FileBrower"
launcher:container="2"
launcher:x="0"
launcher:y="0" />
widget 范例
launcher:packageName="com.android.calendar"
launcher:className="com.android.calendar.widget.CalendarAppWidgetProvider"
launcher:screen="1"
launcher:x="0"
launcher:y="0"
launcher:spanX="2"
launcher:spanY="3" />
快捷方式范例
launcher:packageName="com.android.settings"
launcher:className="com.android.settings.Settings"
launcher:screen="2"
launcher:x="1"
launcher:y="3" />
网页快捷方式
launcher:title="@string/custom_google"
launcher:icon="@drawable/favicon_google"
launcher:uri=""
launcher:screen="3"
launcher:x="4"
launcher:y="1"/>
8. 系统自带LatinIME 高级设置--按键音量设置 修改默认值
java/res/values/keypress-volumes.xml
9.lockscreen坐标数字时钟被遮住
请调整红色的数字:
<\frameworks\base\core\res\res\layout-sw600dp\keyguard_screen_tab_unlock_land.xml>
android:layout_height="match_parent"
android:layout_weight="0.5"
android:layout_height="match_parent"
android:layout_weight="0.5"
10.在4.1上修改默认字体大小:
比如改成大:
11.没有蓝牙的平台,去掉窗口小部件-设置快捷方式-拉到桌面显示的“蓝牙”选项
<\packages\apps\Settings\src\com\android\settings\OutputSettingsBroadcastReceiver.java>
public voidonReceive(Context context, Intent intent)
{
// bootcompleted
if(intent.getAction().equalsIgnoreCase(Intent.ACTION_BOOT_COMPLETED))
{
if(!context.getPackageManager().hasSystemFeature(context.getPackageManager().FEATURE_BLUETOOTH)){
ComponentName componentname = newComponentName("com.android.settings","com.android.settings.Settings$BluetoothSettingsActivity");
context.getPackageManager().setComponentEnabledSetting(componentname, 2,1);
}
}
11. 修改浏览器的默认标签
分别在一下资源文件中添加自定义的标签
packages\apps\Browser\res\values\strings.xml
packages\apps\Browser\res\values\bookmarks_icons.xml,
注意:这里每个网站对应一个缩略图和一个favicon
对应的图片在 packages\apps\Browser\res\raw
12. 锁屏界面,解锁组件增加图标
已增加 VideoPlayer 为例,
在frameworks/base/core/res/res/drawable-hdpi 下面
添加一个对应的png图标
下面红色为增加的部分。
frameworks/core/res/res/values-sw600dp-land/arrays.xml
-
+
frameworks/base/res/res/values/arrays.xmlb/core/res/res/values/arrays.xml
-
+
frameworks/base/res/res/values/public.xmlb/core/res/res/values/public.xml
indexac0a457..be4257e 100755
---a/core/res/res/values/public.xml
+++b/core/res/res/values/public.xml
frameworks/base/policy/src/com/android/internal/policy/impl/LockScreen.java
casecom.android.internal.R.drawable.ic_lockscreen_camera:
launchActivity(new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA));
mCallback.pokeWakelock();
break;
casecom.android.internal.R.drawable.ic_lockscreen_videoplayer:
launchActivity(newIntent().setClassName("com.farcore.videoplayer", "com.farcore.videoplayer.FileList"));
mCallback.pokeWakelock();
break;
注意:在 frameworks/base/core/res/ 中执行mm 。然后在frameworks/base/policy 中执行mm。看看能否编译过。不行的话,在在根目录下执行make update-api
13. 休眠策略
修改默认的休眠策略,请参考
frameworks\base\packages\SettingsProvider\res\values\defaults.xml
14. Launcher 半透明
4.0, 4.1 下载附件中的patch集合--- translucent.zip
如果是 4.2.2系统,还需修改
Launcher/src/com/android/launcher2/Launcher.java
mLauncherView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
mWorkspaceBackgroundDrawable =getResources().getDrawable(R.drawable.workspace_bg);
mBlackBackgroundDrawable = new ColorDrawable(Color.BLACK); // 修改为 mBlackBackgroundDrawable = newColorDrawable(0x7f000000);
packages\amlogic\Launcher2\src\com\android\launcher2\Launcher.java
mStateAnimation.addListener(new AnimatorListenerAdapter() {
boolean animationCancelled = false;
@Override
public void onAnimationStart(Animatoranimation) {
dispatchOnLauncherTransitionEnd(fromView, animated, false); //add
dispatchOnLauncherTransitionEnd(toView,animated, false); //add
updateWallpaperVisibility(false); //true 改成false
// Prepare the position
toView.setTranslationX(0.0f);
toView.setTranslationY(0.0f);
toView.setVisibility(View.VISIBLE);
toView.bringToFront();
}
15. APK 预装时无法找到lib库的问题
(1) 如果log报错是找不到lib库首先可以修改lib的路径
jb4.1\frameworks\base\core\java\android\app\NativeActivity.java
public static final String SYSTEM_LIB_PATH ="/system/lib";
if (libraryFile.exists()) {
path = libraryFile.getPath();
}else{
File systemLibraryFile = newFile(SYSTEM_LIB_PATH,System.mapLibraryName(libname));
if (systemLibraryFile.exists()){
path =systemLibraryFile.getPath();
}
}
(2)apk本身会检测检测/data/data/lib路径是否存在资源文件时方法1不适用,用第二种方法:
在项目上的mk文件 /device/amlogic/g18refg/8ref.mk 中,加上 preinstallation
PRODUCT_PACKAGES+= \
lights.amlogic \
FileBrowser \
AppInstaller \
VideoPlayer \
HdmiSwitch \
Update \
fw_env \
preinstallation
将网页底部的附件 拷贝到packages\amlogic下面解压 将需要预装安装的apk拷贝到preinstallation目录下面,编辑里面的preinstall.sh文件内容如下:
#!/system/xbin/busyboxsh
echo "dopreinstall applications"
#com.mxtech.videoplayer.ad apk包名
if [ ! -e/data/data/com.mxtech.videoplayer.ad/ ]; then
pminstall /system/preinstall/com.mxtech.videoplayer.ad.50.apk
fi
if [ ! -e/data/data/org.xbmc.xbmc/ ]; then
pminstall /system/preinstall/xbmc-20130414-e2c3799-Frodo-armeabi-v7a.apk
fi
。。。。。。
然后在device\amlogic\common\init\tablet\init.amlogic.rc 中,启动预安装脚本的服务.
MX:
servicepreinstall /system/bin/preinstall.sh
class main
user root
group root
oneshot
console
disabled
M3:
servicepreinstall /system/bin/preinstall.sh
user root
group root
disabled
oneshot
在init.amlogic.rc最后一行加上
startpreinstall
16. 去掉 hotspot
把红色的部分删掉
device\amlogic\gXXXX\overlay\frameworks\base\core\res\res\values\config.xml
17.桌面上添加快捷方式,点击播放视频:
<\packages\apps\Launcher2\res\xml-sw720dp\default_workspace.xml>
launcher:title="@string/application_name"
launcher:icon="@drawable/ic_launcher_application"launcher:uri="file:///mnt/sdcard/external_sdcard/1...playermenu;end"
launcher:screen="2"launcher:x="1" launcher:y="1" />
添加网页的快捷方式:
<\packages\apps\Launcher2\res\xml-sw720dp\default_workspace.xml>
launcher:title="@string/application_name"
launcher:icon="@drawable/ic_no_applications"
launcher:uri=""
launcher:screen="0"
launcher:x="0"
launcher:y="3" />
18.去掉camera的全景icon:
4.1:
<\packages\apps\Camera\res\layout-sw600dp-land\mode_picker.xml>
android:contentDescription="@string/accessibility_switch_to_panorama"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="gone"
android:scaleType="center"
android:background="@drawable/bg_pressed"
android:src="@drawable/ic_switch_pan_holo_light" />
4.2:
<\packages\apps\Camera\src\com\android\camera\CameraActivity.java>
加上红色加亮的地方:
public void init() {
for (int i = 0; i < mDrawables.length; i++) {
if ((i == LIGHTCYCLE_MODULE_INDEX && !LightCycleHelper.hasLightCycleCapture(this))||i == PANORAMA_MODULE_INDEX) {
continue; // not enabled, so don't add to UI
}
drawids[ix++] = DRAW_IDS[i];
}
<\packages\apps\Camera\src\com\android\camera\CameraActivity.java>
public void init() {
int[] drawids = new int[LightCycleHelper.hasLightCycleCapture(this)
? DRAW_IDS.length -1 : DRAW_IDS.length - 2];
19.锁屏左边clock太大显示不全:
<\frameworks\base\core\res\res\layout-sw600dp\keyguard_screen_status_land.xml>
android:textSize="@dimen/keyguard_pattern_unlock_clock_font_size"
android:textSize="@dimen/keyguard_pattern_unlock_clock_font_size"
//dimens.xml里的keyguard_pattern_unlock_clock_font_size调小
可以把clock调成居中显示,不要靠右,造成右边显示不全
xmlns:android=""
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right">
//改成center
20. 去掉settings的battery里面的mobile network signal显示
加上红色语句:
<\packages\apps\Settings\src\com\android\settings\fuelgauge\BatteryHistoryChart.java>
if (!com.android.settings.Utils.isWifiOnly(getContext())) {
mHavePhoneSignal = true;
}
mHavePhoneSignal = false;
21. 去掉待机的CRT动画
把自己项目overlay中的
frameworks/base/core/res/res/values/config.xml
22. 添加格式化内部sdcard
jb4.1\packages\amlogic\Settings\src\com\android\settings\deviceinfo\StorageVolumePreferenceCategory.java
public StorageVolumePreferenceCategory(Context context, Resources resources,StorageVolume storageVolume, StorageManager storageManager, boolean isPrimary){
// Cannot formatemulated storage
mAllowFormat = mStorageVolume != null &&!mStorageVolume.isEmulated()&&mStorageVolume.isRemovable();
// For now we are disabling reformatting secondary externalstorage
// until some interoperability problems with MTP are fixed
//if (!isPrimary) mAllowFormat = false;
+ if(mStorageVolume != null &&mStorageVolume.getPath().equals("/storage/sdcard0")){
+ mAllowFormat = true;
+ }
23. 4.2 LockScreen 任何方向都可以解锁,修改成只有向右才能解锁
4.2 Lockscreen 对应的java 文件不再是 Lockscreen, 而是KeyguardSelectorView.java
frameworks/base/core/res/res/values/arrays.xmlb/core/res/res/values/arrays.xml
+
+
+
+
+
+
24.android 4.2改launcher里面的icon横排的数目:
<\packages\apps\Launcher2\res\values-sw720dp\config.xml>
如果改成7,hotseat里面第8个icon不见了,可以往第8个槽里面放进去,但是重启后,icon又不见了,可以这样修改:
<\packages\apps\Launcher2\src\com\android\launcher2\LauncherModel.java>
final ItemInfo occupied[][][] =
new ItemInfo[Launcher.SCREEN_COUNT + 1][mCellCountX + 2][mCellCountY + 1]; //原来这里是+1
25. 4.2 LockScreen 解锁界面四个方向添加一个setting入口
frameworks\base\core\res\res\values/arrays.xml
在 frameworks\base\core\res\res\drawable 增加 ic_lockscreen_settings.xml 文件并添加 ic_lockscreen_settings_normal.phg ic_lockscreen_settings_activated.png 资源文件
android:state_enabled="true"
android:state_active="false"
android:state_focused="false"
android:drawable="@drawable/ic_lockscreen_settings_normal" />
android:state_enabled="true"
android:state_active="true"
android:state_focused="false"
android:drawable="@drawable/ic_lockscreen_settings_activated" />
android:state_enabled="true"
android:state_active="false"
android:state_focused="true"
android:drawable="@drawable/ic_lockscreen_settings_activated" />
frameworks\base\policy\src\com\android\internal\policy\impl\LockScreen.java
public void onTrigger(View v, int target) {
final int resId =mGlowPadView.getResourceIdForTarget(target);
switch (resId) {
casecom.android.internal.R.drawable.ic_lockscreen_settings: //启动setting 应用
launchActivity(newIntent().setComponent(newComponentName("com.android.settings","com.android.settings.Settings")));
mCallback.pokeWakelock();
break;
26. 4.2 上隐藏 Wifi Display
去掉项目overlay/frameworks/base/core/res/res/config.xml 中的config_enableWifiDisplay
27. 默认音量修改
frameworks/base/media/java/android/media/AudioService.java
private finalint[] MAX_STREAM_VOLUME = new int[] {
5, // STREAM_VOICE_CALL
7, // STREAM_SYSTEM
7, // STREAM_RING
15, // STREAM_MUSIC
7, // STREAM_ALARM
7, // STREAM_NOTIFICATION
15, // STREAM_BLUETOOTH_SCO
7, // STREAM_SYSTEM_ENFORCED
15, // STREAM_DTMF
15 // STREAM_TTS
};
frameworks/base/media/java/android/media/AudioManager.java
/** Default volume index values for audio streams */
public static final int[] DEFAULT_STREAM_VOLUME = new int[] {
4, // STREAM_VOICE_CALL
7, // STREAM_SYSTEM
5, // STREAM_RING
11, // STREAM_MUSIC
6, // STREAM_ALARM
5, // STREAM_NOTIFICATION
7, // STREAM_BLUETOOTH_SCO
7, // STREAM_SYSTEM_ENFORCED
11, // STREAM_DTMF
11 // STREAM_TTS
};
28.widget中隐藏google play:
<\packages\apps\Launcher2\src\com\android\launcher2\AppsCustomizePagedView.java>
updatePackages里面添加:
if(!widget.provider.getPackageName().equals("com.android.vending")&& !widget.provider.getPackageName().equals("com.android.vending.MarketWidgetProvider")){
mWidgets.add(widget);
}
29.去掉设置-->显示-->亮度里的“自动调整亮度”选项
<\packages\apps\Settings\res\layout\preference_dialog_brightness.xml>
加上
android:visibility="invisible"
30.设置-位置信息访问权限默认关闭
<\frameworks\base\packages\SettingsProvider\res\values\defaults.xml>
这里不要填写gps或者network,清空
31.设置-安全-验证应用默认不勾允
<\frameworks\base\packages\SettingsProvider\res\values\defaults.xml>
32.设置-声音-触摸提示音与锁屏提示音默认不勾允状态
<\frameworks\base\packages\SettingsProvider\res\values\defaults.xml>
33.设置-以太网菜单请移动“更多”菜单下
请用附件ethernet.patch,开关是ro.ethernet.more,设置为true,ethernet移到more里面
在settings的git下打这个patch
34.窗口小部件“指针时钟”显示不全
把clock的widget向上调,下面的值改小:
<\packages\amlogic\Launcher2\res\values\dimens.xml>
35.去掉settings的more里面的网络共享与便携式热点
ro.tether.denied=true
36.平台主界面底部工具栏上的图标全部居中显示,从左至右的图标依次为:vol-、back、home、窗口切换、vol+
1.在prop里面将ro.statusbar.volume设置为true
2.<\frameworks\base\packages\SystemUI\res\layout-sw600dp\navigation_bar.xml>
将
……
/>
这段放到
……
/>
这段之前
……
/>
这段放到
android:id="@+id/recent_apps"
……
/>
这段之后
注意这个文件有两处需要调换上面的
37.主界面模拟时钟改成数字时钟
default_workspace.xml里面加上:
launcher:packageName="com.android.deskclock"
launcher:className="com.android.alarmclock.DigitalAppWidgetProvider"
38、settings中的developer options的开关打开,debug关掉:
<\frameworks\base\packages\SettingsProvider\src\com\android\providers\settings\DatabaseHelper.java>
private void loadSecureSettings(SQLiteDatabase db) {
loadSetting(stmt,Settings.Secure.ADB_ENABLED, 0);
loadSetting(stmt,Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 1);
39、改桌面icon行、列数:
<\packages\apps\Launcher2\res\layout-sw***dp\workspace.xml>
launcher:cellCountX="10"
launcher:cellCountY="6"
40、more里面morebile data项默认不选:
1.<\frameworks\base\packages\SettingsProvider\src\com\android\providers\settings\DatabaseHelper.java>
private void loadSecureSettings(SQLiteDatabase db) {
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("INSERT OR IGNOREINTO secure(name,value)"
+ "VALUES(?,?);");
添加:
loadIntegerSetting(stmt,Settings.Secure.MOBILE_DATA,
R.integer.def_mobile_data);
2.<\frameworks\base\packages\SettingsProvider\res\values\defaults.xml>
41.secure的unknown的设置默认打开:
<\frameworks\base\packages\SettingsProvider\res\values\defaults.xml>
42、修改app list的背景:
<\packages\apps\Launcher2\res\layout\apps_customize_pane.xml>
xmlns:android=""
xmlns:launcher=""
android:background="@drawable/wallpaper_03">
43、bluetooth tethering的checkbox去掉:
overlay里面的
<\frameworks\base\core\res\res\values\config.xml>
去掉
44. Google play 不是内置,而是安装,导致出问题的解决办法
frameworks/baseservices/java/com/android/server/pm/PackageManagerService.java
@@ -4594,6+4594,9 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
}
+ if(pkg.packageName.equals("com.android.vending")){
+ allowed = true;
+ }
if (!allowed&& (bp.protectionLevel
& PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) {
//For development permissions, a development permission
45.以太网设置问题
以太网在settings.db中的条目是"eth_on", 默认值由系统属性 ro.ethernet.default_on 决定,
ro.ethernet.default_on=false默认关闭
ro.ethernet.default_on=true默认打开
不定义该属性默认关闭