Allow wallpaper to be configured to have top app

Bug: 272527880
Test: adb shell dumpsys activity processes -> Wallpapers get top-app
schedule group when flag is enabled

Change-Id: I0e93c04f2e186c8805edbf9f5730f13133cb1040
This commit is contained in:
Paul Daniel Faria
2023-07-12 20:00:25 +00:00
parent f4517f851a
commit e430513cd3
3 changed files with 13 additions and 3 deletions

View File

@@ -4125,6 +4125,10 @@
-->
<string name="config_wallpaperCropperPackage" translatable="false">com.android.wallpapercropper</string>
<!-- Wallpaper will get top app scheduling priority if this is set to true.
-->
<bool name="config_wallpaperTopApp">false</bool>
<!-- True if the device supports at least one form of multi-window.
E.g. freeform, split-screen, picture-in-picture. -->
<bool name="config_supportsMultiWindow">true</bool>

View File

@@ -3247,6 +3247,7 @@
<!-- WallpaperManager config -->
<java-symbol type="string" name="config_wallpaperCropperPackage" />
<java-symbol type="string" name="expand_action_accessibility" />
<java-symbol type="bool" name="config_wallpaperTopApp" />
<java-symbol type="id" name="textSpacerNoTitle" />
<java-symbol type="id" name="titleDividerNoCustom" />

View File

@@ -3629,10 +3629,15 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
intent.putExtra(Intent.EXTRA_CLIENT_LABEL,
com.android.internal.R.string.wallpaper_binding_label);
intent.putExtra(Intent.EXTRA_CLIENT_INTENT, clientIntent);
boolean bindSuccess = mContext.bindServiceAsUser(intent, newConn,
Context.BIND_AUTO_CREATE | Context.BIND_SHOWING_UI
int bindFlags = Context.BIND_AUTO_CREATE | Context.BIND_SHOWING_UI
| Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE
| Context.BIND_INCLUDE_CAPABILITIES,
| Context.BIND_INCLUDE_CAPABILITIES;
if (mContext.getResources().getBoolean(
com.android.internal.R.bool.config_wallpaperTopApp)) {
bindFlags |= Context.BIND_SCHEDULE_LIKE_TOP_APP;
}
boolean bindSuccess = mContext.bindServiceAsUser(intent, newConn, bindFlags,
new UserHandle(serviceUserId));
if (!bindSuccess) {
String msg = "Unable to bind service: " + componentName;