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

Commit 1cf716c7 authored by Brint E. Kriebel's avatar Brint E. Kriebel
Browse files

Merge remote-tracking branch 'github/cm-11.0' into HEAD

parents 34c674da 28e38b4c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -463,6 +463,22 @@ public class ThemeUtils {
        context.registerReceiver(receiver, filter);
    }

    public static String getLockscreenWallpaperPath(AssetManager assetManager) throws IOException {
        final String WALLPAPER_JPG = "wallpaper.jpg";
        final String WALLPAPER_PNG = "wallpaper.png";

        String[] assets = assetManager.list("lockscreen");
        if (assets == null || assets.length == 0) return null;
        for (String asset : assets) {
            if (WALLPAPER_JPG.equals(asset)) {
                return "lockscreen/" + WALLPAPER_JPG;
            } else if (WALLPAPER_PNG.equals(asset)) {
                return "lockscreen/" + WALLPAPER_PNG;
            }
        }
        return null;
    }

    private static class ThemedUiContext extends ContextWrapper {
        private String mPackageName;

+1 −1
Original line number Diff line number Diff line
@@ -1467,7 +1467,7 @@ public abstract class HardwareRenderer {
                        // and also its better to check the surface
                        // validity to avoid any crash.
                        if(mSurface.isValid() && dirty != null) {
                                mSurface.setDirtyRegion(dirty);
                                mSurface.setDirtyRect(dirty);
                        }
                        saveCount = canvas.save();
                        callbacks.onHardwarePreDraw(canvas);
+3 −3
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ public class Surface implements Parcelable {
    private static native boolean nativeIsConsumerRunningBehind(int nativeObject);
    private static native int nativeReadFromParcel(int nativeObject, Parcel source);
    private static native void nativeWriteToParcel(int nativeObject, Parcel dest);
    private static native void nativeSetDirtyRegion(int nativeObject, Rect dirty);
    private static native void nativeSetDirtyRect(int nativeObject, Rect dirty);

    public static final Parcelable.Creator<Surface> CREATOR =
            new Parcelable.Creator<Surface>() {
@@ -153,9 +153,9 @@ public class Surface implements Parcelable {
     * Set dirty region passed from HW renderer.
     * @hide
     */
    public void setDirtyRegion(Rect dirty) {
    public void setDirtyRect(Rect dirty) {
        if (mNativeObject != 0) {
            nativeSetDirtyRegion(mNativeObject,dirty);
            nativeSetDirtyRect(mNativeObject,dirty);
        }
    }

+11 −19
Original line number Diff line number Diff line
@@ -188,9 +188,10 @@ static inline SkBitmap::Config convertPixelFormat(PixelFormat format) {
    }
}

static void nativeSetDirtyRegion(JNIEnv* env, jclass clazz,
static void nativeSetDirtyRect(JNIEnv* env, jclass clazz,
        jint nativeObject, jobject dirtyRect) {

#ifdef QCOM_BSP
    sp<Surface> surface(reinterpret_cast<Surface *>(nativeObject));

    if (!isSurfaceValid(surface)) {
@@ -198,23 +199,14 @@ static void nativeSetDirtyRegion(JNIEnv* env, jclass clazz,
        return;
    }

    // get dirty region
    Region dirtyRegion;
    Rect dirty;
    Rect rect;
    rect.left = env->GetIntField(dirtyRect, gRectClassInfo.left);
    rect.top = env->GetIntField(dirtyRect, gRectClassInfo.top);
    rect.right = env->GetIntField(dirtyRect, gRectClassInfo.right);
    rect.bottom = env->GetIntField(dirtyRect, gRectClassInfo.bottom);

    dirty.left = env->GetIntField(dirtyRect, gRectClassInfo.left);
    dirty.top = env->GetIntField(dirtyRect, gRectClassInfo.top);
    dirty.right = env->GetIntField(dirtyRect, gRectClassInfo.right);
    dirty.bottom = env->GetIntField(dirtyRect, gRectClassInfo.bottom);

    if (!dirty.isEmpty()) {
       dirtyRegion.set(dirty);
    }

    status_t err = surface->setDirtyRegion(&dirtyRegion);
    if (err < 0) {
        doThrowIAE(env);
    }
    surface->setDirtyRect(&rect);
#endif
}

static inline void swapCanvasPtr(JNIEnv* env, jobject canvasObj, SkCanvas* newCanvas) {
@@ -398,8 +390,8 @@ static JNINativeMethod gSurfaceMethods[] = {
            (void*)nativeReadFromParcel },
    {"nativeWriteToParcel", "(ILandroid/os/Parcel;)V",
            (void*)nativeWriteToParcel },
    {"nativeSetDirtyRegion", "(ILandroid/graphics/Rect;)V",
           (void*)nativeSetDirtyRegion },
    {"nativeSetDirtyRect", "(ILandroid/graphics/Rect;)V",
           (void*)nativeSetDirtyRect },
};

int register_android_view_Surface(JNIEnv* env)
+5 −0
Original line number Diff line number Diff line
@@ -137,6 +137,11 @@
    <!-- [CHAR LIMIT=NONE] Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permdesc_changePhoneBlacklist">Allows an app to change the phone numbers that are blocked for incoming calls or messages.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permlab_accessThemeService">access theme service</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permdesc_accessThemeService">Allows an app to access the theme service. Should never be needed for normal apps.</string>

    <string name="immersive_mode_confirmation_bottom">Swipe up from the bottom to exit full screen.</string>

    <!-- App ops requests -->
Loading