Refine the provide insets parameters

There're 3 different parameters trying to affect the insets provided by
a window and can be set independently but are related. This change will
make a new class InsetsFrameProvider to let the window set all the
information needed for the insets at the same place.

Besides, this change also extends the insets calculation logic to
support more use cases. With this, the bars can provide insets outside
of its window frame as well.

Test: atest DisplayPolicyLayoutTests
Bug: 161689946
Bug: 232044523
Change-Id: I7059b3a222745818b6852a288416e197e2afd7b2
This commit is contained in:
Yunfan Chen
2022-04-18 18:55:08 +09:00
parent 833288448a
commit bcadfd2476
9 changed files with 373 additions and 193 deletions

View File

@@ -28,6 +28,7 @@ import android.os.Handler;
import android.os.RemoteException;
import android.util.Log;
import android.view.InsetsController;
import android.view.InsetsFrameProvider;
import android.view.InsetsState;
import android.view.SurfaceControl;
import android.view.WindowManager;
@@ -105,7 +106,11 @@ public class WindowManagerWrapper {
*/
public void setProvidesInsetsTypes(WindowManager.LayoutParams params,
int[] providesInsetsTypes) {
params.providesInsetsTypes = providesInsetsTypes;
final int length = providesInsetsTypes.length;
params.providedInsets = new InsetsFrameProvider[length];
for (int i = 0; i < length; i++) {
params.providedInsets[i] = new InsetsFrameProvider(providesInsetsTypes[i]);
}
}
/**