Loading AconfigFlags.bp +6 −0 Original line number Diff line number Diff line Loading @@ -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", Loading core/java/android/app/servertransaction/ObjectPool.java +18 −49 Original line number Diff line number Diff line Loading @@ -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) { } } core/java/android/app/servertransaction/ObjectPoolItem.java +8 −0 Original line number Diff line number Diff line Loading @@ -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(); } core/java/android/os/ServiceManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading core/java/android/os/ServiceManagerNative.java +3 −3 Original line number Diff line number Diff line Loading @@ -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 Loading
AconfigFlags.bp +6 −0 Original line number Diff line number Diff line Loading @@ -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", Loading
core/java/android/app/servertransaction/ObjectPool.java +18 −49 Original line number Diff line number Diff line Loading @@ -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) { } }
core/java/android/app/servertransaction/ObjectPoolItem.java +8 −0 Original line number Diff line number Diff line Loading @@ -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(); }
core/java/android/os/ServiceManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading
core/java/android/os/ServiceManagerNative.java +3 −3 Original line number Diff line number Diff line Loading @@ -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