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

Commit ee7eea32 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Support android.database for Ravenwood, with CTS." into main

parents 1b0b5d5a 2acaa723
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -33,11 +33,11 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;


/**
 * This is an abstract cursor class that handles a lot of the common code
 * that all cursors need to deal with and is provided for convenience reasons.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public abstract class AbstractCursor implements CrossProcessCursor {
    private static final String TAG = "Cursor";

@@ -89,7 +89,7 @@ public abstract class AbstractCursor implements CrossProcessCursor {
    private Bundle mExtras = Bundle.EMPTY;

    /** CloseGuard to detect leaked cursor **/
    private final CloseGuard mCloseGuard = CloseGuard.get();
    private final CloseGuard mCloseGuard;

    /* -------------------------------------------------------- */
    /* These need to be implemented by subclasses */
@@ -184,8 +184,10 @@ public abstract class AbstractCursor implements CrossProcessCursor {
        mClosed = true;
        mContentObservable.unregisterAll();
        onDeactivateOrClose();
        if (mCloseGuard != null) {
            mCloseGuard.close();
        }
    }

    /**
     * This function is called every time the cursor is successfully scrolled
@@ -224,8 +226,20 @@ public abstract class AbstractCursor implements CrossProcessCursor {
    /* Implementation */
    public AbstractCursor() {
        mPos = -1;
        mCloseGuard = initCloseGuard();
        if (mCloseGuard != null) {
            mCloseGuard.open("AbstractCursor.close");
        }
    }

    @android.ravenwood.annotation.RavenwoodReplace
    private CloseGuard initCloseGuard() {
        return CloseGuard.get();
    }

    private CloseGuard initCloseGuard$ravenwood() {
        return null;
    }

    @Override
    public final int getPosition() {
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.database;
/**
 * This is used for {@link Cursor#copyStringToBuffer}
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public final class CharArrayBuffer {
    public CharArrayBuffer(int size) {
        data = new char[size];
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.net.Uri;
 * that provides methods for sending notifications to a list of
 * {@link ContentObserver} objects.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class ContentObservable extends Observable<ContentObserver> {
    // Even though the generic method defined in Observable would be perfectly
    // fine on its own, we can't delete this overridden method because it would
+11 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import java.util.Collection;
 * Receives call backs for changes to content.
 * Must be implemented by objects which are added to a {@link ContentObservable}.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public abstract class ContentObserver {
    /**
     * Starting in {@link android.os.Build.VERSION_CODES#R}, there is a new
@@ -49,7 +50,6 @@ public abstract class ContentObserver {
    @ChangeId
    @EnabledAfter(targetSdkVersion=android.os.Build.VERSION_CODES.Q)
    private static final long ADD_CONTENT_OBSERVER_FLAGS = 150939131L;

    private final Object mLock = new Object();
    private Transport mTransport; // guarded by mLock

@@ -216,7 +216,7 @@ public abstract class ContentObserver {
        // There are dozens of people relying on the hidden API inside the
        // system UID, so hard-code the old behavior for all of them; for
        // everyone else we gate based on a specific change
        if (!CompatChanges.isChangeEnabled(ADD_CONTENT_OBSERVER_FLAGS)
        if (!isChangeEnabledAddContentObserverFlags()
                || android.os.Process.myUid() == android.os.Process.SYSTEM_UID) {
            // Deliver userId through argument to preserve hidden API behavior
            onChange(selfChange, uris, flags, UserHandle.of(userId));
@@ -225,6 +225,15 @@ public abstract class ContentObserver {
        }
    }

    @android.ravenwood.annotation.RavenwoodReplace
    private static boolean isChangeEnabledAddContentObserverFlags() {
        return CompatChanges.isChangeEnabled(ADD_CONTENT_OBSERVER_FLAGS);
    }

    private static boolean isChangeEnabledAddContentObserverFlags$ravenwood() {
        return true;
    }

    /**
     * Dispatches a change notification to the observer.
     * <p>
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import java.util.List;
 * Implementations should subclass {@link AbstractCursor}.
 * </p>
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public interface Cursor extends Closeable {
    /*
     * Values returned by {@link #getType(int)}.
Loading