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

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

DO NOT MERGE - Merge pi-platform-release (PPRL.190505.001) into stage-aosp-master

Bug: 132622481
Change-Id: I7ba1a9999b3a9bac8031dd086fa2632e45404f32
parents 3af50a60 7c2cd6a1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 * <p>For more information about using a ContentResolver with content providers, read the
 * <a href="{@docRoot}guide/topics/providers/content-providers.html">Content Providers</a>
 * developer guide.</p>
 * </div>
 */
public abstract class ContentResolver {
    /**
+39 −20
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.content.pm;

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

    private final void handlePackageEvent(Intent intent, int userId) {
    @VisibleForTesting
    protected 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.
@@ -238,6 +240,9 @@ 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);
@@ -465,16 +470,37 @@ 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(int[] changedUids, int userId) {
    private void generateServicesMap(@Nullable 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());
@@ -486,13 +512,6 @@ 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) {
@@ -513,7 +532,7 @@ public abstract class RegisteredServicesCache<V> {
                    changed = true;
                    user.services.put(info.type, info);
                    user.persistentServices.put(info.type, info.uid);
                    if (!(user.mPersistentServicesFileDidNotExist && firstScan)) {
                    if (!(user.mPersistentServicesFileDidNotExist && cacheInvalid)) {
                        notifyListener(info.type, userId, false /* removed */);
                    }
                } else if (previousUid == info.uid) {
+0 −2
Original line number Diff line number Diff line
@@ -233,8 +233,6 @@ public class Build {
         * increase when the hardware manufacturer provides an OTA update.
         * <p>
         * Possible values are defined in {@link Build.VERSION_CODES}.
         *
         * @see #FIRST_SDK_INT
         */
        public static final int SDK_INT = SystemProperties.getInt(
                "ro.build.version.sdk", 0);
+2 −2
Original line number Diff line number Diff line
@@ -70,10 +70,10 @@ public class ScheduleCalendar {
            }
            // only allow alarms in the future
            if (nextAlarm > now) {
                // store earliest alarm
                if (mSchedule.nextAlarm == 0) {
                if (mSchedule.nextAlarm == 0 || mSchedule.nextAlarm < now) {
                    mSchedule.nextAlarm = nextAlarm;
                } else {
                    // store earliest alarm
                    mSchedule.nextAlarm = Math.min(mSchedule.nextAlarm, nextAlarm);
                }
            } else if (mSchedule.nextAlarm < now) {
+14 −7
Original line number Diff line number Diff line
@@ -1378,6 +1378,9 @@ public final class ViewRootImpl implements ViewParent,
            }

            if (mStopped) {
                if (mSurfaceHolder != null) {
                    notifySurfaceDestroyed();
                }
                mSurface.release();
            }
        }
@@ -2252,13 +2255,7 @@ public final class ViewRootImpl implements ViewParent,
                    }
                    mIsCreating = false;
                } else if (hadSurface) {
                    mSurfaceHolder.ungetCallbacks();
                    SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks();
                    if (callbacks != null) {
                        for (SurfaceHolder.Callback c : callbacks) {
                            c.surfaceDestroyed(mSurfaceHolder);
                        }
                    }
                    notifySurfaceDestroyed();
                    mSurfaceHolder.mSurfaceLock.lock();
                    try {
                        mSurfaceHolder.mSurface = new Surface();
@@ -2522,6 +2519,16 @@ public final class ViewRootImpl implements ViewParent,
        mIsInTraversal = false;
    }

    private void notifySurfaceDestroyed() {
        mSurfaceHolder.ungetCallbacks();
        SurfaceHolder.Callback[] callbacks = mSurfaceHolder.getCallbacks();
        if (callbacks != null) {
            for (SurfaceHolder.Callback c : callbacks) {
                c.surfaceDestroyed(mSurfaceHolder);
            }
        }
    }

    private void maybeHandleWindowMove(Rect frame) {

        // TODO: Well, we are checking whether the frame has changed similarly
Loading