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

Commit 3751be0f authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing obsolete shadows

Change-Id: I9dcaa69e4e86130642be15e3585f5898dd866839
parent 2f4654ee
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
sdk=29
shadows= \
    com.android.launcher3.shadows.LShadowApplicationPackageManager \
    com.android.launcher3.shadows.LShadowAppPredictionManager \
    com.android.launcher3.shadows.LShadowAppWidgetManager \
    com.android.launcher3.shadows.LShadowBackupManager \
    com.android.launcher3.shadows.LShadowBitmap \
    com.android.launcher3.shadows.LShadowDisplay \
    com.android.launcher3.shadows.LShadowLauncherApps \
    com.android.launcher3.shadows.LShadowTypeface \
    com.android.launcher3.shadows.LShadowUserManager \
    com.android.launcher3.shadows.LShadowWallpaperManager \
    com.android.launcher3.shadows.ShadowDeviceFlag \
    com.android.launcher3.shadows.ShadowLooperExecutor \
    com.android.launcher3.shadows.ShadowMainThreadInitializedObject \
+2 −2
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import android.os.UserManager;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.provider.RestoreDbTask;
import com.android.launcher3.shadows.LShadowBackupManager;
import com.android.launcher3.shadows.LShadowUserManager;
import com.android.launcher3.util.LauncherModelHelper;

import org.junit.Before;
@@ -51,6 +50,7 @@ import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.LooperMode;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.shadows.ShadowUserManager;

/**
 * Tests to verify backup and restore flow.
@@ -68,7 +68,7 @@ public class BackupRestoreTest {
    private static final int FLAG_SYSTEM = 0x00000800;
    private static final int FLAG_PROFILE = 0x00001000;

    private LShadowUserManager mUserManager;
    private ShadowUserManager mUserManager;
    private BackupManager mBackupManager;
    private LauncherModelHelper mModelHelper;
    private SQLiteDatabase mDb;
+0 −36
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.
 */

package com.android.launcher3.shadows;

import android.os.Process;
import android.os.UserHandle;

import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.shadows.ShadowApplicationPackageManager;

/**
 * Shadow for {@link ShadowApplicationPackageManager} which create mock predictors
 */
@Implements(className = "android.app.ApplicationPackageManager")
public class LShadowApplicationPackageManager extends ShadowApplicationPackageManager {

    @Implementation
    public CharSequence getUserBadgedLabel(CharSequence label, UserHandle user) {
        return Process.myUserHandle().equals(user) ? label : "Work " + label;
    }
}
+0 −36
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.
 */

package com.android.launcher3.shadows;

import android.graphics.Bitmap;
import android.graphics.Paint;

import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.shadows.ShadowBitmap;

/**
 * Extension of {@link ShadowBitmap} with missing shadow methods
 */
@Implements(value = Bitmap.class)
public class LShadowBitmap extends ShadowBitmap {

    @Implementation
    protected Bitmap extractAlpha(Paint paint, int[] offsetXY) {
        return extractAlpha();
    }
}
+0 −38
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.
 */
package com.android.launcher3.shadows;

import android.graphics.Typeface;

import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.shadows.ShadowTypeface;

/**
 * Extension of {@link ShadowTypeface} with missing shadow methods
 */
@Implements(Typeface.class)
public class LShadowTypeface extends ShadowTypeface {

    @Implementation
    public static Typeface create(Typeface family, int weight, boolean italic) {
        int style = italic ? Typeface.ITALIC : Typeface.NORMAL;
        if (weight >= 400) {
            style |= Typeface.BOLD;
        }
        return create(family, style);
    }
}
Loading