1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.systemui.statusbar.policy 18 19 import android.app.IActivityManager 20 import android.content.pm.PackageManager 21 import android.media.projection.MediaProjectionManager 22 import android.os.Handler 23 import android.platform.test.annotations.DisableFlags 24 import android.telephony.TelephonyManager 25 import androidx.test.ext.junit.runners.AndroidJUnit4 26 import androidx.test.filters.SmallTest 27 import com.android.server.notification.Flags 28 import com.android.systemui.SysuiTestCase 29 import com.android.systemui.log.logcatLogBuffer 30 import com.android.systemui.util.concurrency.FakeExecutor 31 import com.android.systemui.util.settings.FakeGlobalSettings 32 import com.android.systemui.util.time.FakeSystemClock 33 import org.junit.Before 34 import org.junit.Test 35 import org.junit.runner.RunWith 36 import org.mockito.Mock 37 import org.mockito.Mockito.verifyZeroInteractions 38 import org.mockito.MockitoAnnotations 39 40 @SmallTest 41 @RunWith(AndroidJUnit4::class) 42 @DisableFlags(Flags.FLAG_SCREENSHARE_NOTIFICATION_HIDING) 43 class SensitiveNotificationProtectionControllerFlagDisabledTest : SysuiTestCase() { 44 private val logger = SensitiveNotificationProtectionControllerLogger(logcatLogBuffer()) 45 46 @Mock private lateinit var handler: Handler 47 @Mock private lateinit var activityManager: IActivityManager 48 @Mock private lateinit var mediaProjectionManager: MediaProjectionManager 49 @Mock private lateinit var packageManager: PackageManager 50 @Mock private lateinit var telephonyManager: TelephonyManager 51 private lateinit var controller: SensitiveNotificationProtectionControllerImpl 52 53 @Before setUpnull54 fun setUp() { 55 MockitoAnnotations.initMocks(this) 56 57 controller = 58 SensitiveNotificationProtectionControllerImpl( 59 mContext, 60 FakeGlobalSettings(), 61 mediaProjectionManager, 62 activityManager, 63 packageManager, 64 telephonyManager, 65 handler, 66 FakeExecutor(FakeSystemClock()), 67 logger 68 ) 69 } 70 71 @Test init_noRegisterMediaProjectionManagerCallbacknull72 fun init_noRegisterMediaProjectionManagerCallback() { 73 verifyZeroInteractions(mediaProjectionManager) 74 } 75 } 76