diff --git a/base-patches/frameworks/base/0018-Allow-boringdroid-to-use-ROM-s-navbar-button-placeme.patch b/base-patches/frameworks/base/0018-Allow-boringdroid-to-use-ROM-s-navbar-button-placeme.patch new file mode 100644 index 0000000..1665355 --- /dev/null +++ b/base-patches/frameworks/base/0018-Allow-boringdroid-to-use-ROM-s-navbar-button-placeme.patch @@ -0,0 +1,28 @@ +From 56ac58a495d7d21f7bed938d0ac25f30c5446de6 Mon Sep 17 00:00:00 2001 +From: Jon West +Date: Tue, 1 Sep 2020 19:06:42 -0400 +Subject: [PATCH 1/2] Allow boringdroid to use ROM's navbar button placement + +Change-Id: I22b6bdbfaaee956bce3a9a0ac65cae89f3a803ca +--- + .../systemui/statusbar/phone/NavigationBarInflaterView.java | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java +index e42fca34fdd0..174b193bc453 100644 +--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java ++++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java +@@ -511,10 +511,6 @@ public class NavigationBarInflaterView extends FrameLayout + // region @boringdroid + if (BoringdroidConfig.IS_SYSTEMUI_PLUGIN_ENABLED && v instanceof KeyButtonView) { + ViewGroup.LayoutParams layoutParams = v.getLayoutParams(); +- layoutParams.width = +- (int) v.getContext() +- .getResources() +- .getDimension(R.dimen.boring_navigation_key_width); + v.setLayoutParams(layoutParams); + v.setPadding(0, v.getPaddingTop(), 0, v.getPaddingBottom()); + } +-- +2.25.1 + diff --git a/base-patches/frameworks/base/0018-Fix-freeform-window-moving-resizing-doesn-t-work.patch b/base-patches/frameworks/base/0018-Fix-freeform-window-moving-resizing-doesn-t-work.patch deleted file mode 100644 index e69de29..0000000 diff --git a/base-patches/frameworks/base/0022-Impl-basic-window-round-corner-with-Outline.patch b/base-patches/frameworks/base/0019-Impl-basic-window-round-corner-with-Outline.patch similarity index 97% rename from base-patches/frameworks/base/0022-Impl-basic-window-round-corner-with-Outline.patch rename to base-patches/frameworks/base/0019-Impl-basic-window-round-corner-with-Outline.patch index 85eb392..546de7f 100644 --- a/base-patches/frameworks/base/0022-Impl-basic-window-round-corner-with-Outline.patch +++ b/base-patches/frameworks/base/0019-Impl-basic-window-round-corner-with-Outline.patch @@ -1,7 +1,7 @@ -From dbfe70e7893031fb3fa72ddcd00aac0083052c6c Mon Sep 17 00:00:00 2001 +From cda5f93112128a18b4f4ad134432f04724504908 Mon Sep 17 00:00:00 2001 From: utzcoz Date: Thu, 3 Sep 2020 00:09:53 +0800 -Subject: [PATCH 22/25] Impl basic window round corner with Outline +Subject: [PATCH 2/2] Impl basic window round corner with Outline Signed-off-by: utzcoz Change-Id: I65925af3c2739fc896ee26076f80da45dbffeaf8 diff --git a/base-patches/frameworks/base/0019-Refactor-Move-bounds-mode-logic-to-new-BoringdroidMa.patch b/base-patches/frameworks/base/0019-Refactor-Move-bounds-mode-logic-to-new-BoringdroidMa.patch deleted file mode 100644 index b6cd81b..0000000 --- a/base-patches/frameworks/base/0019-Refactor-Move-bounds-mode-logic-to-new-BoringdroidMa.patch +++ /dev/null @@ -1,501 +0,0 @@ -From 2d5f045ef159e126c824bca022fa614cdf55113b Mon Sep 17 00:00:00 2001 -From: utzcoz -Date: Mon, 31 Aug 2020 23:33:59 +0800 -Subject: [PATCH 19/25] Refactor: Move bounds/mode logic to new - BoringdroidManager - -Signed-off-by: utzcoz ---- - .../android/internal/BoringdroidManager.java | 145 ++++++++++++++++++ - .../android/systemui/BoringdroidConfig.java | 24 --- - .../phone/NavigationBarInflaterView.java | 6 +- - .../com/android/server/wm/ActivityStack.java | 9 +- - .../android/server/wm/ActivityStarter.java | 8 +- - .../server/wm/RootActivityContainer.java | 4 +- - .../com/android/server/wm/TaskRecord.java | 8 +- - .../server/wm/WindowManagerService.java | 121 +-------------- - 8 files changed, 171 insertions(+), 154 deletions(-) - create mode 100644 core/java/com/android/internal/BoringdroidManager.java - delete mode 100644 packages/SystemUI/src/com/android/systemui/BoringdroidConfig.java - -diff --git a/core/java/com/android/internal/BoringdroidManager.java b/core/java/com/android/internal/BoringdroidManager.java -new file mode 100644 -index 000000000000..0695a20db9d2 ---- /dev/null -+++ b/core/java/com/android/internal/BoringdroidManager.java -@@ -0,0 +1,145 @@ -+/* -+ * Copyright (C) 2020 The boringdroid Project -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); -+ * you may not use this file except in compliance with the License. -+ * You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ */ -+ -+package com.android.internal; -+ -+import android.app.WindowConfiguration; -+import android.content.Context; -+import android.content.SharedPreferences; -+import android.graphics.Rect; -+import android.os.Environment; -+import android.os.SystemProperties; -+import android.os.UserHandle; -+import android.os.UserManager; -+import android.util.Slog; -+ -+import java.io.File; -+import java.util.ArrayList; -+import java.util.List; -+ -+/** -+ * @hide -+ */ -+public class BoringdroidManager { -+ public static boolean IS_SYSTEMUI_PLUGIN_ENABLED = -+ SystemProperties.getBoolean("persist.sys.systemuiplugin.enabled", false); -+ -+ private static final String PACKAGE_WINDOW_BOUNDS_NAME = "package-window-bounds"; -+ private static final String PACKAGE_WINDOWING_MODE_NAME = "package-windowing-mode"; -+ private static final List DISALLOWED_LIST = new ArrayList<>(); -+ private static final String TAG = "BoringdroidConfig"; -+ -+ static { -+ DISALLOWED_LIST.add("android"); -+ DISALLOWED_LIST.add("com.android.systemui"); -+ } -+ -+ public static boolean isPCModeEnabled() { -+ return SystemProperties.getBoolean("persist.sys.pcmode.enabled", true); -+ } -+ -+ private static boolean isInPCModeDisallowedList(String packageName) { -+ return packageName != null && DISALLOWED_LIST.contains(packageName); -+ } -+ -+ private static boolean isDataSystemDirNotReady(Context context) { -+ UserManager userManager = context.getSystemService(UserManager.class); -+ return !(userManager != null && userManager.isUserUnlockingOrUnlocked(UserHandle.myUserId())); -+ } -+ -+ private static File getPackageWindowingModeFile() { -+ return new File( -+ Environment.getDataSystemCeDirectory(UserHandle.myUserId()) -+ + File.separator + PACKAGE_WINDOWING_MODE_NAME -+ ); -+ } -+ -+ private static File getPackageWindowBoundsName() { -+ return new File( -+ Environment.getDataSystemCeDirectory(UserHandle.myUserId()) -+ + File.separator + PACKAGE_WINDOW_BOUNDS_NAME -+ ); -+ } -+ -+ public static void savePackageWindowingMode(Context context, -+ String packageName, -+ @WindowConfiguration.WindowingMode -+ int windowingMode) { -+ if (BoringdroidManager.isDataSystemDirNotReady(context)) { -+ Slog.e(TAG, "Calling savePackageWindowingMode with package " + packageName -+ + ", and mode " + windowingMode + ", before file is ready"); -+ return; -+ } -+ SharedPreferences sharedPreferences = -+ context.getSharedPreferences(getPackageWindowingModeFile(), Context.MODE_PRIVATE); -+ sharedPreferences.edit().putInt(packageName, windowingMode).apply(); -+ } -+ -+ public static @WindowConfiguration.WindowingMode -+ int getPackageWindowingMode(Context context, String packageName) { -+ if (BoringdroidManager.isDataSystemDirNotReady(context)) { -+ Slog.e(TAG, "Calling getPackageWindowingMode with package " + packageName -+ + ", before file is ready"); -+ return WindowConfiguration.WINDOWING_MODE_UNDEFINED; -+ } -+ if (!BoringdroidManager.isPCModeEnabled()) { -+ return WindowConfiguration.WINDOWING_MODE_UNDEFINED; -+ } -+ // If the package is in the multi window black list, it will run in default -+ // windowing mode. -+ if (isInPCModeDisallowedList(packageName)) { -+ return WindowConfiguration.WINDOWING_MODE_UNDEFINED; -+ } -+ SharedPreferences sharedPreferences = -+ context.getSharedPreferences(getPackageWindowingModeFile(), Context.MODE_PRIVATE); -+ // We hope the default windowing mode is freeform. -+ return sharedPreferences.getInt(packageName, WindowConfiguration.WINDOWING_MODE_FREEFORM); -+ } -+ -+ public static void savePackageWindowBounds(Context context, String packageName, Rect bounds) { -+ if (BoringdroidManager.isDataSystemDirNotReady(context)) { -+ Slog.e(TAG, "Calling savePackageWindowBounds with package " + packageName -+ + ", and bounds " + bounds + ", before file is ready"); -+ return; -+ } -+ SharedPreferences sharedPreferences = -+ context.getSharedPreferences(getPackageWindowBoundsName(), Context.MODE_PRIVATE); -+ Rect tempBounds = new Rect(bounds); -+ sharedPreferences -+ .edit() -+ .putInt(packageName + "-left", tempBounds.left) -+ .putInt(packageName + "-top", tempBounds.top) -+ .putInt(packageName + "-right", tempBounds.right) -+ .putInt(packageName + "-bottom", tempBounds.bottom) -+ .apply(); -+ } -+ -+ public static Rect getPackageWindowBounds(Context context, String packageName) { -+ if (BoringdroidManager.isDataSystemDirNotReady(context)) { -+ Slog.e(TAG, "Calling getPackageWindowBounds with package " + packageName -+ + ", before file is ready"); -+ return new Rect(); -+ } -+ SharedPreferences sharedPreferences = -+ context.getSharedPreferences(getPackageWindowBoundsName(), Context.MODE_PRIVATE); -+ return new Rect( -+ sharedPreferences.getInt(packageName + "-left", 0), -+ sharedPreferences.getInt(packageName + "-top", 0), -+ sharedPreferences.getInt(packageName + "-right", 0), -+ sharedPreferences.getInt(packageName + "-bottom", 0) -+ ); -+ } -+} -\ No newline at end of file -diff --git a/packages/SystemUI/src/com/android/systemui/BoringdroidConfig.java b/packages/SystemUI/src/com/android/systemui/BoringdroidConfig.java -deleted file mode 100644 -index d4aff777d938..000000000000 ---- a/packages/SystemUI/src/com/android/systemui/BoringdroidConfig.java -+++ /dev/null -@@ -1,24 +0,0 @@ --/* -- * Copyright (C) 2020 The boringdroid Project -- * -- * Licensed under the Apache License, Version 2.0 (the "License"); -- * you may not use this file except in compliance with the License. -- * You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- */ -- --package com.android.systemui; -- --import android.os.SystemProperties; -- --public class BoringdroidConfig { -- public static boolean IS_SYSTEMUI_PLUGIN_ENABLED = -- SystemProperties.getBoolean("persist.sys.systemuiplugin.enabled", false); --} -\ No newline at end of file -diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java -index e42fca34fdd0..2b57d4348a43 100644 ---- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java -+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java -@@ -38,7 +38,7 @@ import android.widget.LinearLayout; - import android.widget.Space; - - import com.android.internal.annotations.VisibleForTesting; --import com.android.systemui.BoringdroidConfig; -+import com.android.internal.BoringdroidManager; - import com.android.systemui.Dependency; - import com.android.systemui.R; - import com.android.systemui.recents.OverviewProxyService; -@@ -161,7 +161,7 @@ public class NavigationBarInflaterView extends FrameLayout - return getContext().getString(defaultResource).replace("home_handle", ""); - } - // region @boringdroid -- if (BoringdroidConfig.IS_SYSTEMUI_PLUGIN_ENABLED) { -+ if (BoringdroidManager.IS_SYSTEMUI_PLUGIN_ENABLED) { - return getContext().getString(R.string.boring_config_navBarLayout); - } else { - return getContext().getString(defaultResource); -@@ -509,7 +509,7 @@ public class NavigationBarInflaterView extends FrameLayout - } - } - // region @boringdroid -- if (BoringdroidConfig.IS_SYSTEMUI_PLUGIN_ENABLED && v instanceof KeyButtonView) { -+ if (BoringdroidManager.IS_SYSTEMUI_PLUGIN_ENABLED && v instanceof KeyButtonView) { - ViewGroup.LayoutParams layoutParams = v.getLayoutParams(); - layoutParams.width = - (int) v.getContext() -diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java -index 890b9737e26d..6ddc25ea1f71 100644 ---- a/services/core/java/com/android/server/wm/ActivityStack.java -+++ b/services/core/java/com/android/server/wm/ActivityStack.java -@@ -153,6 +153,7 @@ import android.util.Slog; - import android.util.proto.ProtoOutputStream; - import android.view.Display; - -+import com.android.internal.BoringdroidManager; - import com.android.internal.annotations.GuardedBy; - import com.android.internal.annotations.VisibleForTesting; - import com.android.internal.app.IVoiceInteractor; -@@ -801,7 +802,9 @@ class ActivityStack extends ConfigurationContainer { - // region @boringdroid - // When stack's windowing mode changed, we will persist this windowing mode for top activity. - if (topActivity != null) { -- mWindowManager.savePackageWindowingMode(topActivity.appInfo.packageName, windowingMode); -+ BoringdroidManager.savePackageWindowingMode( -+ WindowManagerService.getWMSContext(), topActivity.appInfo.packageName, windowingMode -+ ); - } - // endregion - -@@ -3159,7 +3162,9 @@ class ActivityStack extends ConfigurationContainer { - // windowing mode in setWindowingMode will be used to save windowing mode when - // changing windowing mode dynamically after task created, for example clicking - // maximize button to move task to fullscreen stack from freefrom stack. -- mWindowManager.savePackageWindowingMode(r.packageName, getWindowingMode()); -+ BoringdroidManager.savePackageWindowingMode( -+ WindowManagerService.getWMSContext(), r.packageName, getWindowingMode() -+ ); - // endregion - final boolean allowMoveToFront = options == null || !options.getAvoidMoveToFront(); - // mLaunchTaskBehind tasks get placed at the back of the task stack. -diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java -index 0aaef9cba518..71b7e62374b5 100644 ---- a/services/core/java/com/android/server/wm/ActivityStarter.java -+++ b/services/core/java/com/android/server/wm/ActivityStarter.java -@@ -118,6 +118,7 @@ import android.util.EventLog; - import android.util.Pools.SynchronizedPool; - import android.util.Slog; - -+import com.android.internal.BoringdroidManager; - import com.android.internal.annotations.VisibleForTesting; - import com.android.internal.app.HeavyWeightSwitcherActivity; - import com.android.internal.app.IVoiceInteractor; -@@ -1483,9 +1484,10 @@ class ActivityStarter { - } - if (mOptions.getLaunchWindowingMode() == WINDOWING_MODE_UNDEFINED) { - mOptions.setLaunchWindowingMode( -- WindowManagerService -- .getWMSInstance() -- .getPackageWindowingMode(mStartActivity.info.packageName) -+ BoringdroidManager.getPackageWindowingMode( -+ WindowManagerService.getWMSContext(), -+ mStartActivity.info.packageName -+ ) - ); - } - // endregion -diff --git a/services/core/java/com/android/server/wm/RootActivityContainer.java b/services/core/java/com/android/server/wm/RootActivityContainer.java -index 73c822abe488..a0f6b65b9dbf 100644 ---- a/services/core/java/com/android/server/wm/RootActivityContainer.java -+++ b/services/core/java/com/android/server/wm/RootActivityContainer.java -@@ -111,6 +111,7 @@ import android.util.proto.ProtoOutputStream; - import android.view.Display; - import android.view.DisplayInfo; - -+import com.android.internal.BoringdroidManager; - import com.android.internal.annotations.VisibleForTesting; - import com.android.internal.app.ResolverActivity; - import com.android.server.LocalServices; -@@ -2246,7 +2247,8 @@ class RootActivityContainer extends ConfigurationContainer - packageName = intent.getComponent().getPackageName(); - } - windowingMode = packageName == null -- ? windowingMode : mWindowManager.getPackageWindowingMode(packageName); -+ ? windowingMode -+ : BoringdroidManager.getPackageWindowingMode(WindowManagerService.getWMSContext(), packageName); - if (windowingMode == WINDOWING_MODE_FREEFORM) { - aOptions.setLaunchWindowingMode(windowingMode); - } -diff --git a/services/core/java/com/android/server/wm/TaskRecord.java b/services/core/java/com/android/server/wm/TaskRecord.java -index 6bdc5ad6f1f4..39861282aaee 100644 ---- a/services/core/java/com/android/server/wm/TaskRecord.java -+++ b/services/core/java/com/android/server/wm/TaskRecord.java -@@ -123,6 +123,7 @@ import android.util.proto.ProtoOutputStream; - import android.view.Display; - import android.view.DisplayInfo; - -+import com.android.internal.BoringdroidManager; - import com.android.internal.annotations.VisibleForTesting; - import com.android.internal.app.IVoiceInteractor; - import com.android.internal.util.XmlUtils; -@@ -648,7 +649,9 @@ class TaskRecord extends ConfigurationContainer { - && mStack.getWindowingMode() == WINDOWING_MODE_FREEFORM - && !savedBounds.isEmpty() - && packageName != null) { -- WindowManagerService.getWMSInstance().savePackageWindowBounds(packageName, savedBounds); -+ BoringdroidManager.savePackageWindowBounds( -+ WindowManagerService.getWMSContext(), packageName, savedBounds -+ ); - } - } - // endregion -@@ -2385,7 +2388,8 @@ class TaskRecord extends ConfigurationContainer { - } - mLastNonFullscreenBounds = - packageName != null -- ? WindowManagerService.getWMSInstance().getPackageWindowBounds(packageName) -+ ? BoringdroidManager.getPackageWindowBounds( -+ WindowManagerService.getWMSContext(), packageName) - : new Rect(); - if (!mLastNonFullscreenBounds.isEmpty()) { - return mLastNonFullscreenBounds; -diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java -index 37b4cb4112f7..9478991e9b94 100644 ---- a/services/core/java/com/android/server/wm/WindowManagerService.java -+++ b/services/core/java/com/android/server/wm/WindowManagerService.java -@@ -158,7 +158,6 @@ import android.os.Binder; - import android.os.Build; - import android.os.Bundle; - import android.os.Debug; --import android.os.Environment; - import android.os.Handler; - import android.os.HandlerExecutor; - import android.os.IBinder; -@@ -181,7 +180,6 @@ import android.os.SystemProperties; - import android.os.SystemService; - import android.os.Trace; - import android.os.UserHandle; --import android.os.UserManager; - import android.os.WorkSource; - import android.provider.DeviceConfig; - import android.provider.Settings; -@@ -7838,126 +7836,11 @@ public class WindowManagerService extends IWindowManager.Stub - } - } - // region @boringdroid -- private static final String PACKAGE_WINDOWING_MODE_NAME = "package-windowing-mode"; -- private static final String PACKAGE_WINDOW_BOUNDS_NAME = "package-window-bounds"; -- -- private static boolean isDataSystemDirNotReady(Context context) { -- UserManager userManager = context.getSystemService(UserManager.class); -- return !(userManager != null && userManager.isUserUnlockingOrUnlocked(UserHandle.myUserId())); -- } -- -- private static File getPackageWindowingModeFile() { -- return new File( -- Environment.getDataSystemCeDirectory(UserHandle.myUserId()) -- + File.separator + PACKAGE_WINDOWING_MODE_NAME -- ); -- } -- -- private static File getPackageWindowBoundsName() { -- return new File( -- Environment.getDataSystemCeDirectory(UserHandle.myUserId()) -- + File.separator + PACKAGE_WINDOW_BOUNDS_NAME -- ); -- } -- -- /** -- * @hide -- */ -- public static WindowManagerService getWMSInstance() { -- return getInstance(); -- } -- -- /** -- * @hide -- */ -- public void savePackageWindowingMode(String packageName, -- @WindowConfiguration.WindowingMode int windowingMode) { -- -- if (isDataSystemDirNotReady(mContext)) { -- Slog.e(TAG, "Calling savePackageWindowingMode with package " + packageName -- + ", and mode " + windowingMode + ", before file is ready"); -- return; -- } -- SharedPreferences sharedPreferences = -- mContext.getSharedPreferences(getPackageWindowingModeFile(), Context.MODE_PRIVATE); -- sharedPreferences.edit().putInt(packageName, windowingMode).apply(); -- } -- -- /** -- * @hide -- */ -- public @WindowConfiguration.WindowingMode int getPackageWindowingMode(String packageName) { -- if (isDataSystemDirNotReady(mContext)) { -- Slog.e(TAG, "Calling getPackageWindowingMode with package " + packageName -- + ", before file is ready"); -- return WindowConfiguration.WINDOWING_MODE_UNDEFINED; -- } -- // We only enable freeform when systemui plugin enabled. -- if (!SystemProperties.getBoolean("persist.sys.pcmode.enabled", false)) { -- return WindowConfiguration.WINDOWING_MODE_UNDEFINED; -- } -- // If the package is in the multi window black list, it will run in default -- // windowing mode. -- if (isInMultiWindowDisallowList(packageName)) { -- return WindowConfiguration.WINDOWING_MODE_UNDEFINED; -- } -- SharedPreferences sharedPreferences = -- mContext.getSharedPreferences(getPackageWindowingModeFile(), Context.MODE_PRIVATE); -- // We hope the default windowing mode is freeform. -- return sharedPreferences.getInt(packageName, WindowConfiguration.WINDOWING_MODE_FREEFORM); -- } -- - /** - * @hide - */ -- public void savePackageWindowBounds(String packageName, Rect bounds) { -- if (isDataSystemDirNotReady(mContext)) { -- Slog.e(TAG, "Calling savePackageWindowBounds with package " + packageName -- + ", and bounds " + bounds + ", before file is ready"); -- return; -- } -- SharedPreferences sharedPreferences = -- mContext.getSharedPreferences(getPackageWindowBoundsName(), Context.MODE_PRIVATE); -- Rect tempBounds = new Rect(bounds); -- sharedPreferences -- .edit() -- .putInt(packageName + "-left", tempBounds.left) -- .putInt(packageName + "-top", tempBounds.top) -- .putInt(packageName + "-right", tempBounds.right) -- .putInt(packageName + "-bottom", tempBounds.bottom) -- .apply(); -- } -- -- /** -- * @hide -- */ -- public Rect getPackageWindowBounds(String packageName) { -- if (isDataSystemDirNotReady(mContext)) { -- Slog.e(TAG, "Calling getPackageWindowBounds with package " + packageName -- + ", before file is ready"); -- return new Rect(); -- } -- SharedPreferences sharedPreferences = -- mContext.getSharedPreferences(getPackageWindowBoundsName(), Context.MODE_PRIVATE); -- return new Rect( -- sharedPreferences.getInt(packageName + "-left", 0), -- sharedPreferences.getInt(packageName + "-top", 0), -- sharedPreferences.getInt(packageName + "-right", 0), -- sharedPreferences.getInt(packageName + "-bottom", 0) -- ); -- } -- -- private boolean isInMultiWindowDisallowList(String packageName) { -- if (packageName == null) { -- return false; -- } -- if (packageName.equals("android")) { -- return true; -- } -- if (packageName.contains("com.android.systemui")) { -- return true; -- } -- return false; -+ public static Context getWMSContext() { -+ return getInstance().mContext; - } - // endregion - } --- -2.25.1 - diff --git a/base-patches/frameworks/base/0020-Expose-package-windowing-mode-overlay-for-definning-.patch b/base-patches/frameworks/base/0020-Expose-package-windowing-mode-overlay-for-definning-.patch deleted file mode 100644 index 1b43472..0000000 --- a/base-patches/frameworks/base/0020-Expose-package-windowing-mode-overlay-for-definning-.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 1719780de662e6d41e396c91428fbbd4f70b14c2 Mon Sep 17 00:00:00 2001 -From: utzcoz -Date: Wed, 2 Sep 2020 00:15:03 +0800 -Subject: [PATCH 20/25] Expose package-windowing-mode-overlay for definning - windowing mode - -The location is /data/system_ce/0/package-windowing-mode-overlay. - -The example content is: - - - - - - - -So the current windowing mode checking chain is: -1. If pc mode is enabled, we should set all package to undefined, and let system - to calculate windowing mode based on package config. -2. If package is in our defined pc disallowed list, we should set it to undefined. -3. If package has windowing mode defined in overlay shared preferences, we should use - whatever defined in that file. The frameworks will not change it, and leave it to - other system apps or user. If you want to set specific package to specific windowing - mode, just to modify it with key for package name and int value for windowing mode, - based on WindowConfiguration definition. -4. If non of above, we will try to get windowing mode of package from saved shared - preferences, what will be modified when user changing window mode with shortcut - or decor caption bar. The default is WINDOWING_MODE_FREEFORM. - -Signed-off-by: utzcoz ---- - .../android/internal/BoringdroidManager.java | 31 +++++++++++++++++++ - .../server/wm/LaunchParamsPersister.java | 11 +++++++ - 2 files changed, 42 insertions(+) - -diff --git a/core/java/com/android/internal/BoringdroidManager.java b/core/java/com/android/internal/BoringdroidManager.java -index 0695a20db9d2..0b1168734fab 100644 ---- a/core/java/com/android/internal/BoringdroidManager.java -+++ b/core/java/com/android/internal/BoringdroidManager.java -@@ -39,6 +39,7 @@ public class BoringdroidManager { - - private static final String PACKAGE_WINDOW_BOUNDS_NAME = "package-window-bounds"; - private static final String PACKAGE_WINDOWING_MODE_NAME = "package-windowing-mode"; -+ private static final String PACKAGE_WINDOWING_MODE_OVERLAY_NAME = "package-windowing-mode-overlay"; - private static final List DISALLOWED_LIST = new ArrayList<>(); - private static final String TAG = "BoringdroidConfig"; - -@@ -67,6 +68,13 @@ public class BoringdroidManager { - ); - } - -+ private static File getPackageWindowingModeOverlayFile() { -+ return new File( -+ Environment.getDataSystemCeDirectory(UserHandle.myUserId()) -+ + File.separator + PACKAGE_WINDOWING_MODE_OVERLAY_NAME -+ ); -+ } -+ - private static File getPackageWindowBoundsName() { - return new File( - Environment.getDataSystemCeDirectory(UserHandle.myUserId()) -@@ -95,6 +103,18 @@ public class BoringdroidManager { - + ", before file is ready"); - return WindowConfiguration.WINDOWING_MODE_UNDEFINED; - } -+ // Okay, there is a checking chain for package windowing mode: -+ // 1. If pc mode is enabled, we should set all package to undefined, and let system -+ // to calculate windowing mode based on package config. -+ // 2. If package is in our defined pc disallowed list, we should set it to undefined. -+ // 3. If package has windowing mode defined in overlay shared preferences, we should use -+ // whatever defined in that file. The frameworks will not change it, and leave it to -+ // other system apps or user. If you want to set specific package to specific windowing -+ // mode, just to modify it with key for package name and int value for windowing mode, -+ // based on WindowConfiguration definition. -+ // 4. If non of above, we will try to get windowing mode of package from saved shared -+ // preferences, what will be modified when user changing window mode with shortcut -+ // or decor caption bar. The default is WINDOWING_MODE_FREEFORM. - if (!BoringdroidManager.isPCModeEnabled()) { - return WindowConfiguration.WINDOWING_MODE_UNDEFINED; - } -@@ -103,6 +123,17 @@ public class BoringdroidManager { - if (isInPCModeDisallowedList(packageName)) { - return WindowConfiguration.WINDOWING_MODE_UNDEFINED; - } -+ SharedPreferences overlaySharedPreferences = -+ context.getSharedPreferences( -+ getPackageWindowingModeOverlayFile(), -+ Context.MODE_PRIVATE -+ ); -+ int overlayWindowingMode = overlaySharedPreferences.getInt(packageName, -1); -+ Slog.d(TAG, "Found overlay windowing mode " + overlayWindowingMode -+ + ", for package " + packageName); -+ if (overlayWindowingMode != -1) { -+ return overlayWindowingMode; -+ } - SharedPreferences sharedPreferences = - context.getSharedPreferences(getPackageWindowingModeFile(), Context.MODE_PRIVATE); - // We hope the default windowing mode is freeform. -diff --git a/services/core/java/com/android/server/wm/LaunchParamsPersister.java b/services/core/java/com/android/server/wm/LaunchParamsPersister.java -index d364a3765c22..4dd6f10b7d19 100644 ---- a/services/core/java/com/android/server/wm/LaunchParamsPersister.java -+++ b/services/core/java/com/android/server/wm/LaunchParamsPersister.java -@@ -16,6 +16,7 @@ - - package com.android.server.wm; - -+import android.app.WindowConfiguration; - import android.content.ComponentName; - import android.content.pm.PackageList; - import android.content.pm.PackageManagerInternal; -@@ -29,6 +30,7 @@ import android.util.SparseArray; - import android.util.Xml; - import android.view.DisplayInfo; - -+import com.android.internal.BoringdroidManager; - import com.android.internal.annotations.VisibleForTesting; - import com.android.internal.util.FastXmlSerializer; - import com.android.server.LocalServices; -@@ -267,6 +269,15 @@ class LaunchParamsPersister { - } - outParams.mWindowingMode = persistableParams.mWindowingMode; - outParams.mBounds.set(persistableParams.mBounds); -+ // region @boringdroid -+ if (name != null -+ && BoringdroidManager.getPackageWindowingMode( -+ WindowManagerService.getWMSContext(), name.getPackageName()) -+ != WindowConfiguration.WINDOWING_MODE_FREEFORM) { -+ outParams.mWindowingMode = WindowConfiguration.WINDOWING_MODE_UNDEFINED; -+ outParams.mBounds.setEmpty(); -+ } -+ // endregion - } - - void removeRecordForPackage(String packageName) { --- -2.25.1 - diff --git a/base-patches/frameworks/base/0021-Don-t-use-shared-preference-cache-for-windowing-mode.patch b/base-patches/frameworks/base/0021-Don-t-use-shared-preference-cache-for-windowing-mode.patch deleted file mode 100644 index 70447f1..0000000 --- a/base-patches/frameworks/base/0021-Don-t-use-shared-preference-cache-for-windowing-mode.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 6171b875d25abd240d249741c480a920e0fd884a Mon Sep 17 00:00:00 2001 -From: utzcoz -Date: Wed, 2 Sep 2020 00:34:25 +0800 -Subject: [PATCH 21/25] Don't use shared preference cache for windowing mode - -Signed-off-by: utzcoz ---- - core/java/com/android/internal/BoringdroidManager.java | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/core/java/com/android/internal/BoringdroidManager.java b/core/java/com/android/internal/BoringdroidManager.java -index 0b1168734fab..e4ac0a59cdc7 100644 ---- a/core/java/com/android/internal/BoringdroidManager.java -+++ b/core/java/com/android/internal/BoringdroidManager.java -@@ -123,6 +123,7 @@ public class BoringdroidManager { - if (isInPCModeDisallowedList(packageName)) { - return WindowConfiguration.WINDOWING_MODE_UNDEFINED; - } -+ context.reloadSharedPreferences(); - SharedPreferences overlaySharedPreferences = - context.getSharedPreferences( - getPackageWindowingModeOverlayFile(), --- -2.25.1 - diff --git a/base-patches/frameworks/base/0023-Don-t-throw-exception-for-setShelfHeight-checking.patch b/base-patches/frameworks/base/0023-Don-t-throw-exception-for-setShelfHeight-checking.patch deleted file mode 100644 index 2797623..0000000 --- a/base-patches/frameworks/base/0023-Don-t-throw-exception-for-setShelfHeight-checking.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 7e0dd758bfb8c8f18975c77b428596ee78b93433 Mon Sep 17 00:00:00 2001 -From: utzcoz -Date: Sun, 13 Sep 2020 16:45:34 +0800 -Subject: [PATCH 23/25] Don't throw exception for setShelfHeight checking - -If we change default overview recents component, the Launcher3QuickStep -will crash because it doesn't have STATE_BAR permission and is not -recents app when it tryies to invoke setShelfHeight. We will change -default recents app, and keep Launcher3QuickStep, so we should disable -throwing exception, and just do nothing for method invokeing. - -Signed-off-by: utzcoz ---- - .../com/android/server/wm/WindowManagerService.java | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java -index 9478991e9b94..813d7562e5e3 100644 ---- a/services/core/java/com/android/server/wm/WindowManagerService.java -+++ b/services/core/java/com/android/server/wm/WindowManagerService.java -@@ -5696,8 +5696,17 @@ public class WindowManagerService extends IWindowManager.Stub - - @Override - public void setShelfHeight(boolean visible, int shelfHeight) { -- mAtmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR, -- "setShelfHeight()"); -+ // region @boringdroid -+ try { -+ mAtmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR, -+ "setShelfHeight()"); -+ } catch (SecurityException e) { -+ Slog.e(TAG, "Need permision android.Manifest.permission.STATUS_BAR for setShelfHeight", e); -+ return; -+ } -+ // mAtmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR, -+ // "setShelfHeight()"); -+ // endregion - synchronized (mGlobalLock) { - getDefaultDisplayContentLocked().getPinnedStackController().setAdjustedForShelf(visible, - shelfHeight); --- -2.25.1 - diff --git a/base-patches/frameworks/base/0024-Notify-task-moved-to-front-event-when-focused-task-c.patch b/base-patches/frameworks/base/0024-Notify-task-moved-to-front-event-when-focused-task-c.patch deleted file mode 100644 index 0ff1bec..0000000 --- a/base-patches/frameworks/base/0024-Notify-task-moved-to-front-event-when-focused-task-c.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 40d42ef7055137ee8f49cfa5a700831ac862fce1 Mon Sep 17 00:00:00 2001 -From: utzcoz -Date: Sat, 26 Sep 2020 16:52:02 +0800 -Subject: [PATCH 24/25] Notify task moved to front event when focused task - changed - -Signed-off-by: utzcoz ---- - .../core/java/com/android/server/wm/ActivityRecord.java | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java -index 55e8e19fd278..9ced647a2979 100644 ---- a/services/core/java/com/android/server/wm/ActivityRecord.java -+++ b/services/core/java/com/android/server/wm/ActivityRecord.java -@@ -1527,6 +1527,12 @@ final class ActivityRecord extends ConfigurationContainer { - } - - stack.moveToFront(reason, task); -+ // region @boringdroid -+ // We should notify task moved to front event if we change focused task -+ if (task != null) { -+ mAtmService.getTaskChangeNotificationController().notifyTaskMovedToFront(task.getTaskInfo()); -+ } -+ // endregion - // Report top activity change to tracking services and WM - if (mRootActivityContainer.getTopResumedActivity() == this) { - // TODO(b/111361570): Support multiple focused apps in WM --- -2.25.1 - diff --git a/base-patches/frameworks/base/0025-Reload-BoringdroidSystemUI-after-display-theme-and-t.patch b/base-patches/frameworks/base/0025-Reload-BoringdroidSystemUI-after-display-theme-and-t.patch deleted file mode 100644 index 3a4059e..0000000 --- a/base-patches/frameworks/base/0025-Reload-BoringdroidSystemUI-after-display-theme-and-t.patch +++ /dev/null @@ -1,119 +0,0 @@ -From aecc7bb68e9ea29d8c19c82f93cdd855abb5af26 Mon Sep 17 00:00:00 2001 -From: utzcoz -Date: Sat, 26 Dec 2020 15:39:04 +0800 -Subject: [PATCH 25/25] Reload BoringdroidSystemUI after display theme and - tuner changed - -Signed-off-by: utzcoz -Change-Id: Idf6d9965012bb6453ddb96cc0c5d3ff2fe90dbce - -Conflicts: - packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java ---- - .../fragments/FragmentHostManager.java | 13 ++++++++++++ - .../phone/NavigationBarInflaterView.java | 21 +++++++++++++++++++ - 2 files changed, 34 insertions(+) - -diff --git a/packages/SystemUI/src/com/android/systemui/fragments/FragmentHostManager.java b/packages/SystemUI/src/com/android/systemui/fragments/FragmentHostManager.java -index 87d90adceba5..708a123cd699 100644 ---- a/packages/SystemUI/src/com/android/systemui/fragments/FragmentHostManager.java -+++ b/packages/SystemUI/src/com/android/systemui/fragments/FragmentHostManager.java -@@ -22,8 +22,10 @@ import android.app.FragmentManager; - import android.app.FragmentManager.FragmentLifecycleCallbacks; - import android.app.FragmentManagerNonConfig; - import android.content.Context; -+import android.content.Intent; - import android.content.pm.ActivityInfo; - import android.content.res.Configuration; -+import android.net.Uri; - import android.os.Bundle; - import android.os.Handler; - import android.os.Looper; -@@ -34,9 +36,11 @@ import android.view.View; - - import androidx.annotation.NonNull; - -+import com.android.internal.BoringdroidManager; - import com.android.settingslib.applications.InterestingConfigChanges; - import com.android.systemui.Dependency; - import com.android.systemui.plugins.Plugin; -+import com.android.systemui.shared.plugins.PluginManagerImpl; - import com.android.systemui.util.leak.LeakDetector; - - import java.io.FileDescriptor; -@@ -157,6 +161,15 @@ public class FragmentHostManager { - protected void onConfigurationChanged(Configuration newConfig) { - if (mConfigChanges.applyNewConfig(mContext.getResources())) { - reloadFragments(); -+ // region @boringdroid -+ if (BoringdroidManager.IS_SYSTEMUI_PLUGIN_ENABLED) { -+ Intent intent = new Intent( -+ PluginManagerImpl.PLUGIN_CHANGED, -+ Uri.fromParts("package", "com.boringdroid.systemui", null) -+ ); -+ mContext.sendBroadcast(intent); -+ } -+ // endregion - } else { - mFragments.dispatchConfigurationChanged(newConfig); - } -diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java -index 2b57d4348a43..53fb35925ba0 100644 ---- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java -+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java -@@ -22,10 +22,12 @@ import android.annotation.Nullable; - import android.app.ActivityManager; - import android.content.Context; - import android.content.om.IOverlayManager; -+import android.content.Intent; - import android.content.res.Configuration; - import android.graphics.drawable.Icon; - import android.os.RemoteException; - import android.os.ServiceManager; -+import android.net.Uri; - import android.util.AttributeSet; - import android.util.Log; - import android.util.SparseArray; -@@ -42,6 +44,7 @@ import com.android.internal.BoringdroidManager; - import com.android.systemui.Dependency; - import com.android.systemui.R; - import com.android.systemui.recents.OverviewProxyService; -+import com.android.systemui.shared.plugins.PluginManagerImpl; - import com.android.systemui.shared.system.QuickStepContract; - import com.android.systemui.statusbar.phone.ReverseLinearLayout.ReverseRelativeLayout; - import com.android.systemui.statusbar.policy.KeyButtonView; -@@ -213,6 +216,15 @@ public class NavigationBarInflaterView extends FrameLayout - mUsingCustomLayout = layoutValue != null; - clearViews(); - inflateLayout(layoutValue); -+ // region @boringdroid -+ if (BoringdroidManager.IS_SYSTEMUI_PLUGIN_ENABLED) { -+ Intent intent = new Intent( -+ PluginManagerImpl.PLUGIN_CHANGED, -+ Uri.fromParts("package", "com.boringdroid.systemui", null) -+ ); -+ getContext().sendBroadcast(intent); -+ } -+ // endregion - } - } - -@@ -225,6 +237,15 @@ public class NavigationBarInflaterView extends FrameLayout - if (!Objects.equals(mCurrentLayout, newValue)) { - clearViews(); - inflateLayout(newValue); -+ // region @boringdroid -+ if (BoringdroidManager.IS_SYSTEMUI_PLUGIN_ENABLED) { -+ Intent intent = new Intent( -+ PluginManagerImpl.PLUGIN_CHANGED, -+ Uri.fromParts("package", "com.boringdroid.systemui", null) -+ ); -+ getContext().sendBroadcast(intent); -+ } -+ // endregion - } - } - --- -2.25.1 - diff --git a/manifest_scripts/manifests/03-vendor-addons.xml b/manifest_scripts/manifests/03-vendor-addons.xml index f1cc6a2..47b4925 100644 --- a/manifest_scripts/manifests/03-vendor-addons.xml +++ b/manifest_scripts/manifests/03-vendor-addons.xml @@ -5,7 +5,7 @@ - - + +