Loading packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java +2 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,7 @@ public interface StatusBarDependenciesModule { @Provides @SysUISingleton static OngoingCallController provideOngoingCallController( Context context, CommonNotifCollection notifCollection, SystemClock systemClock, ActivityStarter activityStarter, Loading @@ -284,6 +285,7 @@ public interface StatusBarDependenciesModule { : Optional.empty(); OngoingCallController ongoingCallController = new OngoingCallController( context, notifCollection, ongoingCallFlags, systemClock, Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt +6 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.IActivityManager import android.app.IUidObserver import android.app.Notification import android.app.Notification.CallStyle.CALL_TYPE_ONGOING import android.content.Context import android.content.Intent import android.util.Log import android.view.View Loading Loading @@ -52,6 +53,7 @@ import javax.inject.Inject */ @SysUISingleton class OngoingCallController @Inject constructor( private val context: Context, private val notifCollection: CommonNotifCollection, private val ongoingCallFlags: OngoingCallFlags, private val systemClock: SystemClock, Loading Loading @@ -244,7 +246,9 @@ class OngoingCallController @Inject constructor( private fun setUpUidObserver(currentCallNotificationInfo: CallNotificationInfo) { try { isCallAppVisible = isProcessVisibleToUser( iActivityManager.getUidProcessState(currentCallNotificationInfo.uid, null) iActivityManager.getUidProcessState( currentCallNotificationInfo.uid, context.opPackageName ) ) } catch (se: SecurityException) { Log.e(TAG, "Security exception when trying to get process state: $se") Loading Loading @@ -286,7 +290,7 @@ class OngoingCallController @Inject constructor( uidObserver, ActivityManager.UID_OBSERVER_PROCSTATE, ActivityManager.PROCESS_STATE_UNKNOWN, null context.opPackageName ) } catch (se: SecurityException) { Log.e(TAG, "Security exception when trying to register uid observer: $se") Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt +13 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ class OngoingCallControllerTest : SysuiTestCase() { val notificationCollection = mock(CommonNotifCollection::class.java) controller = OngoingCallController( context, notificationCollection, mockOngoingCallFlags, clock, Loading Loading @@ -238,6 +239,18 @@ class OngoingCallControllerTest : SysuiTestCase() { notifCollectionListener.onEntryUpdated(createOngoingCallNotifEntry()) } /** Regression test for b/216248574. */ @Test fun entryUpdated_packageNameProvidedToActivityManager() { notifCollectionListener.onEntryUpdated(createOngoingCallNotifEntry()) val packageNameCaptor = ArgumentCaptor.forClass(String::class.java) verify(mockIActivityManager).registerUidObserver( any(), any(), any(), packageNameCaptor.capture() ) assertThat(packageNameCaptor.value).isNotNull() } /** * If a call notification is never added before #onEntryRemoved is called, then the listener * should never be notified. Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java +2 −0 Original line number Diff line number Diff line Loading @@ -261,6 +261,7 @@ public interface StatusBarDependenciesModule { @Provides @SysUISingleton static OngoingCallController provideOngoingCallController( Context context, CommonNotifCollection notifCollection, SystemClock systemClock, ActivityStarter activityStarter, Loading @@ -284,6 +285,7 @@ public interface StatusBarDependenciesModule { : Optional.empty(); OngoingCallController ongoingCallController = new OngoingCallController( context, notifCollection, ongoingCallFlags, systemClock, Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt +6 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.IActivityManager import android.app.IUidObserver import android.app.Notification import android.app.Notification.CallStyle.CALL_TYPE_ONGOING import android.content.Context import android.content.Intent import android.util.Log import android.view.View Loading Loading @@ -52,6 +53,7 @@ import javax.inject.Inject */ @SysUISingleton class OngoingCallController @Inject constructor( private val context: Context, private val notifCollection: CommonNotifCollection, private val ongoingCallFlags: OngoingCallFlags, private val systemClock: SystemClock, Loading Loading @@ -244,7 +246,9 @@ class OngoingCallController @Inject constructor( private fun setUpUidObserver(currentCallNotificationInfo: CallNotificationInfo) { try { isCallAppVisible = isProcessVisibleToUser( iActivityManager.getUidProcessState(currentCallNotificationInfo.uid, null) iActivityManager.getUidProcessState( currentCallNotificationInfo.uid, context.opPackageName ) ) } catch (se: SecurityException) { Log.e(TAG, "Security exception when trying to get process state: $se") Loading Loading @@ -286,7 +290,7 @@ class OngoingCallController @Inject constructor( uidObserver, ActivityManager.UID_OBSERVER_PROCSTATE, ActivityManager.PROCESS_STATE_UNKNOWN, null context.opPackageName ) } catch (se: SecurityException) { Log.e(TAG, "Security exception when trying to register uid observer: $se") Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallControllerTest.kt +13 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ class OngoingCallControllerTest : SysuiTestCase() { val notificationCollection = mock(CommonNotifCollection::class.java) controller = OngoingCallController( context, notificationCollection, mockOngoingCallFlags, clock, Loading Loading @@ -238,6 +239,18 @@ class OngoingCallControllerTest : SysuiTestCase() { notifCollectionListener.onEntryUpdated(createOngoingCallNotifEntry()) } /** Regression test for b/216248574. */ @Test fun entryUpdated_packageNameProvidedToActivityManager() { notifCollectionListener.onEntryUpdated(createOngoingCallNotifEntry()) val packageNameCaptor = ArgumentCaptor.forClass(String::class.java) verify(mockIActivityManager).registerUidObserver( any(), any(), any(), packageNameCaptor.capture() ) assertThat(packageNameCaptor.value).isNotNull() } /** * If a call notification is never added before #onEntryRemoved is called, then the listener * should never be notified. Loading