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

Commit 8839020e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clean up mockito references"

parents d27964df b6c83748
Loading
Loading
Loading
Loading
+11 −14
Original line number Diff line number Diff line
@@ -457,7 +457,7 @@ public class NotificationManagerService extends SystemService {
    private static final int MY_UID = Process.myUid();
    private static final int MY_PID = Process.myPid();
    private static final IBinder WHITELIST_TOKEN = new Binder();
    private RankingHandler mRankingHandler;
    protected RankingHandler mRankingHandler;
    private long mLastOverRateLogTime;
    private float mMaxPackageEnqueueRate = DEFAULT_MAX_NOTIFICATION_ENQUEUE_RATE;

@@ -1550,11 +1550,13 @@ public class NotificationManagerService extends SystemService {

    @VisibleForTesting
    void clearNotifications() {
        synchronized (mNotificationList) {
            mEnqueuedNotifications.clear();
            mNotificationList.clear();
            mNotificationsByKey.clear();
            mSummaryByGroupKey.clear();
        }
    }

    @VisibleForTesting
    void addNotification(NotificationRecord r) {
@@ -1604,11 +1606,6 @@ public class NotificationManagerService extends SystemService {
    @VisibleForTesting
    void setPreferencesHelper(PreferencesHelper prefHelper) { mPreferencesHelper = prefHelper; }

    @VisibleForTesting
    void setRankingHandler(RankingHandler rankingHandler) {
        mRankingHandler = rankingHandler;
    }

    @VisibleForTesting
    void setZenHelper(ZenModeHelper zenHelper) {
        mZenModeHelper = zenHelper;
@@ -1641,7 +1638,7 @@ public class NotificationManagerService extends SystemService {

    // TODO: All tests should use this init instead of the one-off setters above.
    @VisibleForTesting
    void init(Looper looper, IPackageManager packageManager,
    void init(Looper looper, RankingHandler rankingHandler, IPackageManager packageManager,
            PackageManager packageManagerClient,
            LightsManager lightsManager, NotificationListeners notificationListeners,
            NotificationAssistants notificationAssistants, ConditionProviders conditionProviders,
@@ -1675,7 +1672,6 @@ public class NotificationManagerService extends SystemService {
        mUm = userManager;

        mHandler = new WorkerHandler(looper);
        mRankingThread.start();
        String[] extractorNames;
        try {
            extractorNames = resources.getStringArray(R.array.config_notificationSignalExtractors);
@@ -1684,7 +1680,7 @@ public class NotificationManagerService extends SystemService {
        }
        mUsageStats = usageStats;
        mMetricsLogger = new MetricsLogger();
        mRankingHandler = new RankingHandlerWorker(mRankingThread.getLooper());
        mRankingHandler = rankingHandler;
        mConditionProviders = conditionProviders;
        mZenModeHelper = new ZenModeHelper(getContext(), mHandler.getLooper(), mConditionProviders);
        mZenModeHelper.addCallback(new ZenModeHelper.Callback() {
@@ -1829,8 +1825,9 @@ public class NotificationManagerService extends SystemService {
        }, mUserProfiles);

        final File systemDir = new File(Environment.getDataDirectory(), "system");
        mRankingThread.start();

        init(Looper.myLooper(),
        init(Looper.myLooper(), new RankingHandlerWorker(mRankingThread.getLooper()),
                AppGlobals.getPackageManager(), getContext().getPackageManager(),
                getLocalService(LightsManager.class),
                new NotificationListeners(AppGlobals.getPackageManager()),
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.OBSERVE_ROLE_HOLDERS" />
    <uses-permission android:name="android.permission.GET_INTENT_SENDER_INTENT"/>
    <uses-permission android:name="android.permission.WRITE_DEVICE_CONFIG" />

    <application android:debuggable="true">
        <uses-library android:name="android.test.runner" />
+7 −0
Original line number Diff line number Diff line
@@ -27,9 +27,11 @@ import androidx.test.InstrumentationRegistry;

import com.android.server.uri.UriGrantsManagerInternal;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

public class UiServiceTestCase {
@@ -77,4 +79,9 @@ public class UiServiceTestCase {
        when(mUgmInternal.checkGrantUriPermission(
                anyInt(), anyString(), any(Uri.class), anyInt(), anyInt())).thenReturn(-1);
    }

    @After
    public final void cleanUpMockito() {
        Mockito.framework().clearInlineMocks();
    }
}
+169 −123

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ public class RoleObserverTest extends UiServiceTestCase {
        mRoleObserver = mService.new RoleObserver(mRoleManager, mPm, mExecutor);

        try {
            mService.init(mock(Looper.class),
            mService.init(mock(Looper.class), mock(RankingHandler.class),
                    mock(IPackageManager.class), mock(PackageManager.class),
                    mock(LightsManager.class),
                    mock(NotificationListeners.class), mock(NotificationAssistants.class),