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

Commit 2e724e9f authored by Steve Kondik's avatar Steve Kondik
Browse files

Remove Qualcomm BoostFramework

 * This is gonna get really sketchy with the proprietary bits, and
   we have our own solution. Revert all associated patches.

Revert "BoostFramework: Adding config for disable packing params & scroll fix"

This reverts commit a313bfae.

Revert "Perf: Adding hooks for IO prefetcher into framework"

This reverts commit 96e75fca.

Revert "frameworks/base: Add support for low resolution rendering"

This reverts commit d5282e05.

Revert "frameworks/base: support for loading wfd whitelist dynamic libraries"

This reverts commit 79a889bc.

Revert "ActivityTrigger: New class to invoke when activity starts/resumes"

This reverts commit 20d6e3c9.

Revert "BoostFramework to enchance performance during critical scenarios"

This reverts commit 0c3a49a5.

Change-Id: Ibc81f3150f4bea572f869be688ebfade11b27307
parent 6146b476
Loading
Loading
Loading
Loading
+0 −34
Original line number Diff line number Diff line
@@ -111,7 +111,6 @@ import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import android.util.BoostFramework;

/**
 * An activity is a single, focused thing that the user can do.  Almost all
@@ -673,10 +672,6 @@ public class Activity extends ContextThemeWrapper
        Window.Callback, KeyEvent.Callback,
        OnCreateContextMenuListener, ComponentCallbacks2,
        Window.OnWindowDismissedCallback {
    private static BoostFramework mPerf = null;
    private static int mDragBoostPossible = -1;
    private static int mPerfLockDuration = -1;
    private static int mAsParamVal[];
    private static final String TAG = "Activity";
    private static final boolean DEBUG_LIFECYCLE = false;

@@ -2764,35 +2759,6 @@ public class Activity extends ContextThemeWrapper
     * @return boolean Return true if this event was consumed.
     */
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if(mDragBoostPossible == -1) {
            mDragBoostPossible = 0;
            String currentActivity = getPackageName();
            String[] activityList = getResources().getStringArray(
                com.android.internal.R.array.boost_activityList);
            if(activityList != null){
                for (String match : activityList) {
                    if (currentActivity.indexOf(match) != -1){
                        mDragBoostPossible = 1;
                        break;
                    }
                }
            }
        }
        if (mDragBoostPossible == 1) {
            if (mPerf == null){
                mPerf = new BoostFramework();
            }
            if(mPerfLockDuration == -1){
                mPerfLockDuration = getResources().getInteger(
                    com.android.internal.R.integer.ascrollboost_timeout);
                mAsParamVal = getResources().getIntArray(
                    com.android.internal.R.array.ascrollboost_param_value);
            }
            mPerf.perfLockAcquireTouch(ev,
                getResources().getDisplayMetrics(),
                mPerfLockDuration, mAsParamVal);
        }

        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
            onUserInteraction();
        }
+0 −12
Original line number Diff line number Diff line
@@ -465,13 +465,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public int privateFlags;

    /**
     * Boolean indicating whether the resolution of the SurfaceView associated
     * with this appplication can be overriden.
     * {@hide}
     */
    public int overrideRes = 0;

    /**
     * The required smallest screen width the application can run on.  If 0,
     * nothing has been specified.  Comes from
@@ -775,7 +768,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        theme = orig.theme;
        flags = orig.flags;
        privateFlags = orig.privateFlags;
        overrideRes = orig.overrideRes;
        requiresSmallestWidthDp = orig.requiresSmallestWidthDp;
        compatibleWidthLimitDp = orig.compatibleWidthLimitDp;
        largestWidthLimitDp = orig.largestWidthLimitDp;
@@ -831,7 +823,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        dest.writeInt(theme);
        dest.writeInt(flags);
        dest.writeInt(privateFlags);
        dest.writeInt(overrideRes);
        dest.writeInt(requiresSmallestWidthDp);
        dest.writeInt(compatibleWidthLimitDp);
        dest.writeInt(largestWidthLimitDp);
@@ -886,7 +877,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        theme = source.readInt();
        flags = source.readInt();
        privateFlags = source.readInt();
        overrideRes = source.readInt();
        requiresSmallestWidthDp = source.readInt();
        compatibleWidthLimitDp = source.readInt();
        largestWidthLimitDp = source.readInt();
@@ -1027,7 +1017,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
    /** {@hide} */ public void setResourcePath(String resourcePath) { scanPublicSourceDir = resourcePath; }
    /** {@hide} */ public void setBaseResourcePath(String baseResourcePath) { publicSourceDir = baseResourcePath; }
    /** {@hide} */ public void setSplitResourcePaths(String[] splitResourcePaths) { splitPublicSourceDirs = splitResourcePaths; }
    /** {@hide} */ public void setOverrideRes(int overrideResolution) { overrideRes = overrideResolution; }

    /** {@hide} */ public String getCodePath() { return scanSourceDir; }
    /** {@hide} */ public String getBaseCodePath() { return sourceDir; }
@@ -1035,5 +1024,4 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
    /** {@hide} */ public String getResourcePath() { return scanPublicSourceDir; }
    /** {@hide} */ public String getBaseResourcePath() { return publicSourceDir; }
    /** {@hide} */ public String[] getSplitResourcePaths() { return splitSourceDirs; }
    /** {@hide} */ public int canOverrideRes() { return overrideRes; }
}
+0 −184
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *    * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *    * Redistributions in binary form must reproduce the above
 *      copyright notice, this list of conditions and the following
 *      disclaimer in the documentation and/or other materials provided
 *      with the distribution.
 *    * Neither the name of The Linux Foundation nor the names of its
 *      contributors may be used to endorse or promote products derived
 *      from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package android.util;

import android.util.Log;
import dalvik.system.PathClassLoader;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.System;
import android.view.MotionEvent;
import android.util.DisplayMetrics;

/** @hide */
public class BoostFramework {

    private static final String TAG = "BoostFramework";
    private static final String PERFORMANCE_JAR = "/system/framework/QPerformance.jar";
    private static final String PERFORMANCE_CLASS = "com.qualcomm.qti.Performance";

/** @hide */
    private static boolean mIsLoaded = false;
    private static Method mAcquireFunc = null;
    private static Method mReleaseFunc = null;
    private static Method mAcquireTouchFunc = null;
    private static Method mIOPStart = null;
    private static Method mIOPStop  = null;
    private static Constructor<Class> mConstructor = null;

/** @hide */
    private Object mPerf = null;

/** @hide */
    public BoostFramework() {

        if (mIsLoaded == false) {
            try {
                Class perfClass;
                PathClassLoader perfClassLoader;

	        perfClassLoader = new PathClassLoader(PERFORMANCE_JAR,
                                  ClassLoader.getSystemClassLoader());
                perfClass = perfClassLoader.loadClass(PERFORMANCE_CLASS);
                mConstructor = perfClass.getConstructor();

                Class[] argClasses = new Class[] {int.class, int[].class};
                mAcquireFunc =  perfClass.getDeclaredMethod("perfLockAcquire", argClasses);
                Log.v(TAG,"mAcquireFunc method = " + mAcquireFunc);

                argClasses = new Class[] {};
                mReleaseFunc =  perfClass.getDeclaredMethod("perfLockRelease", argClasses);
                Log.v(TAG,"mReleaseFunc method = " + mReleaseFunc);

                argClasses = new Class[] {MotionEvent.class, DisplayMetrics.class, int.class, int[].class};
                mAcquireTouchFunc =  perfClass.getDeclaredMethod("perfLockAcquireTouch", argClasses);
                Log.v(TAG,"mAcquireTouchFunc method = " + mAcquireTouchFunc);

                argClasses = new Class[] {int.class, String.class};
                mIOPStart =  perfClass.getDeclaredMethod("perfIOPrefetchStart", argClasses);
                Log.v(TAG,"mIOPStart method = " + mIOPStart);

                argClasses = new Class[] {};
                mIOPStop =  perfClass.getDeclaredMethod("perfIOPrefetchStop", argClasses);
                Log.v(TAG,"mIOPStop method = " + mIOPStop);

                mIsLoaded = true;
            }
            catch(Exception e) {
                Log.e(TAG,"BoostFramework() : Exception_1 = " + e);
            }
        }

        try {
            if (mConstructor != null) {
                mPerf = mConstructor.newInstance();
            }
        }
        catch(Exception e) {
            Log.e(TAG,"BoostFramework() : Exception_2 = " + e);
        }

        Log.v(TAG,"BoostFramework() : mPerf = " + mPerf);
    }

/** @hide */
/*    private static void loadNative() {
        if(!isLoaded){
            //System.loadLibrary("perf_jni");
            System.loadLibrary("qti_performance");
            isLoaded=true;
        }
        return;
    }
*/

/** @hide */
    public int perfLockAcquire(int duration, int... list) {
        int ret = -1;
        try {
            Object retVal = mAcquireFunc.invoke(mPerf, duration, list);
            ret = (int)retVal;
        } catch(Exception e) {
            Log.e(TAG,"Exception " + e);
        }
        return ret;
    }

/** @hide */
    public int perfLockRelease() {
        int ret = -1;
        try {
            Object retVal = mReleaseFunc.invoke(mPerf);
            ret = (int)retVal;
        } catch(Exception e) {
            Log.e(TAG,"Exception " + e);
        }
        return ret;
    }
/** @hide */
    public int perfLockAcquireTouch(MotionEvent ev, DisplayMetrics metrics,
                                   int duration, int... list) {
        int ret = -1;
        try {
            Object retVal = mAcquireTouchFunc.invoke(mPerf, ev, metrics, duration, list);
            ret = (int)retVal;
        } catch(Exception e) {
            Log.e(TAG,"Exception " + e);
        }
        return ret;
    }

/** @hide */
    public int perfIOPrefetchStart(int pid, String pkg_name)
    {
        int ret = -1;
        try {
            Object retVal = mIOPStart.invoke(mPerf,pid,pkg_name);
            ret = (int)retVal;
        } catch(Exception e) {
            Log.e(TAG,"Exception " + e);
        }
        return ret;
    }

/** @hide */
    public int perfIOPrefetchStop()
    {
        int ret = -1;
         try {
             Object retVal = mIOPStop.invoke(mPerf);
             ret = (int)retVal;
         } catch(Exception e) {
             Log.e(TAG,"Exception " + e);
         }
         return ret;
    }

};
+0 −140
Original line number Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*     * Redistributions of source code must retain the above copyright
*       notice, this list of conditions and the following disclaimer.
*     * Redistributions in binary form must reproduce the above
*       copyright notice, this list of conditions and the following
*       disclaimer in the documentation and/or other materials provided
*       with the distribution.
*     * Neither the name of The Linux Foundation nor the names of its
*       contributors may be used to endorse or promote products derived
*       from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

package android.util;

import android.content.ComponentName;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Matrix;
import android.os.SystemProperties;
import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceView;
import android.view.View;

/** @hide */
public class ResolutionOverride {
    /** @hide */
    static private final boolean DEBUG = false;
    static private final String TAG = "ResolutionOverride";
    private static final String RES_OVERRIDE = "persist.debug.app_res_override";
    private boolean mIsEnabled = false;
    private int mOverrideXres = 0;
    private int mOverrideYres = 0;

    /** @hide */
    public ResolutionOverride(SurfaceView view) {
        boolean enable = (view.getContext().getApplicationInfo().canOverrideRes() == 1);
        int orientation = view.getResources().getConfiguration().orientation;

        if(enable && (orientation == Configuration.ORIENTATION_PORTRAIT ||
                orientation == Configuration.ORIENTATION_LANDSCAPE)) {
            String resStr = SystemProperties.get(RES_OVERRIDE, null);

            if (resStr != null && resStr.length() > 0) {
                resStr = resStr.toLowerCase();
                final int pos = resStr.indexOf('x');
                if (pos > 0 && resStr.lastIndexOf('x') == pos) {
                    try {
                        mOverrideXres = Integer.parseInt(resStr.substring(0, pos));
                        mOverrideYres = Integer.parseInt(resStr.substring(pos + 1));
                    } catch (NumberFormatException ex) {
                        Log.e(TAG, "Error in extracting the overriding xres and yres");
                    }
                }
            }

            if(orientation == Configuration.ORIENTATION_LANDSCAPE) {
                int tmp = mOverrideXres;
                mOverrideXres = mOverrideYres;
                mOverrideYres = tmp;
            }

            if(mOverrideXres > 0 && mOverrideYres > 0) {
                mIsEnabled = true;
                if (DEBUG) Log.i(TAG, "Orientation: " + orientation +
                    " Overriding resolution to" + " xres: " + mOverrideXres
                    + " yres: " + mOverrideYres);
            }
        }
    }

    /** @hide */
    public void setFixedSize(SurfaceView view) {
        if(!mIsEnabled) {
            return;
        }

        view.getHolder().setFixedSize(mOverrideXres, mOverrideYres);
    }

    /** @hide */
    public void handleTouch(SurfaceView view, MotionEvent ev) {
        if(!mIsEnabled) {
            return;
        }

        Matrix matrix = new Matrix();
        //mOverride{Xres, Yres} are already swapped if orientation is landscape
        float xscale = (mOverrideXres * 1.0f) / view.getWidth();
        float yscale = (mOverrideYres * 1.0f) / view.getHeight();

        if (DEBUG) Log.i(TAG, "Before overriding the touch event x/y : " + ev);
        matrix.postScale(xscale, yscale);
        ev.transform(matrix);
        if (DEBUG) Log.i(TAG, "After overriding the touch event x/y : " + ev);
    }

    /** @hide */
    public void handleResize(final SurfaceView surfaceView) {
        if(!mIsEnabled) {
            return;
        }

        /* Change the visibility to GONE and back to VISIBLE and post it
         * on the main thread for the touch events to be effective on the
         * changed SurfaceView with the new dimensions
         */
        surfaceView.post(new Runnable() {
            @Override
            public void run() {
                surfaceView.setVisibility(View.GONE);
            }
        });

        surfaceView.postDelayed(new Runnable() {
            @Override
            public void run() {
                surfaceView.setVisibility(View.VISIBLE);
            }
        }, 100);
    }
};
+1 −18
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.os.SystemClock;
import android.os.ParcelFileDescriptor;
import android.util.AttributeSet;
import android.util.Log;
import android.util.ResolutionOverride;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -168,7 +167,6 @@ public class SurfaceView extends View {
    boolean mUpdateWindowNeeded;
    boolean mReportDrawNeeded;
    private Translator mTranslator;
    ResolutionOverride mResolutionOverride = null;

    private final ViewTreeObserver.OnPreDrawListener mDrawListener =
            new ViewTreeObserver.OnPreDrawListener() {
@@ -204,8 +202,6 @@ public class SurfaceView extends View {

    private void init() {
        setWillNotDraw(true);
        mResolutionOverride = new ResolutionOverride(this);
        mResolutionOverride.setFixedSize(this);
    }

    /**
@@ -298,16 +294,6 @@ public class SurfaceView extends View {
        setMeasuredDimension(width, height);
    }

    /**
     * Transforms the touch events to the new resolution coordinate system
     * if the resolution has changed
     */
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        mResolutionOverride.handleTouch(this, ev);
        return super.dispatchTouchEvent(ev);
    }

    /** @hide */
    @Override
    protected boolean setFrame(int left, int top, int right, int bottom) {
@@ -672,14 +658,11 @@ public class SurfaceView extends View {
        public void resized(Rect frame, Rect overscanInsets, Rect contentInsets,
                Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw,
                Configuration newConfig) {
            final SurfaceView surfaceView = mSurfaceView.get();
            SurfaceView surfaceView = mSurfaceView.get();
            if (surfaceView != null) {
                if (DEBUG) Log.v(
                        "SurfaceView", surfaceView + " got resized: w=" + frame.width()
                        + " h=" + frame.height() + ", cur w=" + mCurWidth + " h=" + mCurHeight);

                surfaceView.mResolutionOverride.handleResize(surfaceView);

                surfaceView.mSurfaceLock.lock();
                try {
                    if (reportDraw) {
Loading