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

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

Snap for 12122529 from 2649194f to 24Q4-release

Change-Id: Iee3c1608fc4a885a92fb076982bac8fb56dab120
parents e5ba99d3 2649194f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -242,6 +242,12 @@ cc_aconfig_library {
    aconfig_declarations: "com.android.text.flags-aconfig",
}

rust_aconfig_library {
    name: "libandroid_text_flags_rust",
    crate_name: "android_text_flags",
    aconfig_declarations: "com.android.text.flags-aconfig",
}

// Location
aconfig_declarations {
    name: "android.location.flags-aconfig",
+18 −49
Original line number Diff line number Diff line
@@ -16,70 +16,39 @@

package android.app.servertransaction;

import com.android.window.flags.Flags;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * An object pool that can provide reused objects if available.
 *
 * @hide
 * @deprecated This class is deprecated. Directly create new instances of objects instead of
 * obtaining them from this pool.
 * TODO(b/311089192): Clean up usages of the pool.
 */
@Deprecated
class ObjectPool {

    private static final Object sPoolSync = new Object();
    private static final Map<Class, ArrayList<? extends ObjectPoolItem>> sPoolMap =
            new HashMap<>();

    private static final int MAX_POOL_SIZE = 50;

    /**
     * Obtain an instance of a specific class from the pool
     * @param itemClass The class of the object we're looking for.
     *
     * @param ignoredItemClass The class of the object we're looking for.
     * @return An instance or null if there is none.
     * @deprecated This method is deprecated. Directly create new instances of objects instead of
     * obtaining them from this pool.
     */
    public static <T extends ObjectPoolItem> T obtain(Class<T> itemClass) {
        if (Flags.disableObjectPool()) {
            return null;
        }
        synchronized (sPoolSync) {
            @SuppressWarnings("unchecked")
            final ArrayList<T> itemPool = (ArrayList<T>) sPoolMap.get(itemClass);
            if (itemPool != null && !itemPool.isEmpty()) {
                return itemPool.remove(itemPool.size() - 1);
            }
    @Deprecated
    public static <T extends ObjectPoolItem> T obtain(Class<T> ignoredItemClass) {
        return null;
    }
    }

    /**
     * Recycle the object to the pool. The object should be properly cleared before this.
     * @param item The object to recycle.
     *
     * @param ignoredItem The object to recycle.
     * @see ObjectPoolItem#recycle()
     * @deprecated This method is deprecated. The object pool is no longer used, so there's
     * no need to recycle objects.
     */
    public static <T extends ObjectPoolItem> void recycle(T item) {
        if (Flags.disableObjectPool()) {
            return;
        }
        synchronized (sPoolSync) {
            @SuppressWarnings("unchecked")
            ArrayList<T> itemPool = (ArrayList<T>) sPoolMap.get(item.getClass());
            if (itemPool == null) {
                itemPool = new ArrayList<>();
                sPoolMap.put(item.getClass(), itemPool);
            }
            // Check if the item is already in the pool
            final int size = itemPool.size();
            for (int i = 0; i < size; i++) {
                if (itemPool.get(i) == item) {
                    throw new IllegalStateException("Trying to recycle already recycled item");
                }
            }

            if (size < MAX_POOL_SIZE) {
                itemPool.add(item);
            }
        }
    @Deprecated
    public static <T extends ObjectPoolItem> void recycle(T ignoredItem) {
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -18,12 +18,20 @@ package android.app.servertransaction;

/**
 * Base interface for all lifecycle items that can be put in object pool.
 *
 * @hide
 * @deprecated This interface is deprecated. Objects should no longer be pooled.
 * TODO(b/311089192): Clean up usages of this interface.
 */
@Deprecated
public interface ObjectPoolItem {
    /**
     * Clear the contents of the item and putting it to a pool. The implementation should call
     * {@link ObjectPool#recycle(ObjectPoolItem)} passing itself.
     *
     * @deprecated This method is deprecated. The object pool is no longer used, so there's
     * no need to recycle objects.
     */
    @Deprecated
    void recycle();
}
+2 −2
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ public final class ServiceManager {
            if (service != null) {
                return service;
            } else {
                return Binder.allowBlocking(getIServiceManager().checkService(name));
                return Binder.allowBlocking(getIServiceManager().checkService(name).getBinder());
            }
        } catch (RemoteException e) {
            Log.e(TAG, "error in checkService", e);
@@ -425,7 +425,7 @@ public final class ServiceManager {
    private static IBinder rawGetService(String name) throws RemoteException {
        final long start = sStatLogger.getTime();

        final IBinder binder = getIServiceManager().getService(name);
        final IBinder binder = getIServiceManager().getService(name).getBinder();

        final int time = (int) sStatLogger.logDurationStat(Stats.GET_SERVICE, start);

+3 −3
Original line number Diff line number Diff line
@@ -58,12 +58,12 @@ class ServiceManagerProxy implements IServiceManager {
    }

    @UnsupportedAppUsage
    public IBinder getService(String name) throws RemoteException {
    public Service getService(String name) throws RemoteException {
        // Same as checkService (old versions of servicemanager had both methods).
        return mServiceManager.checkService(name);
        return checkService(name);
    }

    public IBinder checkService(String name) throws RemoteException {
    public Service checkService(String name) throws RemoteException {
        return mServiceManager.checkService(name);
    }

Loading