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

Commit 80860803 authored by Xin Li's avatar Xin Li
Browse files

DO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5713463) into stage-aosp-master

Bug: 134405016
Change-Id: I303c0268e8e454b0f0f460eb286812a50c9add88
parents 5f00bf12 7922ef60
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2313,6 +2313,7 @@ package android.provider {
  }

  public static interface DeviceConfig.WindowManager {
    field public static final String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE = "system_gestures_excluded_by_pre_q_sticky_immersive";
    field public static final String KEY_SYSTEM_GESTURE_EXCLUSION_LIMIT_DP = "system_gesture_exclusion_limit_dp";
  }

+7 −5
Original line number Diff line number Diff line
@@ -2507,7 +2507,7 @@ public class AppOpsManager {
        }

        /**
         * @return The duration of the operation in milliseconds.
         * @return The duration of the operation in milliseconds. The duration is in wall time.
         */
        public long getDuration() {
            return getLastDuration(MAX_PRIORITY_UID_STATE, MIN_PRIORITY_UID_STATE, OP_FLAGS_ALL);
@@ -2515,7 +2515,7 @@ public class AppOpsManager {

        /**
         * Return the duration in milliseconds the app accessed this op while
         * in the foreground.
         * in the foreground. The duration is in wall time.
         *
         * @param flags The flags which are any combination of
         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
@@ -2534,7 +2534,7 @@ public class AppOpsManager {

        /**
         * Return the duration in milliseconds the app accessed this op while
         * in the background.
         * in the background. The duration is in wall time.
         *
         * @param flags The flags which are any combination of
         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
@@ -2553,7 +2553,7 @@ public class AppOpsManager {

        /**
         * Return the duration in milliseconds the app accessed this op for
         * a given range of UID states.
         * a given range of UID states. The duration is in wall time.
         *
         * @param fromUidState The UID state for which to query. Could be one of
         * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP},
@@ -3968,6 +3968,7 @@ public class AppOpsManager {

        /**
         * Gets the total duration the app op was accessed (performed) in the foreground.
         * The duration is in wall time.
         *
         * @param flags The flags which are any combination of
         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
@@ -3986,6 +3987,7 @@ public class AppOpsManager {

        /**
         * Gets the total duration the app op was accessed (performed) in the background.
         * The duration is in wall time.
         *
         * @param flags The flags which are any combination of
         * {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXY},
@@ -4004,7 +4006,7 @@ public class AppOpsManager {

        /**
         * Gets the total duration the app op was accessed (performed) for a given
         * range of UID states.
         * range of UID states. The duration is in wall time.
         *
         * @param fromUidState The UID state from which to query. Could be one of
         * {@link #UID_STATE_PERSISTENT}, {@link #UID_STATE_TOP},
+11 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.app.servertransaction;

import static android.app.servertransaction.ActivityLifecycleItem.ON_RESUME;
import static android.app.servertransaction.ActivityLifecycleItem.UNDEFINED;

import android.annotation.UnsupportedAppUsage;
import android.app.ClientTransactionHandler;
@@ -38,10 +39,11 @@ public class NewIntentItem extends ClientTransactionItem {

    @UnsupportedAppUsage
    private List<ReferrerIntent> mIntents;
    private boolean mResume;

    @Override
    public int getPostExecutionState() {
        return ON_RESUME;
        return mResume ? ON_RESUME : UNDEFINED;
    }

    @Override
@@ -58,12 +60,13 @@ public class NewIntentItem extends ClientTransactionItem {
    private NewIntentItem() {}

    /** Obtain an instance initialized with provided params. */
    public static NewIntentItem obtain(List<ReferrerIntent> intents) {
    public static NewIntentItem obtain(List<ReferrerIntent> intents, boolean resume) {
        NewIntentItem instance = ObjectPool.obtain(NewIntentItem.class);
        if (instance == null) {
            instance = new NewIntentItem();
        }
        instance.mIntents = intents;
        instance.mResume = resume;

        return instance;
    }
@@ -71,6 +74,7 @@ public class NewIntentItem extends ClientTransactionItem {
    @Override
    public void recycle() {
        mIntents = null;
        mResume = false;
        ObjectPool.recycle(this);
    }

@@ -80,11 +84,13 @@ public class NewIntentItem extends ClientTransactionItem {
    /** Write to Parcel. */
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeBoolean(mResume);
        dest.writeTypedList(mIntents, flags);
    }

    /** Read from Parcel. */
    private NewIntentItem(Parcel in) {
        mResume = in.readBoolean();
        mIntents = in.createTypedArrayList(ReferrerIntent.CREATOR);
    }

@@ -108,18 +114,19 @@ public class NewIntentItem extends ClientTransactionItem {
            return false;
        }
        final NewIntentItem other = (NewIntentItem) o;
        return Objects.equals(mIntents, other.mIntents);
        return mResume == other.mResume && Objects.equals(mIntents, other.mIntents);
    }

    @Override
    public int hashCode() {
        int result = 17;
        result = 31 * result + (mResume ? 1 : 0);
        result = 31 * result + mIntents.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "NewIntentItem{intents=" + mIntents + "}";
        return "NewIntentItem{intents=" + mIntents + ",resume=" + mResume + "}";
    }
}
+20 −39
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.content.pm;

import android.Manifest;
import android.annotation.Nullable;
import android.annotation.UnsupportedAppUsage;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -177,8 +176,7 @@ public abstract class RegisteredServicesCache<V> {
        mContext.registerReceiver(mUserRemovedReceiver, userFilter);
    }

    @VisibleForTesting
    protected void handlePackageEvent(Intent intent, int userId) {
    private void handlePackageEvent(Intent intent, int userId) {
        // Don't regenerate the services map when the package is removed or its
        // ASEC container unmounted as a step in replacement.  The subsequent
        // _ADDED / _AVAILABLE call will regenerate the map in the final state.
@@ -240,9 +238,6 @@ public abstract class RegisteredServicesCache<V> {

    public void invalidateCache(int userId) {
        synchronized (mServicesLock) {
            if (DEBUG) {
                Slog.d(TAG, "invalidating cache for " + userId + " " + mInterfaceName);
            }
            final UserServices<V> user = findOrCreateUserLocked(userId);
            user.services = null;
            onServicesChangedLocked(userId);
@@ -472,37 +467,16 @@ public abstract class RegisteredServicesCache<V> {
     *                    or null to assume that everything is affected.
     * @param userId the user for whom to update the services map.
     */
    private void generateServicesMap(@Nullable int[] changedUids, int userId) {
    private void generateServicesMap(int[] changedUids, int userId) {
        if (DEBUG) {
            Slog.d(TAG, "generateServicesMap() for " + userId + ", changed UIDs = "
                    + Arrays.toString(changedUids));
        }

        synchronized (mServicesLock) {
            final UserServices<V> user = findOrCreateUserLocked(userId);
            final boolean cacheInvalid = user.services == null;
            if (cacheInvalid) {
                user.services = Maps.newHashMap();
            }

        final ArrayList<ServiceInfo<V>> serviceInfos = new ArrayList<>();
        final List<ResolveInfo> resolveInfos = queryIntentServices(userId);

        for (ResolveInfo resolveInfo : resolveInfos) {
            try {
                    // when changedUids == null, we want to do a rescan of everything, this means
                    // it's the initial scan, and containsUid will trivially return true
                    // when changedUids != null, we got here because a package changed, but
                    // invalidateCache could have been called (thus user.services == null), and we
                    // should query from PackageManager again
                    if (!cacheInvalid
                            && !containsUid(
                                    changedUids, resolveInfo.serviceInfo.applicationInfo.uid)) {
                        if (DEBUG) {
                            Slog.d(TAG, "Skipping parseServiceInfo for " + resolveInfo);
                        }
                        continue;
                    }
                ServiceInfo<V> info = parseServiceInfo(resolveInfo);
                if (info == null) {
                    Log.w(TAG, "Unable to load service info " + resolveInfo.toString());
@@ -514,6 +488,13 @@ public abstract class RegisteredServicesCache<V> {
            }
        }

        synchronized (mServicesLock) {
            final UserServices<V> user = findOrCreateUserLocked(userId);
            final boolean firstScan = user.services == null;
            if (firstScan) {
                user.services = Maps.newHashMap();
            }

            StringBuilder changes = new StringBuilder();
            boolean changed = false;
            for (ServiceInfo<V> info : serviceInfos) {
@@ -534,7 +515,7 @@ public abstract class RegisteredServicesCache<V> {
                    changed = true;
                    user.services.put(info.type, info);
                    user.persistentServices.put(info.type, info.uid);
                    if (!(user.mPersistentServicesFileDidNotExist && cacheInvalid)) {
                    if (!(user.mPersistentServicesFileDidNotExist && firstScan)) {
                        notifyListener(info.type, userId, false /* removed */);
                    }
                } else if (previousUid == info.uid) {
+11 −0
Original line number Diff line number Diff line
@@ -325,6 +325,17 @@ public final class DeviceConfig {
         */
        @TestApi
        String KEY_SYSTEM_GESTURE_EXCLUSION_LIMIT_DP = "system_gesture_exclusion_limit_dp";

        /**
         * Key for controlling whether system gestures are implicitly excluded by windows requesting
         * sticky immersive mode from apps that are targeting an SDK prior to Q.
         *
         * @see android.provider.DeviceConfig#NAMESPACE_WINDOW_MANAGER
         * @hide
         */
        @TestApi
        String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE =
                "system_gestures_excluded_by_pre_q_sticky_immersive";
    }

    private static final Object sLock = new Object();
Loading