Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt +21 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,18 @@ import javax.inject.Singleton const val TAG = "ChannelDialogController" /** * ChannelEditorDialogController is the controller for the dialog half-shelf * that allows users to quickly turn off channels. It is launched from the NotificationInfo * guts view and displays controls for toggling app notifications as well as up to 4 channels * from that app like so: * * APP TOGGLE <on/off> * - Channel from which we launched <on/off> * - <on/off> * - the next 3 channels sorted alphabetically for that app <on/off> * - <on/off> */ @Singleton class ChannelEditorDialogController @Inject constructor( c: Context, Loading @@ -58,6 +70,9 @@ class ChannelEditorDialogController @Inject constructor( private var appName: String? = null private var onSettingsClickListener: NotificationInfo.OnSettingsClickListener? = null // Caller should set this if they care about when we dismiss var onFinishListener: OnChannelEditorDialogFinishedListener? = null // Channels handed to us from NotificationInfo @VisibleForTesting internal val providedChannels = mutableListOf<NotificationChannel>() Loading Loading @@ -144,6 +159,7 @@ class ChannelEditorDialogController @Inject constructor( private fun done() { resetState() dialog.dismiss() onFinishListener?.onChannelEditorDialogFinished() } private fun resetState() { Loading Loading @@ -242,7 +258,7 @@ class ChannelEditorDialogController @Inject constructor( findViewById<TextView>(R.id.see_more_button)?.setOnClickListener { onSettingsClickListener?.onClick(it, null, appUid!!) dismiss() done() } window?.apply { Loading @@ -267,3 +283,7 @@ class ChannelEditorDialogController @Inject constructor( or WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH or WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) } interface OnChannelEditorDialogFinishedListener { fun onChannelEditorDialogFinished() } packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java +6 −4 Original line number Diff line number Diff line Loading @@ -159,13 +159,13 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G // used by standard ui private OnClickListener mOnDismissSettings = v -> { mPressedApply = true; closeControls(v); closeControls(v, true); }; // used by blocking helper private OnClickListener mOnKeepShowing = v -> { mExitReason = NotificationCounters.BLOCKING_HELPER_KEEP_SHOWING; closeControls(v); closeControls(v, true); mMetricsLogger.write(getLogMaker().setCategory( MetricsEvent.NOTIFICATION_BLOCKING_HELPER) .setType(MetricsEvent.TYPE_ACTION) Loading Loading @@ -445,6 +445,8 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G if (mChannelEditorDialogController != null) { mChannelEditorDialogController.prepareDialogForApp(mAppName, mPackageName, mAppUid, mUniqueChannelsInRow, mPkgIcon, mOnSettingsClickListener); mChannelEditorDialogController.setOnFinishListener( () -> closeControls(this, false)); mChannelEditorDialogController.show(); } }); Loading Loading @@ -725,7 +727,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G * {@link #swapContent(boolean, boolean)} for where undo is handled. */ @VisibleForTesting void closeControls(View v) { void closeControls(View v, boolean save) { int[] parentLoc = new int[2]; int[] targetLoc = new int[2]; mGutsContainer.getLocationOnScreen(parentLoc); Loading @@ -734,7 +736,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G final int centerY = v.getHeight() / 2; final int x = targetLoc[0] - parentLoc[0] + centerX; final int y = targetLoc[1] - parentLoc[1] + centerY; mGutsContainer.closeControls(x, y, true /* save */, false /* force */); mGutsContainer.closeControls(x, y, save, false /* force */); } @Override Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -646,7 +646,7 @@ public class NotificationInfoTest extends SysuiTestCase { doCallRealMethod().when(guts).closeControls(anyInt(), anyInt(), anyBoolean(), anyBoolean()); mNotificationInfo.setGutsParent(guts); mNotificationInfo.closeControls(mNotificationInfo); mNotificationInfo.closeControls(mNotificationInfo, true); verify(mBlockingHelperManager).dismissCurrentBlockingHelper(); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt +21 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,18 @@ import javax.inject.Singleton const val TAG = "ChannelDialogController" /** * ChannelEditorDialogController is the controller for the dialog half-shelf * that allows users to quickly turn off channels. It is launched from the NotificationInfo * guts view and displays controls for toggling app notifications as well as up to 4 channels * from that app like so: * * APP TOGGLE <on/off> * - Channel from which we launched <on/off> * - <on/off> * - the next 3 channels sorted alphabetically for that app <on/off> * - <on/off> */ @Singleton class ChannelEditorDialogController @Inject constructor( c: Context, Loading @@ -58,6 +70,9 @@ class ChannelEditorDialogController @Inject constructor( private var appName: String? = null private var onSettingsClickListener: NotificationInfo.OnSettingsClickListener? = null // Caller should set this if they care about when we dismiss var onFinishListener: OnChannelEditorDialogFinishedListener? = null // Channels handed to us from NotificationInfo @VisibleForTesting internal val providedChannels = mutableListOf<NotificationChannel>() Loading Loading @@ -144,6 +159,7 @@ class ChannelEditorDialogController @Inject constructor( private fun done() { resetState() dialog.dismiss() onFinishListener?.onChannelEditorDialogFinished() } private fun resetState() { Loading Loading @@ -242,7 +258,7 @@ class ChannelEditorDialogController @Inject constructor( findViewById<TextView>(R.id.see_more_button)?.setOnClickListener { onSettingsClickListener?.onClick(it, null, appUid!!) dismiss() done() } window?.apply { Loading @@ -267,3 +283,7 @@ class ChannelEditorDialogController @Inject constructor( or WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH or WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) } interface OnChannelEditorDialogFinishedListener { fun onChannelEditorDialogFinished() }
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java +6 −4 Original line number Diff line number Diff line Loading @@ -159,13 +159,13 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G // used by standard ui private OnClickListener mOnDismissSettings = v -> { mPressedApply = true; closeControls(v); closeControls(v, true); }; // used by blocking helper private OnClickListener mOnKeepShowing = v -> { mExitReason = NotificationCounters.BLOCKING_HELPER_KEEP_SHOWING; closeControls(v); closeControls(v, true); mMetricsLogger.write(getLogMaker().setCategory( MetricsEvent.NOTIFICATION_BLOCKING_HELPER) .setType(MetricsEvent.TYPE_ACTION) Loading Loading @@ -445,6 +445,8 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G if (mChannelEditorDialogController != null) { mChannelEditorDialogController.prepareDialogForApp(mAppName, mPackageName, mAppUid, mUniqueChannelsInRow, mPkgIcon, mOnSettingsClickListener); mChannelEditorDialogController.setOnFinishListener( () -> closeControls(this, false)); mChannelEditorDialogController.show(); } }); Loading Loading @@ -725,7 +727,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G * {@link #swapContent(boolean, boolean)} for where undo is handled. */ @VisibleForTesting void closeControls(View v) { void closeControls(View v, boolean save) { int[] parentLoc = new int[2]; int[] targetLoc = new int[2]; mGutsContainer.getLocationOnScreen(parentLoc); Loading @@ -734,7 +736,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G final int centerY = v.getHeight() / 2; final int x = targetLoc[0] - parentLoc[0] + centerX; final int y = targetLoc[1] - parentLoc[1] + centerY; mGutsContainer.closeControls(x, y, true /* save */, false /* force */); mGutsContainer.closeControls(x, y, save, false /* force */); } @Override Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -646,7 +646,7 @@ public class NotificationInfoTest extends SysuiTestCase { doCallRealMethod().when(guts).closeControls(anyInt(), anyInt(), anyBoolean(), anyBoolean()); mNotificationInfo.setGutsParent(guts); mNotificationInfo.closeControls(mNotificationInfo); mNotificationInfo.closeControls(mNotificationInfo, true); verify(mBlockingHelperManager).dismissCurrentBlockingHelper(); } Loading