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

Commit 8999bdc6 authored by Jason Sams's avatar Jason Sams Committed by Android (Google) Code Review
Browse files

Merge "Add flags to context creation for RS"

parents b4669777 26e90519
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -24584,6 +24584,7 @@ package android.renderscript {
    method public void contextDump();
    method public void contextDump();
    method public static android.renderscript.RenderScript create(android.content.Context);
    method public static android.renderscript.RenderScript create(android.content.Context);
    method public static android.renderscript.RenderScript create(android.content.Context, android.renderscript.RenderScript.ContextType);
    method public static android.renderscript.RenderScript create(android.content.Context, android.renderscript.RenderScript.ContextType);
    method public static android.renderscript.RenderScript create(android.content.Context, android.renderscript.RenderScript.ContextType, long);
    method public void destroy();
    method public void destroy();
    method public void finish();
    method public void finish();
    method public final android.content.Context getApplicationContext();
    method public final android.content.Context getApplicationContext();
@@ -24593,6 +24594,9 @@ package android.renderscript {
    method public void setErrorHandler(android.renderscript.RenderScript.RSErrorHandler);
    method public void setErrorHandler(android.renderscript.RenderScript.RSErrorHandler);
    method public void setMessageHandler(android.renderscript.RenderScript.RSMessageHandler);
    method public void setMessageHandler(android.renderscript.RenderScript.RSMessageHandler);
    method public void setPriority(android.renderscript.RenderScript.Priority);
    method public void setPriority(android.renderscript.RenderScript.Priority);
    field public static final long CREATE_FLAG_LOW_LATENCY = 1L; // 0x1L
    field public static final long CREATE_FLAG_LOW_POWER = 2L; // 0x2L
    field public static final long CREATE_FLAG_NONE = 0L; // 0x0L
  }
  }
  public static final class RenderScript.ContextType extends java.lang.Enum {
  public static final class RenderScript.ContextType extends java.lang.Enum {
+36 −3
Original line number Original line Diff line number Diff line
@@ -63,6 +63,25 @@ public class RenderScript {
    static Method registerNativeAllocation;
    static Method registerNativeAllocation;
    static Method registerNativeFree;
    static Method registerNativeFree;


    /*
     * Context creation flag which specifies a normal context.
    */
    public static final long CREATE_FLAG_NONE = 0x0000;

    /*
     * Context creation flag which specifies a context optimized for low
     * latency over peak performance. This is a hint and may have no effect
     * on some implementations.
    */
    public static final long CREATE_FLAG_LOW_LATENCY = 0x0001;

    /*
     * Context creation flag which specifies a context optimized for long
     * battery life over peak performance. This is a hint and may have no effect
     * on some implementations.
    */
    public static final long CREATE_FLAG_LOW_POWER = 0x0002;

    static {
    static {
        sInitialized = false;
        sInitialized = false;
        if (!SystemProperties.getBoolean("config.disable_renderscript", false)) {
        if (!SystemProperties.getBoolean("config.disable_renderscript", false)) {
@@ -1145,7 +1164,7 @@ public class RenderScript {
     * @hide
     * @hide
     */
     */
    public static RenderScript create(Context ctx, int sdkVersion) {
    public static RenderScript create(Context ctx, int sdkVersion) {
        return create(ctx, sdkVersion, ContextType.NORMAL);
        return create(ctx, sdkVersion, ContextType.NORMAL, CREATE_FLAG_NONE);
    }
    }


    /**
    /**
@@ -1155,7 +1174,7 @@ public class RenderScript {
     * @param ctx The context.
     * @param ctx The context.
     * @return RenderScript
     * @return RenderScript
     */
     */
    public static RenderScript create(Context ctx, int sdkVersion, ContextType ct) {
    public static RenderScript create(Context ctx, int sdkVersion, ContextType ct, long flags) {
        if (!sInitialized) {
        if (!sInitialized) {
            Log.e(LOG_TAG, "RenderScript.create() called when disabled; someone is likely to crash");
            Log.e(LOG_TAG, "RenderScript.create() called when disabled; someone is likely to crash");
            return null;
            return null;
@@ -1194,7 +1213,21 @@ public class RenderScript {
     */
     */
    public static RenderScript create(Context ctx, ContextType ct) {
    public static RenderScript create(Context ctx, ContextType ct) {
        int v = ctx.getApplicationInfo().targetSdkVersion;
        int v = ctx.getApplicationInfo().targetSdkVersion;
        return create(ctx, v, ct);
        return create(ctx, v, ct, CREATE_FLAG_NONE);
    }

     /**
     * Create a RenderScript context.
     *
     *
     * @param ctx The context.
     * @param ct The type of context to be created.
     * @param flags The OR of the CREATE_FLAG_* options desired
     * @return RenderScript
     */
    public static RenderScript create(Context ctx, ContextType ct, long flags) {
        int v = ctx.getApplicationInfo().targetSdkVersion;
        return create(ctx, v, ct, flags);
    }
    }


    /**
    /**