2016.06.28.

1.getTopActivity

    private String getTopActivityPackageName() {
        String topActivityPackage = null;
        String topActivityClass = null;
        ActivityManager activityManager = (ActivityManager) (mContext
                .getSystemService(Context.ACTIVITY_SERVICE));
        List<ActivityManager.RunningTaskInfo> runningTaskInfos = activityManager
                .getRunningTasks(1);
        if (runningTaskInfos != null) {
            ComponentName f = runningTaskInfos.get(0).topActivity;
            topActivityPackage = f.getPackageName();
            topActivityClass = f.getClassName();
        }
        return topActivityPackage;
    }

2.屏蔽HOME KEY
在PhoneWindowManager.java中,选择interceptKeyBeforeDispatching方法,进行屏蔽。

3.

results matching ""

    No results matching ""