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

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

Snap for 4810559 from 7c0e462b to pi-release

Change-Id: I513bda430d7410e598d0ffc7bef45457214107d3
parents 2f05be85 7c0e462b
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -1555,6 +1555,7 @@ public class AppOpsManager {
        private final long[] mRejectTimes;
        private final int mDuration;
        private final int mProxyUid;
        private final boolean mRunning;
        private final String mProxyPackageName;

        public OpEntry(int op, int mode, long time, long rejectTime, int duration,
@@ -1566,12 +1567,13 @@ public class AppOpsManager {
            mTimes[0] = time;
            mRejectTimes[0] = rejectTime;
            mDuration = duration;
            mRunning = duration == -1;
            mProxyUid = proxyUid;
            mProxyPackageName = proxyPackage;
        }

        public OpEntry(int op, int mode, long[] times, long[] rejectTimes, int duration,
                int proxyUid, String proxyPackage) {
                boolean running, int proxyUid, String proxyPackage) {
            mOp = op;
            mMode = mode;
            mTimes = new long[_NUM_UID_STATE];
@@ -1579,10 +1581,16 @@ public class AppOpsManager {
            System.arraycopy(times, 0, mTimes, 0, _NUM_UID_STATE);
            System.arraycopy(rejectTimes, 0, mRejectTimes, 0, _NUM_UID_STATE);
            mDuration = duration;
            mRunning = running;
            mProxyUid = proxyUid;
            mProxyPackageName = proxyPackage;
        }

        public OpEntry(int op, int mode, long[] times, long[] rejectTimes, int duration,
                int proxyUid, String proxyPackage) {
            this(op, mode, times, rejectTimes, duration, duration == -1, proxyUid, proxyPackage);
        }

        public int getOp() {
            return mOp;
        }
@@ -1632,7 +1640,7 @@ public class AppOpsManager {
        }

        public boolean isRunning() {
            return mDuration == -1;
            return mRunning;
        }

        public int getDuration() {
@@ -1659,6 +1667,7 @@ public class AppOpsManager {
            dest.writeLongArray(mTimes);
            dest.writeLongArray(mRejectTimes);
            dest.writeInt(mDuration);
            dest.writeBoolean(mRunning);
            dest.writeInt(mProxyUid);
            dest.writeString(mProxyPackageName);
        }
@@ -1669,6 +1678,7 @@ public class AppOpsManager {
            mTimes = source.createLongArray();
            mRejectTimes = source.createLongArray();
            mDuration = source.readInt();
            mRunning = source.readBoolean();
            mProxyUid = source.readInt();
            mProxyPackageName = source.readString();
        }
+2 −1
Original line number Diff line number Diff line
@@ -1664,7 +1664,8 @@ public abstract class PackageManager {
    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device includes at least one form of audio
     * output, such as speakers, audio jack or streaming over bluetooth
     * output, as defined in the Android Compatibility Definition Document (CDD)
     * <a href="https://source.android.com/compatibility/android-cdd#7_8_audio">section 7.8 Audio</a>.
     */
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ public class FeatureFlagUtils {
        DEFAULT_FLAGS.put("settings_bluetooth_while_driving", "false");
        DEFAULT_FLAGS.put("settings_data_usage_v2", "true");
        DEFAULT_FLAGS.put("settings_audio_switcher", "true");
        DEFAULT_FLAGS.put("settings_systemui_theme", "false");
        DEFAULT_FLAGS.put("settings_systemui_theme", "true");
    }

    /**
+6 −3
Original line number Diff line number Diff line
@@ -156,9 +156,12 @@ public class AssistUtils {
        if (activeServiceSupportsAssistGesture()) {
            return getActiveServiceComponentName();
        }

        Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
                .getAssistIntent(false);
        final SearchManager searchManager =
            (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
        if (searchManager == null) {
            return null;
        }
        final Intent intent = searchManager.getAssistIntent(false);
        PackageManager pm = mContext.getPackageManager();
        ResolveInfo info = pm.resolveActivityAsUser(intent, PackageManager.MATCH_DEFAULT_ONLY,
                userId);
+6 −138
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ import android.widget.Space;

import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.ResolverActivity;
import com.android.internal.app.ResolverActivity.TargetInfo;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -932,7 +933,7 @@ public class ChooserActivity extends ResolverActivity {
        public static final int TARGET_SERVICE = 1;
        public static final int TARGET_STANDARD = 2;

        private static final int MAX_SERVICE_TARGETS = 8;
        private static final int MAX_SERVICE_TARGETS = 4;
        private static final int MAX_TARGETS_PER_SERVICE = 4;

        private final List<ChooserTargetInfo> mServiceTargets = new ArrayList<>();
@@ -1189,123 +1190,20 @@ public class ChooserActivity extends ResolverActivity {
        }
    }

    static class RowScale {
        private static final int DURATION = 400;

        float mScale;
        ChooserRowAdapter mAdapter;
        private final ObjectAnimator mAnimator;

        public static final FloatProperty<RowScale> PROPERTY =
                new FloatProperty<RowScale>("scale") {
            @Override
            public void setValue(RowScale object, float value) {
                object.mScale = value;
                object.mAdapter.notifyDataSetChanged();
            }

            @Override
            public Float get(RowScale object) {
                return object.mScale;
            }
        };

        public RowScale(@NonNull ChooserRowAdapter adapter, float from, float to) {
            mAdapter = adapter;
            mScale = from;
            if (from == to) {
                mAnimator = null;
                return;
            }

            mAnimator = ObjectAnimator.ofFloat(this, PROPERTY, from, to)
                .setDuration(DURATION);
            mAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    mAdapter.onAnimationStart();
                }
                @Override
                public void onAnimationEnd(Animator animation) {
                    mAdapter.onAnimationEnd();
                }
            });
        }

        public RowScale setInterpolator(Interpolator interpolator) {
            if (mAnimator != null) {
                mAnimator.setInterpolator(interpolator);
            }
            return this;
        }

        public float get() {
            return mScale;
        }

        public void startAnimation() {
            if (mAnimator != null) {
                mAnimator.start();
            }
        }

        public void cancelAnimation() {
            if (mAnimator != null) {
                mAnimator.cancel();
            }
        }
    }

    class ChooserRowAdapter extends BaseAdapter {
        private ChooserListAdapter mChooserListAdapter;
        private final LayoutInflater mLayoutInflater;
        private final int mColumnCount = 4;
        private RowScale[] mServiceTargetScale;
        private final Interpolator mInterpolator;
        private int mAnimationCount = 0;

        public ChooserRowAdapter(ChooserListAdapter wrappedAdapter) {
            mChooserListAdapter = wrappedAdapter;
            mLayoutInflater = LayoutInflater.from(ChooserActivity.this);

            mInterpolator = AnimationUtils.loadInterpolator(ChooserActivity.this,
                    android.R.interpolator.decelerate_quint);

            wrappedAdapter.registerDataSetObserver(new DataSetObserver() {
                @Override
                public void onChanged() {
                    super.onChanged();
                    final int rcount = getServiceTargetRowCount();
                    if (mServiceTargetScale == null
                            || mServiceTargetScale.length != rcount) {
                        RowScale[] old = mServiceTargetScale;
                        int oldRCount = old != null ? old.length : 0;
                        mServiceTargetScale = new RowScale[rcount];
                        if (old != null && rcount > 0) {
                            System.arraycopy(old, 0, mServiceTargetScale, 0,
                                    Math.min(old.length, rcount));
                        }

                        for (int i = rcount; i < oldRCount; i++) {
                            old[i].cancelAnimation();
                        }

                        for (int i = oldRCount; i < rcount; i++) {
                            final RowScale rs = new RowScale(ChooserRowAdapter.this, 0.f, 1.f)
                                    .setInterpolator(mInterpolator);
                            mServiceTargetScale[i] = rs;
                        }

                        // Start the animations in a separate loop.
                        // The process of starting animations will result in
                        // binding views to set up initial values, and we must
                        // have ALL of the new RowScale objects created above before
                        // we get started.
                        for (int i = oldRCount; i < rcount; i++) {
                            mServiceTargetScale[i].startAnimation();
                        }
                    }

                    notifyDataSetChanged();
                }

@@ -1313,39 +1211,10 @@ public class ChooserActivity extends ResolverActivity {
                public void onInvalidated() {
                    super.onInvalidated();
                    notifyDataSetInvalidated();
                    if (mServiceTargetScale != null) {
                        for (RowScale rs : mServiceTargetScale) {
                            rs.cancelAnimation();
                        }
                    }
                }
            });
        }

        private float getRowScale(int rowPosition) {
            final int start = getCallerTargetRowCount();
            final int end = start + getServiceTargetRowCount();
            if (rowPosition >= start && rowPosition < end) {
                return mServiceTargetScale[rowPosition - start].get();
            }
            return 1.f;
        }

        public void onAnimationStart() {
            final boolean lock = mAnimationCount == 0;
            mAnimationCount++;
            if (lock) {
                mResolverDrawerLayout.setDismissLocked(true);
            }
        }

        public void onAnimationEnd() {
            mAnimationCount--;
            if (mAnimationCount == 0) {
                mResolverDrawerLayout.setDismissLocked(false);
            }
        }

        @Override
        public int getCount() {
            return (int) (
@@ -1360,9 +1229,9 @@ public class ChooserActivity extends ResolverActivity {
                    (float) mChooserListAdapter.getCallerTargetCount() / mColumnCount);
        }

        // There can be at most one row of service targets.
        public int getServiceTargetRowCount() {
            return (int) Math.ceil(
                    (float) mChooserListAdapter.getServiceTargetCount() / mColumnCount);
            return (int) mChooserListAdapter.getServiceTargetCount() == 0 ? 0 : 1;
        }

        @Override
@@ -1485,8 +1354,7 @@ public class ChooserActivity extends ResolverActivity {
            }

            final int oldHeight = holder.row.getLayoutParams().height;
            holder.row.getLayoutParams().height = Math.max(1,
                    (int) (holder.measuredRowHeight * getRowScale(rowPosition)));
            holder.row.getLayoutParams().height = Math.max(1, holder.measuredRowHeight);
            if (holder.row.getLayoutParams().height != oldHeight) {
                holder.row.requestLayout();
            }
@@ -1728,7 +1596,7 @@ public class ChooserActivity extends ResolverActivity {
                final View v = mChooserRowAdapter.getView(pos, mCachedView, mListView);
                int height = ((RowViewHolder) (v.getTag())).measuredRowHeight;

                offset += (int) (height * mChooserRowAdapter.getRowScale(pos));
                offset += (int) (height);

                if (vt >= 0) {
                    mCachedViewType = vt;
Loading