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

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

Snap for 5788294 from 3956d960 to qt-c2f2-release

Change-Id: Ic82bd2826cdde484c0e39a42337d0dbd6975f4fc
parents 7ecb579d 3956d960
Loading
Loading
Loading
Loading
+46 −42
Original line number Diff line number Diff line
@@ -870,8 +870,8 @@ public final class ContactsContract {
    protected interface ContactOptionsColumns {
        /**
         * The number of times a contact has been contacted.
         * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete. For
         * more information, see the
         * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
         * this field is obsolete, regardless of Android version. For more information, see the
         * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
         * page.</p>
         * <P>Type: INTEGER</P>
@@ -885,8 +885,8 @@ public final class ContactsContract {

        /**
         * The last time a contact was contacted.
         * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete. For
         * more information, see the
         * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
         * this field is obsolete, regardless of Android version. For more information, see the
         * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
         * page.</p>
         * <P>Type: INTEGER</P>
@@ -1691,10 +1691,10 @@ public final class ContactsContract {
         * TIMES_CONTACTED field is incremented by 1 and the LAST_TIME_CONTACTED
         * field is populated with the current system time.
         *
         * <p class="caution"><b>Caution: </b>As of January 7, 2019, this method is obsolete. For
         * more information, see the
         * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
         * this field is obsolete, regardless of Android version. For more information, see the
         * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
         * page.
         * page.</p>
         *
         * @param resolver the ContentResolver to use
         * @param contactId the person who was contacted
@@ -1730,8 +1730,8 @@ public final class ContactsContract {
         * Frequent contacts are no longer included in the result as of
         * Android version {@link android.os.Build.VERSION_CODES#Q}.
         *
         * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts
         * results based on contacts frequency. For more information, see the
         * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, this
         * field doesn't sort results based on contacts frequency. For more information, see the
         * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
         * page.
         */
@@ -1745,8 +1745,8 @@ public final class ContactsContract {
         * Android version {@link android.os.Build.VERSION_CODES#Q}.
         * This URI always returns an empty cursor.
         *
         * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts
         * results based on contacts frequency. For more information, see the
         * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, this
         * field doesn't sort results based on contacts frequency. For more information, see the
         * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
         * page.
         */
@@ -1760,8 +1760,8 @@ public final class ContactsContract {
         * various parts of the contact name. The filter argument should be passed
         * as an additional path segment after this URI.
         *
         * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts
         * results based on contacts frequency. For more information, see the
         * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, this
         * field doesn't sort results based on contacts frequency. For more information, see the
         * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
         * page.
         */
@@ -4292,10 +4292,10 @@ public final class ContactsContract {
         * Android version {@link android.os.Build.VERSION_CODES#Q}.
         * This column always contains 0.
         *
         * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete.
         * For more information, see the
         * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
         * this field is obsolete, regardless of Android version. For more information, see the
         * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
         * page.
         * page.</p>
         */
        @Deprecated
        public static final String LAST_TIME_USED = "last_time_used";
@@ -4306,10 +4306,10 @@ public final class ContactsContract {
         * Android version {@link android.os.Build.VERSION_CODES#Q}.
         * This column always contains 0.
         *
         * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete.
         * For more information, see the
         * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
         * this field is obsolete, regardless of Android version. For more information, see the
         * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
         * page.
         * page.</p>
         */
        @Deprecated
        public static final String TIMES_USED = "times_used";
@@ -5259,8 +5259,8 @@ public final class ContactsContract {
        /**
         * The content:// style URI for this table.
         *
         * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer
         * sorts results based on contacts frequency. For more information, see the
         * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, this
         * field doesn't sort results based on contacts frequency. For more information, see the
         * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
         * page.
         *
@@ -5277,8 +5277,8 @@ public final class ContactsContract {
        /**
         * <p>URI used for the "enterprise caller-id".</p>
         *
         * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer
         * sorts results based on contacts frequency. For more information, see the
         * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, this
         * field doesn't sort results based on contacts frequency. For more information, see the
         * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
         * page.
         *
@@ -6079,8 +6079,8 @@ public final class ContactsContract {
             * to display names as well as phone numbers. The filter argument should be passed
             * as an additional path segment after this URI.
             *
             * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer
             * sorts results based on contacts frequency. For more information, see the
             * <p class="caution"><b>Caution: </b>This field deosn't sort results based on contacts
             * frequency. For more information, see the
             * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
             * page.
             */
@@ -6092,8 +6092,9 @@ public final class ContactsContract {
             * same columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in
             * parameters, otherwise it will throw IllegalArgumentException.
             *
             * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts
             * results based on contacts frequency. For more information, see the
             * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
             * this field doesn't sort results based on contacts frequency. For more information,
             * see the
             * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
             * page.
             */
@@ -6360,8 +6361,9 @@ public final class ContactsContract {
             * as an additional path segment after this URI.
             * </p>
             *
             * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts
             * results based on contacts frequency. For more information, see the
             * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
             * this field doesn't sort results based on contacts frequency. For more information,
             * see the
             * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
             * page.</p>
             *
@@ -6383,8 +6385,9 @@ public final class ContactsContract {
             * same columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in
             * parameters, otherwise it will throw IllegalArgumentException.
             *
             * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer
             * sorts results based on contacts frequency. For more information, see the
             * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
             * this field doesn't sort results based on contacts frequency. For more information,
             * see the
             * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
             * page.
             */
@@ -7602,8 +7605,8 @@ public final class ContactsContract {
             * <p>Similar to {@link Phone#CONTENT_FILTER_URI}, but allows users to filter callable
             * data.
             *
             * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer
             * sorts results based on contacts frequency. For more information, see the
             * <p class="caution"><b>Caution: </b>This field no longer sorts results based on
             * contacts frequency. For more information, see the
             * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
             * page.
             */
@@ -7615,8 +7618,9 @@ public final class ContactsContract {
             * callable data. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in
             * parameters, otherwise it will throw IllegalArgumentException.
             *
             * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer
             * sorts results based on contacts frequency. For more information, see the
             * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
             * this field doesn't sort results based on contacts frequency. For more information,
             * see the
             * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
             * page.</p>
             */
@@ -7646,8 +7650,9 @@ public final class ContactsContract {
             * <p>The content:// style URI for these data items, which allows for a query parameter
             * to be appended onto the end to filter for data items matching the query.
             *
             * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer
             * sorts results based on contacts frequency. For more information, see the
             * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
             * this field doesn't sort results based on contacts frequency. For more information,
             * see the
             * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
             * page.
             */
@@ -8298,15 +8303,14 @@ public final class ContactsContract {
    }

    /**
     * <p class="caution"><b>Caution: </b>As of January 7, 2019, this class is obsolete. For
     * more information, see the
     * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
     * page.
     * </p>
     * <p>
     * API allowing applications to send usage information for each {@link Data} row to the
     * Contacts Provider.  Applications can also clear all usage information.
     * </p>
     * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store,
     * this field is obsolete, regardless of Android version. For more information, see the
     * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a>
     * page.</p>
     * <p>
     * With the feedback, Contacts Provider may return more contextually appropriate results for
     * Data listing, typically supplied with
+21 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ public abstract class AbsSeekBar extends ProgressBar {
    @UnsupportedAppUsage
    private float mDisabledAlpha;

    private int mThumbExclusionMaxSize;
    private int mScaledTouchSlop;
    private float mTouchDownX;
    @UnsupportedAppUsage
@@ -170,6 +171,8 @@ public abstract class AbsSeekBar extends ProgressBar {
        applyTickMarkTint();

        mScaledTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
        mThumbExclusionMaxSize = getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.seekbar_thumb_exclusion_max_size);
    }

    /**
@@ -762,11 +765,29 @@ public abstract class AbsSeekBar extends ProgressBar {
        }
        mGestureExclusionRects.clear();
        thumb.copyBounds(mThumbRect);
        mThumbRect.offset(mPaddingLeft - mThumbOffset, mPaddingTop);
        growRectTo(mThumbRect, Math.min(getHeight(), mThumbExclusionMaxSize));
        mGestureExclusionRects.add(mThumbRect);
        mGestureExclusionRects.addAll(mUserGestureExclusionRects);
        super.setSystemGestureExclusionRects(mGestureExclusionRects);
    }

    /**
     * Grows {@code r} from its center such that each dimension is at least {@code minimumSize}.
     */
    private void growRectTo(Rect r, int minimumSize) {
        int dy = (minimumSize - r.height()) / 2;
        if (dy > 0) {
            r.top -= dy;
            r.bottom += dy;
        }
        int dx = (minimumSize - r.width()) / 2;
        if (dx > 0) {
            r.left -= dx;
            r.right += dx;
        }
    }

    /**
     * @hide
     */
+2 −0
Original line number Diff line number Diff line
@@ -748,6 +748,8 @@
    <!-- Line spacing modifier for the message field of the harmful app dialog -->
    <item name="harmful_app_message_line_spacing_modifier" type="dimen">1.22</item>

    <dimen name="seekbar_thumb_exclusion_max_size">48dp</dimen>

    <!-- chooser (sharesheet) spacing -->
    <dimen name="chooser_corner_radius">8dp</dimen>
    <dimen name="chooser_row_text_option_translate">25dp</dimen>
+1 −0
Original line number Diff line number Diff line
@@ -3817,6 +3817,7 @@
  <java-symbol type="color" name="chooser_gradient_highlight" />
  <java-symbol type="drawable" name="chooser_direct_share_label_placeholder" />
  <java-symbol type="dimen" name="chooser_direct_share_label_placeholder_max_width" />
  <java-symbol type="dimen" name="seekbar_thumb_exclusion_max_size" />
  <java-symbol type="layout" name="chooser_az_label_row" />
  <java-symbol type="string" name="chooser_all_apps_button_label" />
  <java-symbol type="anim" name="resolver_launch_anim" />
+136 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.widget;

import static android.view.View.MeasureSpec.EXACTLY;
import static android.view.View.MeasureSpec.makeMeasureSpec;

import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RectShape;
import android.platform.test.annotations.Presubmit;
import android.view.View;

import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Arrays;
import java.util.List;

@RunWith(AndroidJUnit4.class)
@SmallTest
@Presubmit
public class AbsSeekBarTest {

    private Context mContext;
    private AbsSeekBar mBar;

    @Before
    public void setUp() throws Exception {
        mContext = InstrumentationRegistry.getInstrumentation().getContext();
        mBar = new SeekBar(mContext);
    }

    @Test
    public void testExclusionForThumb_limitedTo48dp() {
        mBar.setPadding(10, 10, 10, 10);
        mBar.setThumb(newThumb(dpToPx(20)));
        mBar.setMin(0);
        mBar.setMax(100);
        mBar.setProgress(50);
        measureAndLayout(dpToPx(200), dpToPx(100));
        List<Rect> exclusions = mBar.getSystemGestureExclusionRects();

        assertEquals("exclusions should be size 1, but was " + exclusions, 1, exclusions.size());
        assertEquals("exclusion should be centered on thumb",
                center(mBar), center(exclusions.get(0)));
        assertEquals("exclusion should be 48dp high", dpToPx(48), exclusions.get(0).height());
        assertEquals("exclusion should be 48dp wide", dpToPx(48), exclusions.get(0).width());
    }

    @Test
    public void testExclusionForThumb_limitedToHeight() {
        mBar.setPadding(10, 10, 10, 10);
        mBar.setThumb(newThumb(dpToPx(20)));
        mBar.setMin(0);
        mBar.setMax(100);
        mBar.setProgress(50);
        measureAndLayout(dpToPx(200), dpToPx(32));
        List<Rect> exclusions = mBar.getSystemGestureExclusionRects();

        assertEquals("exclusions should be size 1, but was " + exclusions, 1, exclusions.size());
        assertEquals("exclusion should be centered on thumb",
                center(mBar), center(exclusions.get(0)));
        assertEquals("exclusion should be 32dp high", dpToPx(32), exclusions.get(0).height());
        assertEquals("exclusion should be 32dp wide", dpToPx(32), exclusions.get(0).width());
    }

    @Test
    public void testExclusionForThumb_passesThroughUserExclusions() {
        mBar.setSystemGestureExclusionRects(Arrays.asList(new Rect(1, 2, 3, 4)));

        mBar.setPadding(10, 10, 10, 10);
        mBar.setThumb(newThumb(dpToPx(20)));
        mBar.setMin(0);
        mBar.setMax(100);
        mBar.setProgress(50);
        measureAndLayout(dpToPx(200), dpToPx(32));

        assertThat(mBar.getSystemGestureExclusionRects(), hasItem(new Rect(1, 2, 3, 4)));
        assertThat(mBar.getSystemGestureExclusionRects(), hasSize(2));

        mBar.setSystemGestureExclusionRects(Arrays.asList(new Rect(3, 4, 5, 6)));
        assertThat(mBar.getSystemGestureExclusionRects(), hasItem(new Rect(3, 4, 5, 6)));
        assertThat(mBar.getSystemGestureExclusionRects(), hasSize(2));
    }

    private Point center(Rect rect) {
        return new Point(rect.centerX(), rect.centerY());
    }

    private Point center(View view) {
        return center(new Rect(view.getLeft(), view.getTop(), view.getRight(), view.getBottom()));
    }

    private ShapeDrawable newThumb(int size) {
        final ShapeDrawable thumb = new ShapeDrawable(new RectShape());
        thumb.setIntrinsicWidth(size);
        thumb.setIntrinsicHeight(size);
        return thumb;
    }

    private void measureAndLayout(int wPx, int hPx) {
        mBar.measure(makeMeasureSpec(wPx, EXACTLY), makeMeasureSpec(hPx, EXACTLY));
        mBar.layout(0, 0, wPx, hPx);
    }

    private int dpToPx(int dp) {
        return (int) (mContext.getResources().getDisplayMetrics().density * dp);
    }
}
Loading