http://bbs.16rd.com/forum.php?mod=viewthread&tid=57808&highlight=recents
L Recent App风格相对于之前的版本变化很大,如果想在L版本实现KK版本的风格呢?
[SOLUTION]
可以按照如下几步解决:
1、Recents.java里把下面的flag true改为false:
// Which recents to use
boolean mUseALTErnateRecents = false; //true->false
2、修改ActivityRecord.java文件
Frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
final class ActivityRecord {
static final String TAG = ActivityManagerService.TAG;
static final boolean DEBUG_SAVED_STATE = ActivityStackSupervisor.DEBUG_SAVED_STATE;
//去掉下面这句
final public static String RECENTS_PACKAGE_NAME = "com.android.systemui.recents";
///新增下面这句
final public static String RECENTS_PACKAGE_NAME = "com.android.systemui.recent";
3、修改 frameworks/base/packages/SystemUI/src/com/android/systemui/recent/Recents.java
@Override
public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
if (mUseAlternateRecents) {
sAlternateRecents.onHideRecents(triggeredFromAltTab, triggeredFromHomeKey);
} else {
///新增如下代码
- if (triggeredFromHomeKey) {
- Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
- homeIntent.addCategory(Intent.CATEGORY_HOME);
- homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
- mContext.startActivityAsUser(homeIntent, UserHandle.CURRENT);
- }
Intent intent = new Intent(RecentsActivity.CLOSE_RECENTS_INTENT);
intent.setPackage("com.android.systemui");
sendBroadcastSafely(intent);
RecentTasksLoader.getInstance(mContext).cancelPreloadingFirstTask();
}
}
4、修改
frameworks/base/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (CLOSE_RECENTS_INTENT.equals(intent.getAction())) {
if (mRecentsPanel != null && mRecentsPanel.isShowing()) {
- if (mShowing && !mForeground) {//去掉这行
///新增如下代码
- if (mShowing) {
// Captures the case right before we transition to another activity
mRecentsPanel.show(false); - if (mForeground) {
- finish();
- }
}
}
} else if (WINDOW_ANIMATION_START_INTENT.equals(intent.getAction())) {
if (mRecentsPanel != null) {
mRecentsPanel.onWindowAnimationStart();
}
}
}
};</font></font>
|