一、Recents实现逻辑跟踪
Recents对象继承于SystemUI对象,并实现了CommandQueue.Callbacks的重写方法和父类对象的方法重写
public class Recents extends SystemUI implements CommandQueue.Callbacks
- 构造方法
public Recents(Context context, RecentsImplementation impl, CommandQueue commandQueue) {
super(context);
mImpl = impl;
mCommandQueue = commandQueue;
}
- 重写方法
//重写自父类SystemUI
public void start()
public void onBootCompleted()
public void onConfigurationChanged(Configuration newConfig)
//重写自接口CommandQueue.Callbacks
public void appTransitionFinished(int displayId)
public void showRecentApps(boolean triggeredFromAltTab)
public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey)
public void toggleRecentApps()
public void preloadRecentApps()
public void cancelPreloadRecentApps()
重点关注showRecentApps/hideRecentApps/toggleRecentApps/preloadRecentApps/cancelPreloadRecentApps几个
与recent加载和取消相关的方法。发现统一特点:
if (!isUserSetup()) {
return;
}
//如果已配置此设备并已设置当前用户,全部由RecentsImplementation做对应处理
RecentsImplementation是接口类,具体实现交由OverviewProxyRecentsImpl。OverviewProxyRecentsImpl里面几个操作Recents的方法都会调用IOverviewProxy的方法去处理,IOverviewProxy是BinderProxy类型,是OverviewProxyService