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

Commit 15b86c90 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "[layout precompilation] Add testing hook for precompiled layouts"

parents 763747b7 3b95621e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1790,6 +1790,10 @@ package android.view {
    method public boolean isSystemGroup();
  }

  public abstract class LayoutInflater {
    method public void setPrecompiledLayoutsEnabledForTesting(boolean);
  }

  public final class MotionEvent extends android.view.InputEvent implements android.os.Parcelable {
    method public void setActionButton(int);
    method public void setButtonState(int);
+18 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.LayoutRes;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.res.Resources;
@@ -389,9 +390,13 @@ public abstract class LayoutInflater {
    }

    private void initPrecompiledViews() {
        initPrecompiledViews(
                SystemProperties.getBoolean(USE_PRECOMPILED_LAYOUT_SYSTEM_PROPERTY, false));
    }

    private void initPrecompiledViews(boolean enablePrecompiledViews) {
        mUseCompiledView = enablePrecompiledViews;
        try {
            mUseCompiledView =
                SystemProperties.getBoolean(USE_PRECOMPILED_LAYOUT_SYSTEM_PROPERTY, false);
            if (mUseCompiledView) {
                mPrecompiledClassLoader = mContext.getClassLoader();
                String dexFile = mContext.getCodeCacheDir() + COMPILED_VIEW_DEX_FILE_NAME;
@@ -409,6 +414,17 @@ public abstract class LayoutInflater {
            }
            mUseCompiledView = false;
        }
        if (!mUseCompiledView) {
            mPrecompiledClassLoader = null;
        }
    }

    /**
     * @hide for use by CTS tests
     */
    @TestApi
    public void setPrecompiledLayoutsEnabledForTesting(boolean enablePrecompiledLayouts) {
        initPrecompiledViews(enablePrecompiledLayouts);
    }

    /**