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

Commit 32d189fb authored by Julia Reynolds's avatar Julia Reynolds Committed by Automerger Merge Worker
Browse files

Add settings for apps that don't use full conversations am: eca1e4d1 am:...

Add settings for apps that don't use full conversations am: eca1e4d1 am: 33e6708f am: 2ae17523 am: 6a87cdcd

Change-Id: Ic01e59c4462f51128cd9b425075087459add3057
parents 463a664f 6a87cdcd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -8385,6 +8385,12 @@
    <!-- [CHAR LIMIT=100] Header for an individual conversation-->
    <string name="conversation_category_title">Conversation</string>
    <!-- [CHAR LIMIT=100] Title for switch that says whether this app can appear in the conversation notification section-->
    <string name="conversation_section_switch_title">Conversation section</string>
    <!-- [CHAR LIMIT=100] Summary for switch that says whether this app can appear in the conversation notification section-->
    <string name="conversation_section_switch_summary">Allow <xliff:g id="app">%1$s</xliff:g> to appear in the conversation section</string>
    <!-- [CHAR LIMIT=NONE] Conversation preference summary, the parent channel this conversation was spawned from (separator) the parent channel group (e.g. an account name)-->
    <string name="notification_conversation_summary" translatable="false">"<xliff:g id="parent_category_name">%1$s</xliff:g> • <xliff:g id="parent_category_group_name">%2$s</xliff:g>"</string>
+17 −9
Original line number Diff line number Diff line
@@ -29,13 +29,6 @@
    <com.android.settings.notification.app.NotificationFooterPreference
        android:key="block_desc" />

    <!--Bubbles -->
    <Preference
        android:key="bubble_pref_link"
        android:title="@string/notification_bubbles_title"
        android:icon="@drawable/ic_create_bubble"
        settings:controller="com.android.settings.notification.app.BubbleSummaryPreferenceController">
    </Preference>

    <!-- Conversations added here -->
    <PreferenceCategory
@@ -43,13 +36,28 @@
        android:key="conversations"
        android:visibility="gone"
        settings:allowDividerAbove="false"
        settings:allowDividerBelow="false" />
        settings:allowDividerBelow="false">
        <com.android.settingslib.RestrictedSwitchPreference
            android:key="invalid_conversation_switch"
            android:title="@string/conversation_section_switch_title" />
        <Preference
            android:key="invalid_conversation_info"/>
    </PreferenceCategory>

    <!--Bubbles -->
    <Preference
        android:key="bubble_pref_link"
        android:title="@string/notification_bubbles_title"
        android:icon="@drawable/ic_create_bubble"
        settings:allowDividerAbove="false"
        settings:controller="com.android.settings.notification.app.BubbleSummaryPreferenceController">
    </Preference>

    <!-- Channels/Channel groups added here -->
    <PreferenceCategory
        android:key="channels"
        android:layout="@layout/empty_view"
        settings:allowDividerAbove="false"
        settings:allowDividerAbove="true"
        settings:allowDividerBelow="false" />

    <!-- Importance toggle -->
+19 −2
Original line number Diff line number Diff line
@@ -268,15 +268,32 @@ public class NotificationBackend {
        }
    }

    public boolean hasSentMessage(String pkg, int uid) {
    public boolean isInInvalidMsgState(String pkg, int uid) {
        try {
            return sINM.hasSentMessage(pkg, uid);
            return sINM.isInInvalidMsgState(pkg, uid);
        } catch (Exception e) {
            Log.w(TAG, "Error calling NoMan", e);
            return false;
        }
    }

    public boolean hasUserDemotedInvalidMsgApp(String pkg, int uid) {
        try {
            return sINM.hasUserDemotedInvalidMsgApp(pkg, uid);
        } catch (Exception e) {
            Log.w(TAG, "Error calling NoMan", e);
            return false;
        }
    }

    public void setInvalidMsgAppDemoted(String pkg, int uid, boolean isDemoted) {
        try {
             sINM.setInvalidMsgAppDemoted(pkg, uid, isDemoted);
        } catch (Exception e) {
            Log.w(TAG, "Error calling NoMan", e);
        }
    }

    /**
     * Returns all notification channels associated with the package and uid that will bypass DND
     */
+6 −16
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public class AppConversationListPreferenceController extends NotificationPrefere

    protected List<ConversationChannelWrapper> mConversations = new ArrayList<>();
    protected PreferenceCategory mPreference;
    private boolean mHasSentMsg;
    private boolean mIsInInvalidMsgState;

    public AppConversationListPreferenceController(Context context, NotificationBackend backend) {
        super(context, backend);
@@ -88,7 +88,7 @@ public class AppConversationListPreferenceController extends NotificationPrefere
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... unused) {
                mHasSentMsg = mBackend.hasSentMessage(mAppRow.pkg, mAppRow.uid);
                mIsInInvalidMsgState = mBackend.isInInvalidMsgState(mAppRow.pkg, mAppRow.uid);
                ParceledListSlice<ConversationChannelWrapper> list =
                        mBackend.getConversations(mAppRow.pkg, mAppRow.uid);
                if (list != null) {
@@ -121,20 +121,10 @@ public class AppConversationListPreferenceController extends NotificationPrefere
        if (mPreference == null) {
            return;
        }

        if (!mIsInInvalidMsgState && !mConversations.isEmpty()) {
            // TODO: if preference has children, compare with newly loaded list
            mPreference.removeAll();
        if (mConversations.isEmpty()) {
            if (mHasSentMsg) {
                mPreference.setVisible(true);
                Preference notSupportedPref = new Preference(mContext);
                notSupportedPref.setSummary(mContext.getString(
                        R.string.convo_not_supported_summary, mAppRow.label));
                mPreference.addPreference(notSupportedPref);
            } else {
                mPreference.setVisible(false);
            }
        } else {
            mPreference.setVisible(true);
            mPreference.setTitle(getTitleResId());
            populateConversations();
        }
+2 −0
Original line number Diff line number Diff line
@@ -122,6 +122,8 @@ public class AppNotificationSettings extends NotificationSettings {
        mControllers.add(new DeletedChannelsPreferenceController(context, mBackend));
        mControllers.add(new ChannelListPreferenceController(context, mBackend));
        mControllers.add(new AppConversationListPreferenceController(context, mBackend));
        mControllers.add(new InvalidConversationInfoPreferenceController(context, mBackend));
        mControllers.add(new InvalidConversationPreferenceController(context, mBackend));
        mControllers.add(new BubbleSummaryPreferenceController(context, mBackend));
        return new ArrayList<>(mControllers);
    }
Loading