Loading services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -2852,8 +2852,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub setWallpaperComponent(name, UserHandle.getCallingUserId(), FLAG_SYSTEM); } private void setWallpaperComponent(ComponentName name, @SetWallpaperFlags int which, int userId) { @VisibleForTesting void setWallpaperComponent(ComponentName name, @SetWallpaperFlags int which, int userId) { userId = ActivityManager.handleIncomingUser(getCallingPid(), getCallingUid(), userId, false /* all */, true /* full */, "changing live wallpaper", null /* pkg */); checkPermission(android.Manifest.permission.SET_WALLPAPER_COMPONENT); Loading services/tests/mockingservicestests/src/com/android/server/wallpaper/WallpaperManagerServiceTests.java +6 −5 Original line number Diff line number Diff line Loading @@ -71,7 +71,6 @@ import android.util.SparseArray; import android.util.Xml; import android.view.Display; import androidx.test.filters.FlakyTest; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; Loading @@ -89,6 +88,7 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; Loading @@ -110,7 +110,6 @@ import java.nio.charset.StandardCharsets; * atest FrameworksMockingServicesTests:WallpaperManagerServiceTests */ @Presubmit @FlakyTest(bugId = 129797242) @RunWith(AndroidJUnit4.class) public class WallpaperManagerServiceTests { Loading Loading @@ -273,8 +272,10 @@ public class WallpaperManagerServiceTests { /** * Tests setWallpaperComponent and clearWallpaper should work as expected. * TODO ignored since the assumption never passes. to be investigated. */ @Test @Ignore("b/264533465") public void testSetThenClearComponent() { // Skip if there is no pre-defined default wallpaper component. assumeThat(sDefaultWallpaperComponent, Loading @@ -285,7 +286,7 @@ public class WallpaperManagerServiceTests { verifyLastWallpaperData(testUserId, sDefaultWallpaperComponent); verifyCurrentSystemData(testUserId); mService.setWallpaperComponent(sImageWallpaperComponentName); mService.setWallpaperComponent(sImageWallpaperComponentName, FLAG_SYSTEM, testUserId); verifyLastWallpaperData(testUserId, sImageWallpaperComponentName); verifyCurrentSystemData(testUserId); Loading @@ -312,7 +313,7 @@ public class WallpaperManagerServiceTests { WallpaperManagerService.WallpaperConnection.DisplayConnector connector = mService.mLastWallpaper.connection.getDisplayConnectorOrCreate(DEFAULT_DISPLAY); mService.setWallpaperComponent(sDefaultWallpaperComponent); mService.setWallpaperComponent(sDefaultWallpaperComponent, FLAG_SYSTEM, testUserId); verify(connector.mEngine).dispatchWallpaperCommand( eq(COMMAND_REAPPLY), anyInt(), anyInt(), anyInt(), any()); Loading Loading @@ -454,7 +455,7 @@ public class WallpaperManagerServiceTests { public void testGetAdjustedWallpaperColorsOnDimming() throws RemoteException { final int testUserId = USER_SYSTEM; mService.switchUser(testUserId, null); mService.setWallpaperComponent(sDefaultWallpaperComponent); mService.setWallpaperComponent(sDefaultWallpaperComponent, FLAG_SYSTEM, testUserId); WallpaperData wallpaper = mService.getCurrentWallpaperData(FLAG_SYSTEM, testUserId); // Mock a wallpaper data with color hints that support dark text and dark theme Loading Loading
services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -2852,8 +2852,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub setWallpaperComponent(name, UserHandle.getCallingUserId(), FLAG_SYSTEM); } private void setWallpaperComponent(ComponentName name, @SetWallpaperFlags int which, int userId) { @VisibleForTesting void setWallpaperComponent(ComponentName name, @SetWallpaperFlags int which, int userId) { userId = ActivityManager.handleIncomingUser(getCallingPid(), getCallingUid(), userId, false /* all */, true /* full */, "changing live wallpaper", null /* pkg */); checkPermission(android.Manifest.permission.SET_WALLPAPER_COMPONENT); Loading
services/tests/mockingservicestests/src/com/android/server/wallpaper/WallpaperManagerServiceTests.java +6 −5 Original line number Diff line number Diff line Loading @@ -71,7 +71,6 @@ import android.util.SparseArray; import android.util.Xml; import android.view.Display; import androidx.test.filters.FlakyTest; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; Loading @@ -89,6 +88,7 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; Loading @@ -110,7 +110,6 @@ import java.nio.charset.StandardCharsets; * atest FrameworksMockingServicesTests:WallpaperManagerServiceTests */ @Presubmit @FlakyTest(bugId = 129797242) @RunWith(AndroidJUnit4.class) public class WallpaperManagerServiceTests { Loading Loading @@ -273,8 +272,10 @@ public class WallpaperManagerServiceTests { /** * Tests setWallpaperComponent and clearWallpaper should work as expected. * TODO ignored since the assumption never passes. to be investigated. */ @Test @Ignore("b/264533465") public void testSetThenClearComponent() { // Skip if there is no pre-defined default wallpaper component. assumeThat(sDefaultWallpaperComponent, Loading @@ -285,7 +286,7 @@ public class WallpaperManagerServiceTests { verifyLastWallpaperData(testUserId, sDefaultWallpaperComponent); verifyCurrentSystemData(testUserId); mService.setWallpaperComponent(sImageWallpaperComponentName); mService.setWallpaperComponent(sImageWallpaperComponentName, FLAG_SYSTEM, testUserId); verifyLastWallpaperData(testUserId, sImageWallpaperComponentName); verifyCurrentSystemData(testUserId); Loading @@ -312,7 +313,7 @@ public class WallpaperManagerServiceTests { WallpaperManagerService.WallpaperConnection.DisplayConnector connector = mService.mLastWallpaper.connection.getDisplayConnectorOrCreate(DEFAULT_DISPLAY); mService.setWallpaperComponent(sDefaultWallpaperComponent); mService.setWallpaperComponent(sDefaultWallpaperComponent, FLAG_SYSTEM, testUserId); verify(connector.mEngine).dispatchWallpaperCommand( eq(COMMAND_REAPPLY), anyInt(), anyInt(), anyInt(), any()); Loading Loading @@ -454,7 +455,7 @@ public class WallpaperManagerServiceTests { public void testGetAdjustedWallpaperColorsOnDimming() throws RemoteException { final int testUserId = USER_SYSTEM; mService.switchUser(testUserId, null); mService.setWallpaperComponent(sDefaultWallpaperComponent); mService.setWallpaperComponent(sDefaultWallpaperComponent, FLAG_SYSTEM, testUserId); WallpaperData wallpaper = mService.getCurrentWallpaperData(FLAG_SYSTEM, testUserId); // Mock a wallpaper data with color hints that support dark text and dark theme Loading