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

Commit 4a7a7228 authored by Yuri Lin's avatar Yuri Lin Committed by Android (Google) Code Review
Browse files

Merge "Change bundles & summarization settings to be per-user" into main

parents f51b7209 cbb0f014
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -84,8 +84,9 @@ interface INotificationManager
    boolean isImportanceLocked(String pkg, int uid);

    List<String> getAllowedAssistantAdjustments(String pkg);
    void allowAssistantAdjustment(String adjustmentType);
    void disallowAssistantAdjustment(String adjustmentType);
    List<String> getAllowedAssistantAdjustmentsForUser(int userId);
    void allowAssistantAdjustment(int userId, String adjustmentType);
    void disallowAssistantAdjustment(int userId, String adjustmentType);

    boolean shouldHideSilentStatusIcons(String callingPkg);
    void setHideSilentStatusIcons(boolean hide);
@@ -268,11 +269,11 @@ interface INotificationManager
    void setAdjustmentTypeSupportedState(in INotificationListener token, String key, boolean supported);
    List<String> getUnsupportedAdjustmentTypes();

    int[] getAllowedAdjustmentKeyTypes();
    void setAssistantAdjustmentKeyTypeState(int type, boolean enabled);
    String[] getAdjustmentDeniedPackages(String key);
    boolean isAdjustmentSupportedForPackage(String key, String pkg);
    void setAdjustmentSupportedForPackage(String key, String pkg, boolean enabled);
    int[] getAllowedClassificationTypes();
    void setAssistantClassificationTypeState(int type, boolean enabled);
    String[] getAdjustmentDeniedPackages(int userId, String key);
    boolean isAdjustmentSupportedForPackage(int userId, String key, String pkg);
    void setAdjustmentSupportedForPackage(int userId, String key, String pkg, boolean enabled);

    // TODO: b/389918945 - Remove once nm_binder_perf flags are going to Nextfood.
    void incrementCounter(String metricId);
+11 −3
Original line number Diff line number Diff line
@@ -2236,7 +2236,7 @@ public class NotificationManager {
    public void allowAssistantAdjustment(@NonNull String capability) {
        INotificationManager service = service();
        try {
            service.allowAssistantAdjustment(capability);
            service.allowAssistantAdjustment(mContext.getUserId(), capability);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -2250,7 +2250,7 @@ public class NotificationManager {
    public void disallowAssistantAdjustment(@NonNull String capability) {
        INotificationManager service = service();
        try {
            service.disallowAssistantAdjustment(capability);
            service.disallowAssistantAdjustment(mContext.getUserId(), capability);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -2273,9 +2273,17 @@ public class NotificationManager {
    @TestApi
    @FlaggedApi(android.service.notification.Flags.FLAG_NOTIFICATION_CLASSIFICATION)
    public void setAssistantAdjustmentKeyTypeState(@Adjustment.Types int type, boolean enabled) {
        setAssistantClassificationTypeState(type, enabled);
    }

    /**
     * @hide
     */
    @FlaggedApi(android.service.notification.Flags.FLAG_NOTIFICATION_CLASSIFICATION)
    public void setAssistantClassificationTypeState(@Adjustment.Types int type, boolean enabled) {
        INotificationManager service = service();
        try {
            service.setAssistantAdjustmentKeyTypeState(type, enabled);
            service.setAssistantClassificationTypeState(type, enabled);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+3 −3
Original line number Diff line number Diff line
@@ -195,13 +195,13 @@ class BundledNotificationInfoTest : SysuiTestCase() {
        underTest.handleCloseControls(true, false)
        testableLooper.processAllMessages()
        verify(mockINotificationManager, never())
            .setAdjustmentSupportedForPackage(anyString(), anyString(), anyBoolean())
            .setAdjustmentSupportedForPackage(anyInt(), anyString(), anyString(), anyBoolean())
    }

    @Test
    fun testToggleCallsUpdate() {
        whenever(mockINotificationManager.isAdjustmentSupportedForPackage(
            anyString(), anyString())).thenReturn(true)
            anyInt(), anyString(), anyString())).thenReturn(true)

        bindNotification()

@@ -211,7 +211,7 @@ class BundledNotificationInfoTest : SysuiTestCase() {

        testableLooper.processAllMessages()
        verify(mockINotificationManager)
            .setAdjustmentSupportedForPackage(anyString(), anyString(), eq(false))
            .setAdjustmentSupportedForPackage(anyInt(), anyString(), anyString(), eq(false))
    }

    @Test
+2 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ class BundledNotificationInfo(context: Context?, attrs: AttributeSet?) :
    override fun bindInlineControls() {
        val enabled =
            mINotificationManager.isAdjustmentSupportedForPackage(
                mSbn.normalizedUserId,
                Adjustment.KEY_TYPE,
                mSbn.packageName,
            )
@@ -133,6 +134,7 @@ class BundledNotificationInfo(context: Context?, attrs: AttributeSet?) :
                    mOnUserInteractionCallback.onImportanceChanged(mEntry)
                }
                mINotificationManager.setAdjustmentSupportedForPackage(
                    mSbn.normalizedUserId,
                    Adjustment.KEY_TYPE,
                    mSbn.packageName,
                    toggle.isChecked,
+245 −104

File changed.

Preview size limit exceeded, changes collapsed.

Loading