Fix the action bar shows up problem

- Hide the internal action bar.
- Refine the Utils.setupEdgeToEdge API.
- Rollback the testcases.

Bug: 328622648
Fixes: 331308440
Test: atest com.android.settings.UtilsTest SettingsActivityTest
Change-Id: I7dfbc93def3e772b57bf06b8276315cee7402a9c
This commit is contained in:
Sunny Shao
2024-03-29 08:32:22 +08:00
parent c35fc38be9
commit 8803ae7823
5 changed files with 47 additions and 25 deletions

View File

@@ -1385,20 +1385,19 @@ public final class Utils extends com.android.settingslib.Utils {
* @param activity the Activity need to setup the edge to edge feature.
*/
public static void setupEdgeToEdge(@NonNull FragmentActivity activity) {
if (com.android.window.flags.Flags.enforceEdgeToEdge()) {
ViewCompat.setOnApplyWindowInsetsListener(activity.findViewById(android.R.id.content),
(v, windowInsets) -> {
Insets insets = windowInsets.getInsets(
WindowInsetsCompat.Type.systemBars()
| WindowInsetsCompat.Type.ime());
// Apply the insets paddings to the view.
v.setPadding(insets.left, insets.top, insets.right, insets.bottom);
ViewCompat.setOnApplyWindowInsetsListener(activity.findViewById(android.R.id.content),
(v, windowInsets) -> {
Insets insets = windowInsets.getInsets(
WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime());
int statusBarHeight = activity.getWindow().getDecorView().getRootWindowInsets()
.getInsets(WindowInsetsCompat.Type.statusBars()).top;
// Apply the insets paddings to the view.
v.setPadding(insets.left, statusBarHeight, insets.right, insets.bottom);
// Return CONSUMED if you don't want the window insets to keep being
// passed down to descendant views.
return WindowInsetsCompat.CONSUMED;
});
}
// Return CONSUMED if you don't want the window insets to keep being
// passed down to descendant views.
return WindowInsetsCompat.CONSUMED;
});
}
private static FaceManager.RemovalCallback faceManagerRemovalCallback(int userId) {