Fix B&R for multi crop
The method findNewCropFromOldCrop was not yet used in the multi-crop case. Use it to adjust every crop. Also modify the method slightly: - Make it work when the target device is wider than source device - Prefer adding content to the crop rather than removing some, even if we need to add more content on one side. In most cases we'd rather break symmetry one one axis than removing content (i.e. zooming) Also, drop the LANDSCAPE crop hint in restore unless the new device has a large screen (min width > 600 dpi). We don't really care about the landscape crop except for tablet devices, and keeping it can lead to difficult to explain behaviours (e.g. it may affect wallpaper position on connected displays). Refactor the logic a bit to mock the display and bitmap sizes to make the crop logic easily testable (Display and DisplayManager are final). Then, add a couple test cases. There are way too many possible B&R combinations; so pick 15 that are realistic and cover more or less all the logic. These tests expect exact matches but are well commented. Flag: android.app.fix_wallpaper_crops_on_restore Test: manual Test: atest WallpaperBackupAgentTest Bug: 332937943 Change-Id: I224e52d4804ff7cba993e7ceeb4c9af38c0192e0
Loading
Please register or sign in to comment