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

Commit 4287420f authored by Julia Reynolds's avatar Julia Reynolds Committed by Automerger Merge Worker
Browse files

Merge "Revert^2 "Improve App notification loading"" into tm-qpr-dev am: 635b3f06 am: e8409ecf

parents 34912fb2 e8409ecf
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ public class AppBubbleListPreferenceController extends AppConversationListPrefer
    private static final String KEY = "bubble_conversations";

    public AppBubbleListPreferenceController(Context context, NotificationBackend backend) {
        super(context, backend);
        super(context, backend, KEY);
    }

    @Override
@@ -80,25 +80,25 @@ public class AppBubbleListPreferenceController extends AppConversationListPrefer
    }

    @Override
    public boolean isAvailable() {
    public int getAvailabilityStatus() {
        // copy rather than inherit super's isAvailable because apps can link to this page
        // as part of onboarding, before they send a valid conversation notification
        if (mAppRow == null) {
            return false;
            return CONDITIONALLY_UNAVAILABLE;
        }
        if (mAppRow.banned) {
            return false;
            return CONDITIONALLY_UNAVAILABLE;
        }
        if (mChannel != null) {
            if (mBackend.onlyHasDefaultChannel(mAppRow.pkg, mAppRow.uid)
                    || NotificationChannel.DEFAULT_CHANNEL_ID.equals(mChannel.getId())) {
                return false;
                return CONDITIONALLY_UNAVAILABLE;
            }
        }
        if (mAppRow.bubblePreference == BUBBLE_PREFERENCE_NONE) {
            return false;
            return CONDITIONALLY_UNAVAILABLE;
        }
        return true;
        return AVAILABLE;
    }

    @VisibleForTesting
+5 −5
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ public class AddToHomeScreenPreferenceController extends NotificationPreferenceC
    private static final String KEY = "add_to_home";

    public AddToHomeScreenPreferenceController(Context context, NotificationBackend backend) {
        super(context, backend);
        super(context, backend, KEY);
    }

    @Override
@@ -41,11 +41,11 @@ public class AddToHomeScreenPreferenceController extends NotificationPreferenceC
    }

    @Override
    public boolean isAvailable() {
        if (!super.isAvailable()) {
            return false;
    public int getAvailabilityStatus() {
        if (super.getAvailabilityStatus() == CONDITIONALLY_UNAVAILABLE) {
            return CONDITIONALLY_UNAVAILABLE;
        }
        return mConversationInfo != null;
        return mConversationInfo != null ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
    }

    @Override
+8 −5
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public class AllowSoundPreferenceController extends NotificationPreferenceContro
    public AllowSoundPreferenceController(Context context,
            NotificationSettings.DependentFieldListener dependentFieldListener,
            NotificationBackend backend) {
        super(context, backend);
        super(context, backend, KEY_IMPORTANCE);
        mDependentFieldListener = dependentFieldListener;
    }

@@ -50,11 +50,14 @@ public class AllowSoundPreferenceController extends NotificationPreferenceContro
    }

    @Override
    public boolean isAvailable() {
        if (!super.isAvailable()) {
            return false;
    public int getAvailabilityStatus() {
        if (super.getAvailabilityStatus() == CONDITIONALLY_UNAVAILABLE) {
            return CONDITIONALLY_UNAVAILABLE;
        }
        return mChannel != null && NotificationChannel.DEFAULT_CHANNEL_ID.equals(mChannel.getId());
        if (mChannel != null && NotificationChannel.DEFAULT_CHANNEL_ID.equals(mChannel.getId())) {
            return AVAILABLE;
        }
        return CONDITIONALLY_UNAVAILABLE;

    }

+3 −3
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre
    public AppChannelsBypassingDndPreferenceController(
            Context context,
            NotificationBackend backend) {
        super(context, backend);
        super(context, backend, KEY);
    }

    @Override
@@ -110,8 +110,8 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre
    }

    @Override
    public boolean isAvailable() {
        return mAppRow != null;
    public int getAvailabilityStatus() {
        return mAppRow != null ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
    }

    @Override
+15 −7
Original line number Diff line number Diff line
@@ -49,7 +49,12 @@ public class AppConversationListPreferenceController extends NotificationPrefere
    protected PreferenceCategory mPreference;

    public AppConversationListPreferenceController(Context context, NotificationBackend backend) {
        super(context, backend);
        this(context, backend, KEY);
    }

    public AppConversationListPreferenceController(Context context, NotificationBackend backend,
            String key) {
        super(context, backend, key);
    }

    @Override
@@ -58,21 +63,24 @@ public class AppConversationListPreferenceController extends NotificationPrefere
    }

    @Override
    public boolean isAvailable() {
    public int getAvailabilityStatus() {
        if (mAppRow == null) {
            return false;
            return CONDITIONALLY_UNAVAILABLE;
        }
        if (mAppRow.banned) {
            return false;
            return CONDITIONALLY_UNAVAILABLE;
        }
        if (mChannel != null) {
            if (mBackend.onlyHasDefaultChannel(mAppRow.pkg, mAppRow.uid)
                    || NotificationChannel.DEFAULT_CHANNEL_ID.equals(mChannel.getId())) {
                return false;
                return CONDITIONALLY_UNAVAILABLE;
            }
        }
        if (mBackend.hasSentValidMsg(mAppRow.pkg, mAppRow.uid) || mBackend.isInInvalidMsgState(
                mAppRow.pkg, mAppRow.uid)) {
            return AVAILABLE;
        }
        return mBackend.hasSentValidMsg(mAppRow.pkg, mAppRow.uid) || mBackend.isInInvalidMsgState(
                mAppRow.pkg, mAppRow.uid);
        return CONDITIONALLY_UNAVAILABLE;
    }

    @Override
Loading