## Scheme 1: App plug-in scheme ##### Add method of negative screen View: Judge hasCustomContentToLeft in the Launcher bindScreens() and add a page of CellLayout to the workspace to use the plug-in solution for App. The Launcher uses reflection to create a View by calling classes and methods in a screen app. Many different negative screens can be implemented. #####App plug-in solution Basic principle: Obtain the Context of the plug-in App

Context e = activity.getApplicationContext().createPackageContext(targetPackageName, 
Context.CONTEXT_IGNORE_SECURITY | Context.CONTEXT_INCLUDE_CODE);
Copy the code

Use reflection interface to obtain the proxy class in the third-party application, and construct:

Class clazz = e.getClassLoader().loadClass(targetClassName);
Constructor constructor = clazz.getDeclaredConstructor(new Class[]{Context.class, Activity.class});
Object mPageProxyImpl = constructor.newInstance(new Object[]{pkgContext, activity});
Copy the code

The advantages and disadvantages of this solution are as follows: 1. The single-screen View uses the customLayout solution provided by Launcher3, which is easy to implement 2. The independent scheme can decouple the development of the launcher from the negative screen. 3. The negative screen still runs in the process of the launcher. Data transfer between the two APKs is still a problem, which needs to be solved by the interprocess communication solution

## Plan 2: Google officially defines two interfaces, ILauncherOverlay and ILauncherOverlayCallback, which communicate between aiDL processes. Use windowManager. addView to add a floating window and change the position of the negative-screen View with translationX. Blog.csdn.net/u013032242/… Advantages and disadvantages of the scheme:

  1. The implementation of a negative screen View is more difficult than scheme 1
  2. Perfectly decoupled from the Launcher, it runs in a separate process and has no memory problems affecting the Launcher.