Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 398b143c authored by Steven Ng's avatar Steven Ng
Browse files

Set fallback wallpaper component to sysui GradientColorWallpaper

Also:
1. add metadata to SysUI GradientColorWallpaper
2. fix some misuse of assertWithMessage(...).that(...) in WallpaperManagerServiceTests.

Test: atests FrameworksMockingServicesTests:WallpaperManagerServiceTests
Flag: android.app.enable_connected_displays_wallpaper
Bug: 384520326
Change-Id: I78e656f79f14348ba3a025f629a7d3620b9fceda
parent 9272943b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2009,6 +2009,10 @@
    <!-- Component name of the built in wallpaper used to display bitmap wallpapers. This must not be null. -->
    <string name="image_wallpaper_component" translatable="false">com.android.systemui/com.android.systemui.wallpapers.ImageWallpaper</string>

    <!-- Component name of the built in wallpaper that is used when the user-selected wallpaper is
         incompatible with the display's resolution or aspect ratio. -->
    <string name="fallback_wallpaper_component" translatable="false">com.android.systemui/com.android.systemui.wallpapers.GradientColorWallpaper</string>

    <!-- True if WallpaperService is enabled -->
    <bool name="config_enableWallpaperService">true</bool>

+1 −0
Original line number Diff line number Diff line
@@ -2268,6 +2268,7 @@
  <java-symbol type="string" name="heavy_weight_notification" />
  <java-symbol type="string" name="heavy_weight_notification_detail" />
  <java-symbol type="string" name="image_wallpaper_component" />
  <java-symbol type="string" name="fallback_wallpaper_component" />
  <java-symbol type="string" name="input_method_binding_label" />
  <java-symbol type="string" name="input_method_ime_switch_long_click_action_desc" />
  <java-symbol type="string" name="launch_warning_original" />
+5 −1
Original line number Diff line number Diff line
@@ -550,7 +550,11 @@
        <service android:name=".wallpapers.GradientColorWallpaper"
            android:singleUser="true"
            android:permission="android.permission.BIND_WALLPAPER"
            android:exported="true" />
            android:exported="true">
            <meta-data android:name="android.service.wallpaper"
                android:resource="@xml/gradient_color_wallpaper">
            </meta-data>
        </service>

        <activity android:name=".tuner.TunerActivity"
                  android:enabled="false"
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (C) 2025 The Android Open Source 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
  -->
<wallpaper
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:showMetadataInPreview="false"
    android:supportsMultipleDisplays="true" />
 No newline at end of file
+27 −2
Original line number Diff line number Diff line
@@ -771,6 +771,12 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
     */
    private final ComponentName mImageWallpaper;

    /**
     * Name of the component that is used when the user-selected wallpaper is incompatible with the
     * display's resolution or aspect ratio.
     */
    @Nullable private final ComponentName mFallbackWallpaperComponent;

    /**
     * Default image wallpaper shall never changed after system service started, caching it when we
     * first read the image file.
@@ -1601,6 +1607,12 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
        mShuttingDown = false;
        mImageWallpaper = ComponentName.unflattenFromString(
                context.getResources().getString(R.string.image_wallpaper_component));
        if (enableConnectedDisplaysWallpaper()) {
            mFallbackWallpaperComponent = ComponentName.unflattenFromString(
                    context.getResources().getString(R.string.fallback_wallpaper_component));
        } else {
            mFallbackWallpaperComponent = null;
        }
        ComponentName defaultComponent = WallpaperManager.getCmfDefaultWallpaperComponent(context);
        mDefaultWallpaperComponent = defaultComponent == null ? mImageWallpaper : defaultComponent;
        mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
@@ -3613,6 +3625,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
            if (componentName != null && !componentName.equals(mImageWallpaper)) {
                // The requested component is not the static wallpaper service, so make sure it's
                // actually a wallpaper service.
                if (mFallbackWallpaperComponent != null
                        && componentName.equals(mFallbackWallpaperComponent)) {
                    // The fallback wallpaper does not declare WallpaperService.SERVICE_INTERFACE
                    // action in its intent filter to prevent it from being listed in the wallpaper
                    // picker. And thus, use explicit intent to query the metadata.
                    intent = new Intent().setComponent(mFallbackWallpaperComponent);
                }
                List<ResolveInfo> ris =
                        mIPackageManager.queryIntentServices(intent,
                                intent.resolveTypeIfNeeded(mContext.getContentResolver()),
@@ -4100,8 +4119,14 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
            mFallbackWallpaper.allowBackup = false;
            mFallbackWallpaper.wallpaperId = makeWallpaperIdLocked();
            mFallbackWallpaper.mBindSource = BindSource.INITIALIZE_FALLBACK;
            if (mFallbackWallpaperComponent == null) {
                bindWallpaperComponentLocked(mDefaultWallpaperComponent, true, false,
                        mFallbackWallpaper, null);
            } else {
                mFallbackWallpaper.mWhich = FLAG_SYSTEM | FLAG_LOCK;
                bindWallpaperComponentLocked(mFallbackWallpaperComponent, true, false,
                        mFallbackWallpaper, null);
            }
        }
    }

Loading