feat: Add option to clear home screen in settings (#6125)

Signed-off-by: abhixv <abhi.sharma1@hotmail.com>
This commit is contained in:
Abhishek Sharma
2025-12-20 03:26:30 +05:30
committed by Pun Butrach
parent 9898749619
commit 5f3a03f4fb
1577 changed files with 112563 additions and 80248 deletions

View File

@@ -15,12 +15,15 @@
*/
package com.android.launcher3.widget;
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import android.appwidget.AppWidgetHostView;
import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
@@ -29,14 +32,16 @@ import androidx.test.filters.SmallTest;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.util.SandboxApplication;
import com.android.launcher3.LauncherAppState;
import org.junit.Rule;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@SmallTest
@RunWith(AndroidJUnit4.class)
@@ -47,7 +52,12 @@ public final class LauncherAppWidgetProviderInfoTest {
private static final int NUM_OF_COLS = 4;
private static final int NUM_OF_ROWS = 5;
@Rule public SandboxApplication mContext = new SandboxApplication();
private Context mContext;
@Before
public void setUp() {
mContext = getApplicationContext();
}
@Test
public void initSpans_minWidthSmallerThanCellWidth_shouldInitializeSpansToOne() {
@@ -246,9 +256,8 @@ public final class LauncherAppWidgetProviderInfoTest {
}
private InvariantDeviceProfile createIDP() {
InvariantDeviceProfile idp = InvariantDeviceProfile.INSTANCE.get(mContext);
DeviceProfile dp = idp.getDeviceProfile(mContext).copy(mContext);
DeviceProfile dp = LauncherAppState.getIDP(mContext)
.getDeviceProfile(mContext).copy(mContext);
DeviceProfile profile = Mockito.spy(dp);
doAnswer(i -> {
((Point) i.getArgument(0)).set(CELL_SIZE, CELL_SIZE);
@@ -258,7 +267,10 @@ public final class LauncherAppWidgetProviderInfoTest {
profile.cellLayoutBorderSpacePx = new Point(SPACE_SIZE, SPACE_SIZE);
profile.widgetPadding.setEmpty();
idp.supportedProfiles = Collections.singletonList(profile);
InvariantDeviceProfile idp = new InvariantDeviceProfile();
List<DeviceProfile> supportedProfiles = new ArrayList<>(idp.supportedProfiles);
supportedProfiles.add(profile);
idp.supportedProfiles = Collections.unmodifiableList(supportedProfiles);
idp.numColumns = NUM_OF_COLS;
idp.numRows = NUM_OF_ROWS;
return idp;