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

Commit 22f700a1 authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

Add Delegate for ViewRootImpl#isInTouchMode to prevent IPC call in Eclipse.

Also fix some new/removed method from BitmapFactory.

Change-Id: I606bd8bee6ff1e2c6c9472b4672175bfdaff45de
parent 0aa4713e
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -85,15 +85,18 @@ import java.io.InputStream;
    // ------ Native Delegates ------

    @LayoutlibDelegate
    /*package*/ static void nativeSetDefaultConfig(int nativeConfig) {
        // pass
    /*package*/ static Bitmap nativeDecodeStream(InputStream is, byte[] storage,
            Rect padding, Options opts) {
        return nativeDecodeStream(is, storage, padding, opts, false, 1.f);
    }

    @LayoutlibDelegate
    /*package*/ static  Bitmap nativeDecodeStream(InputStream is, byte[] storage,
            Rect padding, Options opts) {
            Rect padding, Options opts, boolean applyScale, float scale) {
        Bitmap bm = null;

        //TODO support rescaling

        Density density = Density.MEDIUM;
        if (opts != null) {
            density = Density.getEnum(opts.inDensity);
@@ -146,6 +149,13 @@ import java.io.InputStream;
        return null;
    }

    @LayoutlibDelegate
    /*package*/ static Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts,
            boolean applyScale, float scale) {
        opts.inBitmap = null;
        return null;
    }

    @LayoutlibDelegate
    /*package*/ static Bitmap nativeDecodeByteArray(byte[] data, int offset,
            int length, Options opts) {
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.view;

import com.android.tools.layoutlib.annotations.LayoutlibDelegate;

/**
 * Delegate used to provide new implementation of a select few methods of {@link ViewRootImpl}
 *
 * Through the layoutlib_create tool, the original  methods of ViewRootImpl have been replaced
 * by calls to methods of the same name in this delegate class.
 *
 */
public class ViewRootImpl_Delegate {

    @LayoutlibDelegate
    /*package*/ static boolean isInTouchMode() {
        return false; // this allows displaying selection.
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ public final class CreateInfo implements ICreateInfo {
        "android.view.LayoutInflater#rInflate",
        "android.view.LayoutInflater#parseInclude",
        "android.view.View#isInEditMode",
        "android.view.ViewRootImpl#isInTouchMode",
        "android.view.inputmethod.InputMethodManager#getInstance",
        "android.util.Log#println_native",
        "com.android.internal.util.XmlUtils#convertValueToInt",