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

Commit 12180650 authored by Michael Wright's avatar Michael Wright Committed by Android (Google) Code Review
Browse files

Merge "Revert^3 "Improve App notification loading"" into tm-qpr-dev

parents 225b3b06 475632c4
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, KEY);
        super(context, backend);
    }

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

    @Override
    public int getAvailabilityStatus() {
    public boolean isAvailable() {
        // 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 CONDITIONALLY_UNAVAILABLE;
            return false;
        }
        if (mAppRow.banned) {
            return CONDITIONALLY_UNAVAILABLE;
            return false;
        }
        if (mChannel != null) {
            if (mBackend.onlyHasDefaultChannel(mAppRow.pkg, mAppRow.uid)
                    || NotificationChannel.DEFAULT_CHANNEL_ID.equals(mChannel.getId())) {
                return CONDITIONALLY_UNAVAILABLE;
                return false;
            }
        }
        if (mAppRow.bubblePreference == BUBBLE_PREFERENCE_NONE) {
            return CONDITIONALLY_UNAVAILABLE;
            return false;
        }
        return AVAILABLE;
        return true;
    }

    @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, KEY);
        super(context, backend);
    }

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

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

    @Override
+5 −8
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, KEY_IMPORTANCE);
        super(context, backend);
        mDependentFieldListener = dependentFieldListener;
    }

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

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

    }

+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, KEY);
        super(context, backend);
    }

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

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

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

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

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

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

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

    @Override
Loading