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

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

Snap for 8340896 from 795ffb43 to sc-qpr3-release

Change-Id: I9701c04db5b368fabec9987b68f693399577be62
parents e18e97fd 795ffb43
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@

package android.hardware.location;

import android.os.BadParcelableException;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

/**
 * Geofence Hardware Request used for internal location services communication.
@@ -140,10 +140,7 @@ public final class GeofenceHardwareRequestParcelable implements Parcelable {
        public GeofenceHardwareRequestParcelable createFromParcel(Parcel parcel) {
            int geofenceType = parcel.readInt();
            if (geofenceType != GeofenceHardwareRequest.GEOFENCE_TYPE_CIRCLE) {
                Log.e(
                        "GeofenceHardwareRequest",
                        String.format("Invalid Geofence type: %d", geofenceType));
                return null;
                throw new BadParcelableException("Invalid Geofence type: " + geofenceType);
            }

            GeofenceHardwareRequest request = GeofenceHardwareRequest.createCircularGeofence(
+6 −2
Original line number Diff line number Diff line
@@ -99,8 +99,12 @@ public interface SplashScreen {
     * <p>
     * To reset to the default theme, set this the themeId to {@link Resources#ID_NULL}.
     * <p>
     * <b>Note:</b> The theme name must be stable across versions, otherwise it won't be found
     * after your application is updated.
     * <b>Note:</b> Internally, the theme name is resolved and persisted. This means that the theme
     * name must be stable across versions, otherwise it won't be found after your application is
     * updated.
     *
     * @param themeId The ID of the splashscreen theme to be used in place of the one defined in
     *                the manifest.
     */
    void setSplashScreenTheme(@StyleRes int themeId);

+51 −18
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public class ZenModeFiltering {
        if (zen == Global.ZEN_MODE_ALARMS) return false; // not an alarm
        if (zen == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS) {
            if (consolidatedPolicy.allowRepeatCallers()
                    && REPEAT_CALLERS.isRepeat(context, extras)) {
                    && REPEAT_CALLERS.isRepeat(context, extras, null)) {
                return true;
            }
            if (!consolidatedPolicy.allowCalls()) return false; // no other calls get through
@@ -215,7 +215,8 @@ public class ZenModeFiltering {
                }
                if (isCall(record)) {
                    if (policy.allowRepeatCallers()
                            && REPEAT_CALLERS.isRepeat(mContext, extras(record))) {
                            && REPEAT_CALLERS.isRepeat(
                                    mContext, extras(record), record.getPhoneNumbers())) {
                        ZenLog.traceNotIntercepted(record, "repeatCaller");
                        return false;
                    }
@@ -336,6 +337,9 @@ public class ZenModeFiltering {
        private final ArrayMap<String, Long> mOtherCalls = new ArrayMap<>();
        private int mThresholdMinutes;

        // Record all people URIs in the extras bundle as well as the provided phoneNumbers set
        // as callers. The phoneNumbers set is used to pass in any additional phone numbers
        // associated with the people URIs as separately retrieved from contacts.
        private synchronized void recordCall(Context context, Bundle extras,
                ArraySet<String> phoneNumbers) {
            setThresholdMinutes(context);
@@ -348,7 +352,13 @@ public class ZenModeFiltering {
            recordCallers(extraPeople, phoneNumbers, now);
        }

        private synchronized boolean isRepeat(Context context, Bundle extras) {
        // Determine whether any people in the provided extras bundle or phone number set is
        // a repeat caller. The extras bundle contains the people associated with a specific
        // notification, and will suffice for most callers; the phoneNumbers array may be used
        // to additionally check any specific phone numbers previously retrieved from contacts
        // associated with the people in the extras bundle.
        private synchronized boolean isRepeat(Context context, Bundle extras,
                ArraySet<String> phoneNumbers) {
            setThresholdMinutes(context);
            if (mThresholdMinutes <= 0 || extras == null) return false;
            final String[] extraPeople = ValidateNotificationPeople.getExtraPeople(extras);
@@ -356,7 +366,7 @@ public class ZenModeFiltering {
            final long now = System.currentTimeMillis();
            cleanUp(mTelCalls, now);
            cleanUp(mOtherCalls, now);
            return checkCallers(context, extraPeople);
            return checkCallers(context, extraPeople, phoneNumbers);
        }

        private synchronized void cleanUp(ArrayMap<String, Long> calls, long now) {
@@ -419,16 +429,9 @@ public class ZenModeFiltering {
            }
        }

        private synchronized boolean checkCallers(Context context, String[] people) {
            // get the default country code for checking telephone numbers
            final String defaultCountryCode =
                    context.getSystemService(TelephonyManager.class).getNetworkCountryIso();
            for (int i = 0; i < people.length; i++) {
                String person = people[i];
                if (person == null) continue;
                final Uri uri = Uri.parse(person);
                if ("tel".equals(uri.getScheme())) {
                    String number = uri.getSchemeSpecificPart();
        // helper function to check mTelCalls array for a number, and also check its decoded
        // version
        private synchronized boolean checkForNumber(String number, String defaultCountryCode) {
            if (mTelCalls.containsKey(number)) {
                // check directly via map first
                return true;
@@ -444,12 +447,42 @@ public class ZenModeFiltering {
                    }
                }
            }
            return false;
        }

        // Check whether anyone in the provided array of people URIs or phone number set matches a
        // previously recorded phone call.
        private synchronized boolean checkCallers(Context context, String[] people,
                ArraySet<String> phoneNumbers) {
            // get the default country code for checking telephone numbers
            final String defaultCountryCode =
                    context.getSystemService(TelephonyManager.class).getNetworkCountryIso();
            for (int i = 0; i < people.length; i++) {
                String person = people[i];
                if (person == null) continue;
                final Uri uri = Uri.parse(person);
                if ("tel".equals(uri.getScheme())) {
                    String number = uri.getSchemeSpecificPart();
                    if (checkForNumber(number, defaultCountryCode)) {
                        return true;
                    }
                } else {
                    if (mOtherCalls.containsKey(person)) {
                        return true;
                    }
                }
            }

            // also check any passed-in phone numbers
            if (phoneNumbers != null) {
                for (String num : phoneNumbers) {
                    if (checkForNumber(num, defaultCountryCode)) {
                        return true;
                    }
                }
            }

            // no matches
            return false;
        }
    }
+3 −2
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ public class ZenModeHelper {

    // The amount of time rules instances can exist without their owning app being installed.
    private static final int RULE_INSTANCE_GRACE_PERIOD = 1000 * 60 * 60 * 72;
    static final int RULE_LIMIT_PER_PACKAGE = 100;

    // pkg|userId => uid
    protected final ArrayMap<String, Integer> mRulesUidCache = new ArrayMap<>();
@@ -325,10 +326,10 @@ public class ZenModeHelper {
            int newRuleInstanceCount = getCurrentInstanceCount(automaticZenRule.getOwner())
                    + getCurrentInstanceCount(automaticZenRule.getConfigurationActivity())
                    + 1;
            if (ruleInstanceLimit > 0 && ruleInstanceLimit < newRuleInstanceCount) {
            if (newRuleInstanceCount > RULE_LIMIT_PER_PACKAGE
                    || (ruleInstanceLimit > 0 && ruleInstanceLimit < newRuleInstanceCount)) {
                throw new IllegalArgumentException("Rule instance limit exceeded");
            }

        }

        ZenModeConfig newConfig;
+12 −2
Original line number Diff line number Diff line
@@ -971,9 +971,19 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
    }

    void setBackgroundColor(@ColorInt int colorInt) {
        setBackgroundColor(colorInt, false /* restore */);
    }

    void setBackgroundColor(@ColorInt int colorInt, boolean restore) {
        mBackgroundColor = colorInt;
        Color color = Color.valueOf(colorInt);

        // We don't want to increment the mColorLayerCounter if we are restoring the background
        // color after a surface migration because in that case the mColorLayerCounter already
        // accounts for setting that background color.
        if (!restore) {
            mColorLayerCounter++;
        }

        // Only apply the background color if the TDA is actually attached and has a valid surface
        // to set the background color on. We still want to keep track of the background color state
@@ -1002,7 +1012,7 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
        super.migrateToNewSurfaceControl(t);

        if (mColorLayerCounter > 0) {
            setBackgroundColor(mBackgroundColor);
            setBackgroundColor(mBackgroundColor, true /* restore */);
        }

        // As TaskDisplayArea is getting a new surface, reparent and reorder the child surfaces.
Loading