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

Commit 35775b52 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8652434 from 364e7488 to tm-qpr1-release

Change-Id: I6d6e39309dc3bfbdfb9aff745b001c5d7c074c8a
parents 04d7cddf 364e7488
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -36,9 +36,11 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.provider.DeviceConfig;
import android.service.chooser.ChooserTarget;
import android.text.Layout;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.android.internal.R;
import com.android.internal.app.ResolverActivity.ResolvedComponentInfo;
@@ -102,6 +104,37 @@ public class ChooserListAdapter extends ResolverListAdapter {
    private AppPredictor mAppPredictor;
    private AppPredictor.Callback mAppPredictorCallback;

    // For pinned direct share labels, if the text spans multiple lines, the TextView will consume
    // the full width, even if the characters actually take up less than that. Measure the actual
    // line widths and constrain the View's width based upon that so that the pin doesn't end up
    // very far from the text.
    private final View.OnLayoutChangeListener mPinTextSpacingListener =
            new View.OnLayoutChangeListener() {
                @Override
                public void onLayoutChange(View v, int left, int top, int right, int bottom,
                        int oldLeft, int oldTop, int oldRight, int oldBottom) {
                    TextView textView = (TextView) v;
                    Layout layout = textView.getLayout();
                    if (layout != null) {
                        int textWidth = 0;
                        for (int line = 0; line < layout.getLineCount(); line++) {
                            textWidth = Math.max((int) Math.ceil(layout.getLineMax(line)),
                                    textWidth);
                        }
                        int desiredWidth = textWidth + textView.getPaddingLeft()
                                + textView.getPaddingRight();
                        if (textView.getWidth() > desiredWidth) {
                            ViewGroup.LayoutParams params = textView.getLayoutParams();
                            params.width = desiredWidth;
                            textView.setLayoutParams(params);
                            // Need to wait until layout pass is over before requesting layout.
                            textView.post(() -> textView.requestLayout());
                        }
                        textView.removeOnLayoutChangeListener(this);
                    }
                }
            };

    public ChooserListAdapter(Context context, List<Intent> payloadIntents,
            Intent[] initialIntents, List<ResolveInfo> rList,
            boolean filterLastUsed, ResolverListController resolverListController,
@@ -225,6 +258,7 @@ public class ChooserListAdapter extends ResolverListAdapter {
    @Override
    protected void onBindView(View view, TargetInfo info, int position) {
        final ViewHolder holder = (ViewHolder) view.getTag();

        if (info == null) {
            holder.icon.setImageDrawable(
                    mContext.getDrawable(R.drawable.resolver_icon_placeholder));
@@ -274,6 +308,9 @@ public class ChooserListAdapter extends ResolverListAdapter {
            holder.itemView.setBackground(holder.defaultItemViewBackground);
        }

        // Always remove the spacing listener, attach as needed to direct share targets below.
        holder.text.removeOnLayoutChangeListener(mPinTextSpacingListener);

        if (info instanceof MultiDisplayResolveInfo) {
            // If the target is grouped show an indicator
            Drawable bkg = mContext.getDrawable(R.drawable.chooser_group_background);
@@ -286,6 +323,7 @@ public class ChooserListAdapter extends ResolverListAdapter {
            Drawable bkg = mContext.getDrawable(R.drawable.chooser_pinned_background);
            holder.text.setPaddingRelative(bkg.getIntrinsicWidth() /* start */, 0, 0, 0);
            holder.text.setBackground(bkg);
            holder.text.addOnLayoutChangeListener(mPinTextSpacingListener);
        } else {
            holder.text.setBackground(null);
            holder.text.setPaddingRelative(0, 0, 0, 0);
+1 −1
Original line number Diff line number Diff line
@@ -1872,7 +1872,7 @@
    <!-- The package name of the default captive portal login app. Must be granted the
         POST_NOTIFICATIONS permission.
    -->
    <string name="config_defaultCaptivePortalLoginPackageName" translatable="false"></string>
    <string name="config_defaultCaptivePortalLoginPackageName" translatable="false">com.android.captiveportallogin</string>

    <!-- Whether to enable geocoder overlay which allows geocoder to be replaced
         by an app at run-time. When disabled, only the
+2 −8
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import android.widget.Switch;
import android.widget.TextView;

import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;

import com.android.settingslib.utils.BuildCompatUtils;

@@ -122,15 +121,10 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
        propagateChecked(isChecked);
    }

    @Override
    public void setOnClickListener(@Nullable OnClickListener l) {
        super.setOnClickListener(l);
        mSwitch.setOnClickListener(l);
    }

    @Override
    public boolean performClick() {
        return mSwitch.performClick();
        mSwitch.performClick();
        return super.performClick();
    }

    /**
+6 −1
Original line number Diff line number Diff line
@@ -29,7 +29,12 @@
            "file_patterns": ["SensorPrivacyService\\.java"]
        },
        {
            "name": "BinaryTransparencyServiceTest",
            "name": "FrameworksServicesTests",
            "options": [
                {
                    "include-filter": "com.android.server.BinaryTransparencyServiceTest"
                }
            ],
            "file_patterns": ["BinaryTransparencyService\\.java"]
        }
    ],