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

Commit 73650059 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5938921 from d76cc783 to qt-qpr2-release

Change-Id: I60ba95519e637c00e3ea90381d8320849daa1aa7
parents 2614b4db d76cc783
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -9030,8 +9030,6 @@ public final class Settings {
            DOZE_PICK_UP_GESTURE,
            DOZE_DOUBLE_TAP_GESTURE,
            DOZE_TAP_SCREEN_GESTURE,
            DOZE_WAKE_LOCK_SCREEN_GESTURE,
            DOZE_WAKE_DISPLAY_GESTURE,
            NFC_PAYMENT_DEFAULT_COMPONENT,
            AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
            FACE_UNLOCK_KEYGUARD_ENABLED,
@@ -9039,9 +9037,6 @@ public final class Settings {
            FACE_UNLOCK_DISMISSES_KEYGUARD,
            FACE_UNLOCK_APP_ENABLED,
            FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION,
            ASSIST_GESTURE_ENABLED,
            ASSIST_GESTURE_SILENCE_ALERTS_ENABLED,
            ASSIST_GESTURE_WAKE_ENABLED,
            VR_DISPLAY_MODE,
            NOTIFICATION_BADGING,
            NOTIFICATION_DISMISS_RTL,
@@ -9074,12 +9069,9 @@ public final class Settings {
            TRUST_AGENTS_EXTEND_UNLOCK,
            UI_NIGHT_MODE,
            LOCK_SCREEN_WHEN_TRUST_LOST,
            SKIP_GESTURE,
            SKIP_DIRECTION,
            SILENCE_GESTURE,
            THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
            NAVIGATION_MODE,
            AWARE_ENABLED,
            SKIP_GESTURE_COUNT,
            SKIP_TOUCH_COUNT,
            SILENCE_ALARMS_GESTURE_COUNT,
+24 −5
Original line number Diff line number Diff line
#include "ByteBufferStreamAdaptor.h"
#include "core_jni_helpers.h"
#include "Utils.h"
#include <jni.h>

#include <SkStream.h>

@@ -9,6 +10,24 @@ using namespace android;
static jmethodID gByteBuffer_getMethodID;
static jmethodID gByteBuffer_setPositionMethodID;

/**
 * Helper method for accessing the JNI interface pointer.
 *
 * Image decoding (which this supports) is started on a thread that is already
 * attached to the Java VM. But an AnimatedImageDrawable continues decoding on
 * the AnimatedImageThread, which is not attached. This will attach if
 * necessary.
 */
static JNIEnv* requireEnv(JavaVM* jvm) {
    JNIEnv* env;
    if (jvm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
        if (jvm->AttachCurrentThreadAsDaemon(&env, nullptr) != JNI_OK) {
            LOG_ALWAYS_FATAL("Failed to AttachCurrentThread!");
        }
    }
    return env;
}

class ByteBufferStream : public SkStreamAsset {
private:
    ByteBufferStream(JavaVM* jvm, jobject jbyteBuffer, size_t initialPosition, size_t length,
@@ -46,7 +65,7 @@ public:
    }

    ~ByteBufferStream() override {
        auto* env = get_env_or_die(mJvm);
        auto* env = requireEnv(mJvm);
        env->DeleteGlobalRef(mByteBuffer);
        env->DeleteGlobalRef(mStorage);
    }
@@ -63,7 +82,7 @@ public:
            return this->setPosition(mPosition + size) ? size : 0;
        }

        auto* env = get_env_or_die(mJvm);
        auto* env = requireEnv(mJvm);
        size_t bytesRead = 0;
        do {
            const size_t requested = (size > kStorageSize) ? kStorageSize : size;
@@ -146,7 +165,7 @@ private:

    // Range has already been checked by the caller.
    bool setPosition(size_t newPosition) {
        auto* env = get_env_or_die(mJvm);
        auto* env = requireEnv(mJvm);
        env->CallObjectMethod(mByteBuffer, gByteBuffer_setPositionMethodID,
                              newPosition + mInitialPosition);
        if (env->ExceptionCheck()) {
@@ -185,7 +204,7 @@ public:
    }

    ~ByteArrayStream() override {
        auto* env = get_env_or_die(mJvm);
        auto* env = requireEnv(mJvm);
        env->DeleteGlobalRef(mByteArray);
    }

@@ -197,7 +216,7 @@ public:
            return 0;
        }

        auto* env = get_env_or_die(mJvm);
        auto* env = requireEnv(mJvm);
        if (buffer) {
            env->GetByteArrayRegion(mByteArray, mPosition + mOffset, size,
                                    reinterpret_cast<jbyte*>(buffer));
+8 −0
Original line number Diff line number Diff line
@@ -595,7 +595,10 @@ public class SettingsBackupTest {
                 Settings.Secure.ANR_SHOW_BACKGROUND,
                 Settings.Secure.ASSISTANT,
                 Settings.Secure.ASSIST_DISCLOSURE_ENABLED,
                 Settings.Secure.ASSIST_GESTURE_ENABLED,
                 Settings.Secure.ASSIST_GESTURE_SENSITIVITY,
                 Settings.Secure.ASSIST_GESTURE_WAKE_ENABLED,
                 Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED,
                 Settings.Secure.ASSIST_GESTURE_SETUP_COMPLETE,
                 Settings.Secure.ASSIST_SCREENSHOT_ENABLED,
                 Settings.Secure.ASSIST_STRUCTURE_ENABLED,
@@ -723,6 +726,11 @@ public class SettingsBackupTest {
                 Settings.Secure.BIOMETRIC_DEBUG_ENABLED,
                 Settings.Secure.FACE_UNLOCK_ATTENTION_REQUIRED,
                 Settings.Secure.FACE_UNLOCK_DIVERSITY_REQUIRED,
                 Settings.Secure.AWARE_ENABLED,
                 Settings.Secure.SKIP_GESTURE,
                 Settings.Secure.SILENCE_GESTURE,
                 Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE,
                 Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE,
                 Settings.Secure.FACE_UNLOCK_RE_ENROLL);

    @Test
+56 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.ActivityManager;
import android.content.Context;
import android.graphics.Rect;
import android.os.HandlerThread;
import android.os.Trace;
import android.service.wallpaper.WallpaperService;
import android.util.Log;
import android.util.Size;
@@ -48,6 +49,7 @@ public class ImageWallpaper extends WallpaperService {
    private static final int DELAY_FINISH_RENDERING = 1000;
    private static final int INTERVAL_WAIT_FOR_RENDERING = 100;
    private static final int PATIENCE_WAIT_FOR_RENDERING = 10;
    private static final boolean DEBUG = true;
    private HandlerThread mWorker;

    @Override
@@ -125,6 +127,10 @@ public class ImageWallpaper extends WallpaperService {
        @Override
        public void onAmbientModeChanged(boolean inAmbientMode, long animationDuration) {
            if (!mNeedTransition) return;
            if (DEBUG) {
                Log.d(TAG, "onAmbientModeChanged: inAmbient=" + inAmbientMode
                        + ", duration=" + animationDuration);
            }
            mWorker.getThreadHandler().post(
                    () -> mRenderer.updateAmbientMode(inAmbientMode, animationDuration));
            if (inAmbientMode && animationDuration == 0) {
@@ -177,6 +183,10 @@ public class ImageWallpaper extends WallpaperService {
        @Override
        public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
            mWorker.getThreadHandler().post(() -> {
                if (DEBUG) {
                    Log.d(TAG, "onSurfaceChanged: w=" + width + ", h=" + height);
                }

                mRenderer.onSurfaceChanged(width, height);
                mNeedRedraw = true;
            });
@@ -185,15 +195,30 @@ public class ImageWallpaper extends WallpaperService {
        @Override
        public void onSurfaceRedrawNeeded(SurfaceHolder holder) {
            mWorker.getThreadHandler().post(() -> {
                if (DEBUG) {
                    Log.d(TAG, "onSurfaceRedrawNeeded: mNeedRedraw=" + mNeedRedraw);
                }

                if (mNeedRedraw) {
                    preRender();
                    requestRender();
                    postRender();
                    drawFrame();
                    mNeedRedraw = false;
                }
            });
        }

        @Override
        public void onVisibilityChanged(boolean visible) {
            if (DEBUG) {
                Log.d(TAG, "wallpaper visibility changes to: " + visible);
            }
        }

        private void drawFrame() {
            preRender();
            requestRender();
            postRender();
        }

        @Override
        public void onStatePostChange() {
            // When back to home, we try to release EGL, which is preserved in lock screen or aod.
@@ -204,8 +229,18 @@ public class ImageWallpaper extends WallpaperService {

        @Override
        public void preRender() {
            if (DEBUG) {
                Log.d(TAG, "preRender start");
            }

            // This method should only be invoked from worker thread.
            Trace.beginSection("ImageWallpaper#preRender");
            preRenderInternal();
            Trace.endSection();

            if (DEBUG) {
                Log.d(TAG, "preRender end");
            }
        }

        private void preRenderInternal() {
@@ -240,7 +275,9 @@ public class ImageWallpaper extends WallpaperService {
        @Override
        public void requestRender() {
            // This method should only be invoked from worker thread.
            Trace.beginSection("ImageWallpaper#requestRender");
            requestRenderInternal();
            Trace.endSection();
        }

        private void requestRenderInternal() {
@@ -262,9 +299,19 @@ public class ImageWallpaper extends WallpaperService {

        @Override
        public void postRender() {
            if (DEBUG) {
                Log.d(TAG, "postRender start");
            }

            // This method should only be invoked from worker thread.
            Trace.beginSection("ImageWallpaper#postRender");
            notifyWaitingThread();
            scheduleFinishRendering();
            Trace.endSection();

            if (DEBUG) {
                Log.d(TAG, "postRender end");
            }
        }

        private void notifyWaitingThread() {
@@ -289,12 +336,18 @@ public class ImageWallpaper extends WallpaperService {
        }

        private void finishRendering() {
            if (DEBUG) {
                Log.d(TAG, "finishRendering, preserve=" + needPreserveEglContext());
            }

            Trace.beginSection("ImageWallpaper#finishRendering");
            if (mEglHelper != null) {
                mEglHelper.destroyEglSurface();
                if (!needPreserveEglContext()) {
                    mEglHelper.destroyEglContext();
                }
            }
            Trace.endSection();
        }

        private boolean needPreserveEglContext() {
+15 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.glwallpaper;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.util.Log;

import com.android.systemui.Interpolators;

@@ -30,6 +31,7 @@ class ImageRevealHelper {
    private static final String TAG = ImageRevealHelper.class.getSimpleName();
    private static final float MAX_REVEAL = 0f;
    private static final float MIN_REVEAL = 1f;
    private static final boolean DEBUG = true;

    private final ValueAnimator mAnimator;
    private final RevealStateListener mRevealListener;
@@ -56,15 +58,23 @@ class ImageRevealHelper {

            @Override
            public void onAnimationEnd(Animator animation) {
                if (!mIsCanceled && mRevealListener != null) {
                if (mRevealListener != null) {
                    if (DEBUG) {
                        Log.d(TAG, "transition end, cancel=" + mIsCanceled + ", reveal=" + mReveal);
                    }
                    if (!mIsCanceled) {
                        mRevealListener.onRevealEnd();
                    }
                }
                mIsCanceled = false;
            }

            @Override
            public void onAnimationStart(Animator animation) {
                if (mRevealListener != null) {
                    if (DEBUG) {
                        Log.d(TAG, "transition start");
                    }
                    mRevealListener.onRevealStart(true /* animate */);
                }
            }
@@ -82,6 +92,9 @@ class ImageRevealHelper {
    }

    void updateAwake(boolean awake, long duration) {
        if (DEBUG) {
            Log.d(TAG, "updateAwake: awake=" + awake + ", duration=" + duration);
        }
        mAwake = awake;
        mAnimator.setDuration(duration);
        if (duration == 0) {
Loading