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

Commit 97b471bd authored by Dmitri Plotnikov's avatar Dmitri Plotnikov Committed by Android (Google) Code Review
Browse files

Merge "Enable CursorWindow for Ravenwood" into main

parents dc28da2e 62b54d65
Loading
Loading
Loading
Loading
+22 −9
Original line number Diff line number Diff line
@@ -22,14 +22,8 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.content.res.Resources;
import android.database.sqlite.SQLiteClosable;
import android.database.sqlite.SQLiteException;
import android.os.Binder;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Process;
import android.util.Log;
import android.util.LongSparseArray;
import android.util.SparseIntArray;

import dalvik.annotation.optimization.FastNative;
import dalvik.system.CloseGuard;
@@ -44,6 +38,9 @@ import dalvik.system.CloseGuard;
 * consumer for reading.
 * </p>
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
@android.ravenwood.annotation.RavenwoodNativeSubstitutionClass(
        "com.android.hoststubgen.nativesubstitution.CursorWindow_host")
public class CursorWindow extends SQLiteClosable implements Parcelable {
    private static final String STATS_TAG = "CursorWindowStats";

@@ -61,7 +58,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
    private int mStartPos;
    private final String mName;

    private final CloseGuard mCloseGuard = CloseGuard.get();
    private final CloseGuard mCloseGuard;

    // May throw CursorWindowAllocationException
    private static native long nativeCreate(String name, int cursorWindowSize);
@@ -147,7 +144,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
        if (mWindowPtr == 0) {
            throw new AssertionError(); // Not possible, the native code won't return it.
        }
        mCloseGuard.open("CursorWindow.close");
        mCloseGuard = createCloseGuard();
    }

    /**
@@ -175,7 +172,18 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
            throw new AssertionError(); // Not possible, the native code won't return it.
        }
        mName = nativeGetName(mWindowPtr);
        mCloseGuard.open("CursorWindow.close");
        mCloseGuard = createCloseGuard();
    }

    @android.ravenwood.annotation.RavenwoodReplace
    private CloseGuard createCloseGuard() {
        final CloseGuard closeGuard = CloseGuard.get();
        closeGuard.open("CursorWindow.close");
        return closeGuard;
    }

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

    @Override
@@ -749,6 +757,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
        dispose();
    }

    @android.ravenwood.annotation.RavenwoodReplace
    private static int getCursorWindowSize() {
        if (sCursorWindowSize < 0) {
            // The cursor window size. resource xml file specifies the value in kB.
@@ -759,6 +768,10 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
        return sCursorWindowSize;
    }

    private static int getCursorWindowSize$ravenwood() {
        return 1024;
    }

    @Override
    public String toString() {
        return getName() + " {" + Long.toHexString(mWindowPtr) + "}";
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.database;
/**
 * An exception that indicates there was an error with SQL parsing or execution.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class SQLException extends RuntimeException {
    public SQLException() {
    }
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import java.io.Closeable;
 *
 * This class implements a primitive reference counting scheme for database objects.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public abstract class SQLiteClosable implements Closeable {
    @UnsupportedAppUsage
    private int mReferenceCount = 1;
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.database.SQLException;
/**
 * A SQLite exception that indicates there was an error with SQL parsing or execution.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class SQLiteException extends SQLException {
    public SQLiteException() {
    }
+3 −1
Original line number Diff line number Diff line
@@ -202,12 +202,14 @@ android_ravenwood_test {
        "testng",
    ],
    srcs: [
        "src/android/database/CursorWindowTest.java",
        "src/android/os/**/*.java",
        "src/com/android/internal/os/**/*.java",
        "src/android/util/**/*.java",
        "src/com/android/internal/os/**/*.java",
        "src/com/android/internal/os/LongArrayMultiStateCounterTest.java",
        "src/com/android/internal/util/**/*.java",
        "src/com/android/internal/power/EnergyConsumerStatsTest.java",

        ":FrameworksCoreTests{.aapt.srcjar}",
        ":FrameworksCoreTests-aidl",
        ":FrameworksCoreTests-helpers",
Loading