Android5.1 - 通讯录建立群组

【问题】

在没有账户的时候,不应该有添加联系人群组的选项。

我们要把这个选项干掉。

【相关log】
06-23 17:25:00.804: E/GroupEditorFragment(6030): No accounts were found.
//GroupEditorFragment.java (packages\apps\contacts\src\com\android\contacts\group)
//line 327 log

06-23 18:56:31.109: I/ActivityManager(1376): Start proc 12138:com.android.contacts/u0a4 for activity com.android.contacts/.activities.PeopleActivity

【相关代码】

//PeopleActivity.java (packages\apps\contacts\src\com\android\contacts\activities)
1278 MenuItem addGroupMenu = menu.findItem(R.id.menu_add_group);

1483 private void createNewGroup()
1374 @Override
public boolean onOptionsItemSelected(MenuItem item)
定义有各个按键对应的动作
if (isSearchMode) addGroipMenu.setVisible(false);

1366 private void makeMenuItemVisible(Menu menu, int itemId, boolean visible)
选择可视按键

1265 @Override
public boolean onPrepareOptionsMenu(Menu menu)
在这里设置按键是否可视。主要观察addGroupMenu.setVisible()方法
1337 注释掉addGroupMenu.setVisible(true);
在这句之前已进行了一个判断,来确定addGroupMenu是否可视

注释掉这行后,功能按钮消失。

/**
ActionBarAdapter.java (apps\contacts\src\com\android\contacts\activities)
*/
public interface TabState {
public static int FAVORITES = 0;
public static int ALL = 1;
public static int GROUPS = 2;

public static int COUNT = 3;
public static int DEFAULT = ALL;
}

/**
MenuItem.java (apps\tvsettings\settings\src\com\android\tv\settings)packages
PeopleActivity中调用的MenuItem是这个类的
*/

//GroupEditorActivity.java
//

06-23 17:30:09.238: V/WindowManager(1376): Adding window Window{50c5c54 u0 PopupWindow:2e73e0f2} at 6 of 12 (after Window{30373fd0 u0 com.android.contacts/com.android.contacts.activities.PeopleActivity})
///frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
//line 952 log 添加窗口的时候都会调用,在这里没啥指导意义

【调试问题】
/*
~/workspace/AP/out/target/product/msm8909/system/priv-app/Contacts$ adb push Contacts.apk system/priv-app/Contacts
2412 KB/s (4819489 bytes in 1.951s)
liuyu@liuyu-OptiPlex-3020:~/workspace/AP/out/target/product/msm8909/system/priv-app/Contacts$ adb reboot
重启后,通讯录图标消失了
图标消失是因为出错。用fastboot重新烧录之后,通讯录正常。
修改源文件的错误,重新编译。push进去后,reboot,可以看到新打的log。
lsusb 18d1:d00d

*/

上一篇:Java 基于ArcFace人脸识别2.0 服务端Demo


下一篇:Linux - 死锁现象