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

Commit 9356d6f4 authored by Lee Shombert's avatar Lee Shombert Committed by Android (Google) Code Review
Browse files

Merge "Remove TestApi annotation from PIC" into main

parents e6d5a0ae 6be42fd1
Loading
Loading
Loading
Loading
+13 −30
Original line number Diff line number Diff line
@@ -436,34 +436,6 @@ package android.app {
    ctor public PictureInPictureUiState(boolean);
  }

  public class PropertyInvalidatedCache<Query, Result> {
    ctor public PropertyInvalidatedCache(int, @NonNull String, @NonNull String, @NonNull String, @NonNull android.app.PropertyInvalidatedCache.QueryHandler<Query,Result>);
    method @NonNull public static String createPropertyName(@NonNull String, @NonNull String);
    method public void disableForCurrentProcess();
    method public static void disableForCurrentProcess(@NonNull String);
    method public static void disableForTestMode();
    method public final void disableInstance();
    method public final void disableSystemWide();
    method public final void forgetDisableLocal();
    method public boolean getDisabledState();
    method public void invalidateCache();
    method public static void invalidateCache(@NonNull String, @NonNull String);
    method public final boolean isDisabled();
    method @Nullable public Result query(@NonNull Query);
    method public static void setTestMode(boolean);
    method public void testPropertyName();
    field public static final String MODULE_BLUETOOTH = "bluetooth";
    field public static final String MODULE_SYSTEM = "system_server";
    field public static final String MODULE_TELEPHONY = "telephony";
    field public static final String MODULE_TEST = "test";
  }

  public abstract static class PropertyInvalidatedCache.QueryHandler<Q, R> {
    ctor public PropertyInvalidatedCache.QueryHandler();
    method @Nullable public abstract R apply(@NonNull Q);
    method public boolean shouldBypassCache(@NonNull Q);
  }

  public class StatusBarManager {
    method public void cancelRequestAddTile(@NonNull String);
    method public void clickNotification(@Nullable String, int, int, boolean);
@@ -2444,17 +2416,28 @@ package android.os {
    method @FlaggedApi("android.os.mainline_vcn_platform_api") public final void removeEqualMessages(int, @Nullable Object);
  }

  public class IpcDataCache<Query, Result> extends android.app.PropertyInvalidatedCache<Query,Result> {
  public class IpcDataCache<Query, Result> {
    ctor public IpcDataCache(int, @NonNull String, @NonNull String, @NonNull String, @NonNull android.os.IpcDataCache.QueryHandler<Query,Result>);
    method public void disableForCurrentProcess();
    method public static void disableForCurrentProcess(@NonNull String);
    method public final void disableInstance();
    method public final void disableSystemWide();
    method public final void forgetDisableLocal();
    method public boolean getDisabledState();
    method public void invalidateCache();
    method public static void invalidateCache(@NonNull String, @NonNull String);
    method public final boolean isDisabled();
    method @Nullable public Result query(@NonNull Query);
    method public static void setTestMode(boolean);
    field public static final String MODULE_BLUETOOTH = "bluetooth";
    field public static final String MODULE_SYSTEM = "system_server";
    field public static final String MODULE_TEST = "test";
  }

  public abstract static class IpcDataCache.QueryHandler<Q, R> extends android.app.PropertyInvalidatedCache.QueryHandler<Q,R> {
  public abstract static class IpcDataCache.QueryHandler<Q, R> {
    ctor public IpcDataCache.QueryHandler();
    method @Nullable public abstract R apply(@NonNull Q);
    method public boolean shouldBypassCache(@NonNull Q);
  }

  public final class MessageQueue {
+11 −27
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static com.android.internal.util.Preconditions.checkArgumentPositive;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.os.Binder;
import android.os.Handler;
import android.os.Looper;
@@ -77,7 +76,6 @@ import java.util.concurrent.atomic.AtomicLong;
 * @param <Result> The class holding cache entries; use a boxed primitive if possible
 * @hide
 */
@TestApi
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class PropertyInvalidatedCache<Query, Result> {
    /**
@@ -95,7 +93,6 @@ public class PropertyInvalidatedCache<Query, Result> {
     * This is a configuration class that customizes a cache instance.
     * @hide
     */
    @TestApi
    public static abstract class QueryHandler<Q,R> {
        /**
         * Compute a result given a query.  The semantics are those of Functor.
@@ -134,7 +131,6 @@ public class PropertyInvalidatedCache<Query, Result> {
     * the system has permissions to write properties with this module.
     * @hide
     */
    @TestApi
    public static final String MODULE_TEST = "test";

    /**
@@ -142,18 +138,17 @@ public class PropertyInvalidatedCache<Query, Result> {
     * the system processes.
     * @hide
     */
    @TestApi
    public static final String MODULE_SYSTEM = "system_server";

    /**
     * The module used for bluetooth caches.
     * @hide
     */
    @TestApi
    public static final String MODULE_BLUETOOTH = "bluetooth";

    /**
     * The module used for telephony caches.
     * @hide
     */
    public static final String MODULE_TELEPHONY = "telephony";

@@ -171,7 +166,6 @@ public class PropertyInvalidatedCache<Query, Result> {
     * error message.
     * @hide
     */
    @TestApi
    public static @NonNull String createPropertyName(@NonNull String module,
            @NonNull String apiName) {
        char[] api = apiName.toCharArray();
@@ -1382,7 +1376,6 @@ public class PropertyInvalidatedCache<Query, Result> {
     * @param computer The code to compute values that are not in the cache.
     * @hide
     */
    @TestApi
    public PropertyInvalidatedCache(int maxEntries, @NonNull String module, @NonNull String api,
            @NonNull String cacheName, @NonNull QueryHandler<Query, Result> computer) {
        this(new Args(module).maxEntries(maxEntries).api(api), cacheName, computer);
@@ -1409,7 +1402,7 @@ public class PropertyInvalidatedCache<Query, Result> {
     * current logic does not care.
     * @hide
     */
    @TestApi
    @VisibleForTesting
    public static void setTestMode(boolean mode) {
        synchronized (sGlobalLock) {
            if (sTestMode == mode) {
@@ -1450,7 +1443,6 @@ public class PropertyInvalidatedCache<Query, Result> {
     * must be true when this method is called.
     * @hide
     */
    @TestApi
    public void testPropertyName() {
        synchronized (sGlobalLock) {
            if (sTestMode == false) {
@@ -1542,8 +1534,8 @@ public class PropertyInvalidatedCache<Query, Result> {
     * be re-enabled.
     * @hide
     */
    @TestApi
    public final void disableInstance() {
    @VisibleForTesting
    public void disableInstance() {
        synchronized (mLock) {
            mDisabled = true;
            clear();
@@ -1579,8 +1571,8 @@ public class PropertyInvalidatedCache<Query, Result> {
     * found in the list of disabled caches.
     * @hide
     */
    @TestApi
    public final void forgetDisableLocal() {
    @VisibleForTesting
    public void forgetDisableLocal() {
        synchronized (sGlobalLock) {
            sDisabledKeys.remove(mCacheName);
        }
@@ -1603,13 +1595,11 @@ public class PropertyInvalidatedCache<Query, Result> {
     * property.  Once disabled, a cache cannot be reenabled.
     * @hide
     */
    @TestApi
    public void disableForCurrentProcess() {
        disableLocal(mCacheName);
    }

    /** @hide */
    @TestApi
    public static void disableForCurrentProcess(@NonNull String cacheName) {
        disableLocal(cacheName);
    }
@@ -1618,8 +1608,8 @@ public class PropertyInvalidatedCache<Query, Result> {
     * Return whether a cache instance is disabled.
     * @hide
     */
    @TestApi
    public final boolean isDisabled() {
    @VisibleForTesting
    public boolean isDisabled() {
        return mDisabled || !sEnabled;
    }

@@ -1627,7 +1617,6 @@ public class PropertyInvalidatedCache<Query, Result> {
     * Get a value from the cache or recompute it.
     * @hide
     */
    @TestApi
    public @Nullable Result query(@NonNull Query query) {
        // Let access to mDisabled race: it's atomic anyway.
        long currentNonce = (!isDisabled()) ? getCurrentNonce() : NONCE_DISABLED;
@@ -1767,8 +1756,8 @@ public class PropertyInvalidatedCache<Query, Result> {
     * just use the static version of this function.
     * @hide
     */
    @TestApi
    public final void disableSystemWide() {
    @VisibleForTesting
    public void disableSystemWide() {
        disableSystemWide(mPropertyName);
    }

@@ -1788,7 +1777,6 @@ public class PropertyInvalidatedCache<Query, Result> {
     * to look up the NonceHandler for a given property name.
     * @hide
     */
    @TestApi
    public void invalidateCache() {
        mNonce.invalidate();
    }
@@ -1817,7 +1805,6 @@ public class PropertyInvalidatedCache<Query, Result> {
     * Invalidate caches in all processes that are keyed for the module and api.
     * @hide
     */
    @TestApi
    public static void invalidateCache(@NonNull String module, @NonNull String api) {
        invalidateCache(createPropertyName(module, api));
    }
@@ -2059,7 +2046,6 @@ public class PropertyInvalidatedCache<Query, Result> {
     * temporarily disable caching, use the corking mechanism.
     * @hide
     */
    @TestApi
    public static void disableForTestMode() {
        Log.d(TAG, "disabling all caches in the process");
        sEnabled = false;
@@ -2068,10 +2054,8 @@ public class PropertyInvalidatedCache<Query, Result> {
    /**
     * Report the disabled status of this cache instance.  The return value does not
     * reflect status of the property key.
     * @hide
     */
    @TestApi
    public boolean getDisabledState() {
    private boolean getDisabledState() {
        return isDisabled();
    }

+70 −0
Original line number Diff line number Diff line
@@ -658,4 +658,74 @@ public class IpcDataCache<Query, Result> extends PropertyInvalidatedCache<Query,
            }
        });
    }

    /**
     * The following APIs are exposed to support testing.  They only forward the superclass but
     * that means the superclass does not have to expose the APIs itself.
     */

    /**
     * Stop disabling local caches with the same name as <this>.  Any caches that are currently
     * disabled remain disabled (the "disabled" setting is sticky).  However, new caches with this
     * name will not be disabled.  It is not an error if the cache name is not found in the list
     * of disabled caches.
     * @hide
     */
    @TestApi
    @Override
    public final void forgetDisableLocal() {
        super.forgetDisableLocal();
    }

    /**
     * Return whether a cache instance is disabled.
     * @hide
     */
    @TestApi
    @Override
    public final boolean isDisabled() {
        return super.isDisabled();
    }

    /**
     * This is an obsolete synonym for {@link #isDisabled()}.
     * @hide
     */
    @TestApi
    public boolean getDisabledState() {
        return isDisabled();
    }

    /**
     * Disable the use of this cache in this process.  This method is used internally and during
     * testing.  To disable a cache in normal code, use disableProcessLocal().
     * @hide
     */
    @TestApi
    @Override
    public final void disableInstance() {
        super.disableInstance();
    }

    /**
     * Disable all caches that use the property as the current cache.
     * @hide
     */
    @TestApi
    @Override
    public final void disableSystemWide() {
        super.disableSystemWide();
    }

    /**
     * Enable or disable testing.  The protocol requires that the mode toggle: for instance, it is
     * illegal to clear the test mode if the test mode is already off.  The purpose is solely to
     * ensure that test clients do not forget to use the test mode properly, even though the
     * current logic does not care.
     * @hide
     */
    @TestApi
    public static void setTestMode(boolean mode) {
        PropertyInvalidatedCache.setTestMode(mode);
    }
}