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

Commit cb9d472e authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4404534 from ea0b574e to oc-mr1-release

Change-Id: If49188c0ebf6a8e25391d9eebb764884b134cabb
parents 462aea99 ea0b574e
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -221,6 +221,40 @@ public class ResolveInfo implements Parcelable {
        return data;
    }

    /**
     * @return The resource that would be used when loading
     * the label for this resolve info.
     *
     * @hide
     */
    public int resolveLabelResId() {
        if (labelRes != 0) {
            return labelRes;
        }
        final ComponentInfo componentInfo = getComponentInfo();
        if (componentInfo.labelRes != 0) {
            return componentInfo.labelRes;
        }
        return componentInfo.applicationInfo.labelRes;
    }

    /**
     * @return The resource that would be used when loading
     * the icon for this resolve info.
     *
     * @hide
     */
    public int resolveIconResId() {
        if (icon != 0) {
            return icon;
        }
        final ComponentInfo componentInfo = getComponentInfo();
        if (componentInfo.icon != 0) {
            return componentInfo.icon;
        }
        return componentInfo.applicationInfo.icon;
    }

    /**
     * Retrieve the current graphical icon associated with this resolution.  This
     * will call back on the given PackageManager to load the icon from
+5 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import com.android.systemui.plugins.qs.QSTile.Icon;
import com.android.systemui.plugins.qs.QSTile.State;

import java.util.Objects;
import java.util.function.Supplier;

@ProvidesInterface(version = QSTile.VERSION)
@DependsOn(target = QSIconView.class)
@@ -104,6 +105,7 @@ public interface QSTile {
    public static class State {
        public static final int VERSION = 1;
        public Icon icon;
        public Supplier<Icon> iconSupplier;
        public int state = Tile.STATE_ACTIVE;
        public CharSequence label;
        public CharSequence contentDescription;
@@ -118,6 +120,7 @@ public interface QSTile {
            if (other == null) throw new IllegalArgumentException();
            if (!other.getClass().equals(getClass())) throw new IllegalArgumentException();
            final boolean changed = !Objects.equals(other.icon, icon)
                    || !Objects.equals(other.iconSupplier, iconSupplier)
                    || !Objects.equals(other.label, label)
                    || !Objects.equals(other.contentDescription, contentDescription)
                    || !Objects.equals(other.dualLabelContentDescription,
@@ -130,6 +133,7 @@ public interface QSTile {
                    || !Objects.equals(other.dualTarget, dualTarget)
                    || !Objects.equals(other.slash, slash);
            other.icon = icon;
            other.iconSupplier = iconSupplier;
            other.label = label;
            other.contentDescription = contentDescription;
            other.dualLabelContentDescription = dualLabelContentDescription;
@@ -150,6 +154,7 @@ public interface QSTile {
        protected StringBuilder toStringBuilder() {
            final StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append('[');
            sb.append(",icon=").append(icon);
            sb.append(",iconSupplier=").append(iconSupplier);
            sb.append(",label=").append(label);
            sb.append(",contentDescription=").append(contentDescription);
            sb.append(",dualLabelContentDescription=").append(dualLabelContentDescription);
+9 −1
Original line number Diff line number Diff line
@@ -305,7 +305,15 @@ public class CustomTile extends QSTileImpl<State> implements TileChangeListener
            state.state = Tile.STATE_UNAVAILABLE;
            drawable = mDefaultIcon.loadDrawable(mContext);
        }
        state.icon = new DrawableIcon(drawable);

        final Drawable drawableF = drawable;
        state.iconSupplier = () -> {
            Drawable.ConstantState cs = drawableF.getConstantState();
            if (cs != null) {
                return new DrawableIcon(cs.newDrawable());
            }
            return null;
        };
        state.label = mTile.getLabel();
        if (mTile.getContentDescription() != null) {
            state.contentDescription = mTile.getContentDescription();
+7 −6
Original line number Diff line number Diff line
@@ -87,14 +87,15 @@ public class QSIconViewImpl extends QSIconView {
    }

    protected void updateIcon(ImageView iv, State state) {
        if (!Objects.equals(state.icon, iv.getTag(R.id.qs_icon_tag))
        final QSTile.Icon icon = state.iconSupplier != null ? state.iconSupplier.get() : state.icon;
        if (!Objects.equals(icon, iv.getTag(R.id.qs_icon_tag))
                || !Objects.equals(state.slash, iv.getTag(R.id.qs_slash_tag))) {
            boolean shouldAnimate = iv.isShown() && mAnimationEnabled
                    && iv.getDrawable() != null;
            Drawable d = state.icon != null
                    ? shouldAnimate ? state.icon.getDrawable(mContext)
                    : state.icon.getInvisibleDrawable(mContext) : null;
            int padding = state.icon != null ? state.icon.getPadding() : 0;
            Drawable d = icon != null
                    ? shouldAnimate ? icon.getDrawable(mContext)
                    : icon.getInvisibleDrawable(mContext) : null;
            int padding = icon != null ? icon.getPadding() : 0;
            if (d != null) {
                d.setAutoMirrored(false);
                d.setLayoutDirection(getLayoutDirection());
@@ -107,7 +108,7 @@ public class QSIconViewImpl extends QSIconView {
                iv.setImageDrawable(d);
            }

            iv.setTag(R.id.qs_icon_tag, state.icon);
            iv.setTag(R.id.qs_icon_tag, icon);
            iv.setTag(R.id.qs_slash_tag, state.slash);
            iv.setPadding(0, padding, 0, padding);
            if (d instanceof Animatable2) {
+9 −3
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_VISIBILIT
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
import static com.android.server.am.ActivityStack.ActivityState.PAUSED;
import static com.android.server.am.ActivityRecord.ASSISTANT_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityStack.ActivityState.STOPPED;
@@ -2080,10 +2081,15 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        try {
            final boolean canEnterPictureInPicture = r.checkEnterPictureInPictureState(
                    "makeInvisible", true /* beforeStopping */);
            // Defer telling the client it is hidden if it can enter Pip and isn't current stopped
            // or stopping. This gives it a chance to enter Pip in onPause().
            // Defer telling the client it is hidden if it can enter Pip and isn't current paused,
            // stopped or stopping. This gives it a chance to enter Pip in onPause().
            // TODO: There is still a question surrounding activities in multi-window mode that want
            // to enter Pip after they are paused, but are still visible. I they should be okay to
            // enter Pip in those cases, but not "auto-Pip" which is what this condition covers and
            // the current contract for "auto-Pip" is that the app should enter it before onPause
            // returns. Just need to confirm this reasoning makes sense.
            final boolean deferHidingClient = canEnterPictureInPicture
                    && r.state != STOPPING && r.state != STOPPED;
                    && r.state != STOPPING && r.state != STOPPED && r.state != PAUSED;
            r.setDeferHidingClient(deferHidingClient);
            r.setVisible(false);

Loading