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

Commit be6cf1ad authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9279354 from 7b0af203 to tm-qpr2-release

Change-Id: I59632608a554c10c6df431f0cd2989cf5ebfce5d
parents aa73a148 7b0af203
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -132,14 +132,14 @@ static const char IMAGE_FRAG_DYNAMIC_COLORING_SHADER_SOURCE[] = R"(
    uniform sampler2D uTexture;
    uniform float uFade;
    uniform float uColorProgress;
    uniform vec4 uStartColor0;
    uniform vec4 uStartColor1;
    uniform vec4 uStartColor2;
    uniform vec4 uStartColor3;
    uniform vec4 uEndColor0;
    uniform vec4 uEndColor1;
    uniform vec4 uEndColor2;
    uniform vec4 uEndColor3;
    uniform vec3 uStartColor0;
    uniform vec3 uStartColor1;
    uniform vec3 uStartColor2;
    uniform vec3 uStartColor3;
    uniform vec3 uEndColor0;
    uniform vec3 uEndColor1;
    uniform vec3 uEndColor2;
    uniform vec3 uEndColor3;
    varying highp vec2 vUv;
    void main() {
        vec4 mask = texture2D(uTexture, vUv);
@@ -152,12 +152,12 @@ static const char IMAGE_FRAG_DYNAMIC_COLORING_SHADER_SOURCE[] = R"(
            * step(cWhiteMaskThreshold, g)
            * step(cWhiteMaskThreshold, b)
            * step(cWhiteMaskThreshold, a);
        vec4 color = r * mix(uStartColor0, uEndColor0, uColorProgress)
        vec3 color = r * mix(uStartColor0, uEndColor0, uColorProgress)
                + g * mix(uStartColor1, uEndColor1, uColorProgress)
                + b * mix(uStartColor2, uEndColor2, uColorProgress)
                + a * mix(uStartColor3, uEndColor3, uColorProgress);
        color = mix(color, vec4(vec3((r + g + b + a) * 0.25), 1.0), useWhiteMask);
        gl_FragColor = vec4(color.x, color.y, color.z, (1.0 - uFade)) * color.a;
        color = mix(color, vec3((r + g + b + a) * 0.25), useWhiteMask);
        gl_FragColor = vec4(color.x, color.y, color.z, (1.0 - uFade));
    })";
static const char IMAGE_FRAG_SHADER_SOURCE[] = R"(
    precision mediump float;
@@ -1440,12 +1440,12 @@ void BootAnimation::initDynamicColors() {
    for (int i = 0; i < DYNAMIC_COLOR_COUNT; i++) {
        float *startColor = mAnimation->startColors[i];
        float *endColor = mAnimation->endColors[i];
        glUniform4f(glGetUniformLocation(mImageShader,
        glUniform3f(glGetUniformLocation(mImageShader,
            (U_START_COLOR_PREFIX + std::to_string(i)).c_str()),
            startColor[0], startColor[1], startColor[2], 1 /* alpha */);
        glUniform4f(glGetUniformLocation(mImageShader,
            startColor[0], startColor[1], startColor[2]);
        glUniform3f(glGetUniformLocation(mImageShader,
            (U_END_COLOR_PREFIX + std::to_string(i)).c_str()),
            endColor[0], endColor[1], endColor[2], 1 /* alpha */);
            endColor[0], endColor[1], endColor[2]);
    }
    mImageColorProgressLocation = glGetUniformLocation(mImageShader, U_COLOR_PROGRESS);
}
+14 −0
Original line number Diff line number Diff line
@@ -54,6 +54,20 @@ public abstract class ControlsProviderService extends Service {
    public static final String SERVICE_CONTROLS =
            "android.service.controls.ControlsProviderService";

    /**
     * Manifest metadata to show a custom embedded activity as part of device controls.
     *
     * The value of this metadata must be the {@link ComponentName} as a string of an activity in
     * the same package that will be launched as part of a TaskView.
     *
     * The activity must be exported, enabled and protected by
     * {@link Manifest.permission.BIND_CONTROLS}.
     *
     * @hide
     */
    public static final String META_DATA_PANEL_ACTIVITY =
            "android.service.controls.META_DATA_PANEL_ACTIVITY";

    /**
     * @hide
     */
+3 −12
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package android.service.dreams;

import android.content.ComponentName;

/**
 * Dream manager local system service interface.
@@ -54,17 +53,9 @@ public abstract class DreamManagerInternal {
    public abstract void requestDream();

    /**
     * Called by the ActivityTaskManagerService to verify that the startDreamActivity
     * request comes from the current active dream component.
     * Whether dreaming can start given user settings and the current dock/charge state.
     *
     * This function and its call path should not acquire the DreamManagerService lock
     * to avoid deadlock with the ActivityTaskManager lock.
     *
     * TODO: Make this interaction push-based - the DreamManager should inform the
     * ActivityTaskManager whenever the active dream component changes.
     *
     * @param doze If true returns the current active doze component. Otherwise, returns the
     *             active dream component.
     * @param isScreenOn True if the screen is currently on.
     */
    public abstract ComponentName getActiveDreamComponent(boolean doze);
    public abstract boolean canStartDreaming(boolean isScreenOn);
}
+54 −12
Original line number Diff line number Diff line
@@ -578,6 +578,7 @@ public abstract class WallpaperService extends Service {
         */
        public void reportEngineShown(boolean waitForEngineShown) {
            if (mIWallpaperEngine.mShownReported) return;
            Trace.beginSection("WPMS.reportEngineShown-" + waitForEngineShown);
            Log.d(TAG, "reportEngineShown: shouldWait=" + waitForEngineShown);
            if (!waitForEngineShown) {
                Message message = mCaller.obtainMessage(MSG_REPORT_SHOWN);
@@ -590,6 +591,7 @@ public abstract class WallpaperService extends Service {
                    mCaller.sendMessageDelayed(message, TimeUnit.SECONDS.toMillis(5));
                }
            }
            Trace.endSection();
        }

        /**
@@ -1259,7 +1261,9 @@ public abstract class WallpaperService extends Service {
                            didSurface = true;
                            if (DEBUG) Log.v(TAG, "onSurfaceCreated("
                                    + mSurfaceHolder + "): " + this);
                            Trace.beginSection("WPMS.Engine.onSurfaceCreated");
                            onSurfaceCreated(mSurfaceHolder);
                            Trace.endSection();
                            SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks();
                            if (callbacks != null) {
                                for (SurfaceHolder.Callback c : callbacks) {
@@ -1285,8 +1289,10 @@ public abstract class WallpaperService extends Service {
                                    + ", " + mCurWidth + ", " + mCurHeight
                                    + "): " + this);
                            didSurface = true;
                            Trace.beginSection("WPMS.Engine.onSurfaceChanged");
                            onSurfaceChanged(mSurfaceHolder, mFormat,
                                    mCurWidth, mCurHeight);
                            Trace.endSection();
                            SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks();
                            if (callbacks != null) {
                                for (SurfaceHolder.Callback c : callbacks) {
@@ -1303,11 +1309,15 @@ public abstract class WallpaperService extends Service {
                            if (DEBUG) {
                                Log.v(TAG, "dispatching insets=" + windowInsets);
                            }
                            Trace.beginSection("WPMS.Engine.onApplyWindowInsets");
                            onApplyWindowInsets(windowInsets);
                            Trace.endSection();
                        }

                        if (redrawNeeded) {
                            Trace.beginSection("WPMS.Engine.onSurfaceRedrawNeeded");
                            onSurfaceRedrawNeeded(mSurfaceHolder);
                            Trace.endSection();
                            SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks();
                            if (callbacks != null) {
                                for (SurfaceHolder.Callback c : callbacks) {
@@ -1332,11 +1342,15 @@ public abstract class WallpaperService extends Service {
                                // the state to get them to notice.
                                if (DEBUG) Log.v(TAG, "onVisibilityChanged(true) at surface: "
                                        + this);
                                Trace.beginSection("WPMS.Engine.onVisibilityChanged-true");
                                onVisibilityChanged(true);
                                Trace.endSection();
                            }
                            if (DEBUG) Log.v(TAG, "onVisibilityChanged(false) at surface: "
                                        + this);
                            Trace.beginSection("WPMS.Engine.onVisibilityChanged-false");
                            onVisibilityChanged(false);
                            Trace.endSection();
                        }
                    } finally {
                        mIsCreating = false;
@@ -1422,12 +1436,16 @@ public abstract class WallpaperService extends Service {
            mDisplayInstallOrientation = mDisplay.getInstallOrientation();

            if (DEBUG) Log.v(TAG, "onCreate(): " + this);
            Trace.beginSection("WPMS.Engine.onCreate");
            onCreate(mSurfaceHolder);
            Trace.endSection();

            mInitializing = false;

            mReportedVisible = false;
            Trace.beginSection("WPMS.Engine.updateSurface");
            updateSurface(false, false, false);
            Trace.endSection();
        }

        /**
@@ -2237,14 +2255,15 @@ public abstract class WallpaperService extends Service {
        public void reportShown() {
            if (!mShownReported) {
                mShownReported = true;
                Trace.beginSection("WPMS.mConnection.engineShown");
                try {
                    mConnection.engineShown(this);
                    Log.d(TAG, "Wallpaper has updated the surface:"
                            + mWallpaperManager.getWallpaperInfo());
                } catch (RemoteException e) {
                    Log.w(TAG, "Wallpaper host disappeared", e);
                    return;
                }
                Trace.endSection();
            }
        }

@@ -2286,6 +2305,27 @@ public abstract class WallpaperService extends Service {
            return mEngine == null ? null : SurfaceControl.mirrorSurface(mEngine.mSurfaceControl);
        }

        private void doAttachEngine() {
            Trace.beginSection("WPMS.onCreateEngine");
            Engine engine = onCreateEngine();
            Trace.endSection();
            mEngine = engine;
            Trace.beginSection("WPMS.mConnection.attachEngine-" + mDisplayId);
            try {
                mConnection.attachEngine(this, mDisplayId);
            } catch (RemoteException e) {
                engine.detach();
                Log.w(TAG, "Wallpaper host disappeared", e);
                return;
            } finally {
                Trace.endSection();
            }
            mActiveEngines.add(engine);
            Trace.beginSection("WPMS.engine.attach");
            engine.attach(this);
            Trace.endSection();
        }

        private void doDetachEngine() {
            mActiveEngines.remove(mEngine);
            mEngine.detach();
@@ -2311,21 +2351,15 @@ public abstract class WallpaperService extends Service {
            }
            switch (message.what) {
                case DO_ATTACH: {
                    Engine engine = onCreateEngine();
                    mEngine = engine;
                    try {
                        mConnection.attachEngine(this, mDisplayId);
                    } catch (RemoteException e) {
                        engine.detach();
                        Log.w(TAG, "Wallpaper host disappeared", e);
                        return;
                    }
                    mActiveEngines.add(engine);
                    engine.attach(this);
                    Trace.beginSection("WPMS.DO_ATTACH");
                    doAttachEngine();
                    Trace.endSection();
                    return;
                }
                case DO_DETACH: {
                    Trace.beginSection("WPMS.DO_DETACH");
                    doDetachEngine();
                    Trace.endSection();
                    return;
                }
                case DO_SET_DESIRED_SIZE: {
@@ -2406,7 +2440,9 @@ public abstract class WallpaperService extends Service {
                    }
                } break;
                case MSG_REPORT_SHOWN: {
                    Trace.beginSection("WPMS.MSG_REPORT_SHOWN");
                    reportShown();
                    Trace.endSection();
                } break;
                default :
                    Log.w(TAG, "Unknown message type " + message.what);
@@ -2430,8 +2466,10 @@ public abstract class WallpaperService extends Service {
        public void attach(IWallpaperConnection conn, IBinder windowToken,
                int windowType, boolean isPreview, int reqWidth, int reqHeight, Rect padding,
                int displayId, @SetWallpaperFlags int which) {
            Trace.beginSection("WPMS.ServiceWrapper.attach");
            mEngineWrapper = new IWallpaperEngineWrapper(mTarget, conn, windowToken,
                    windowType, isPreview, reqWidth, reqHeight, padding, displayId);
            Trace.endSection();
        }

        @Override
@@ -2442,16 +2480,20 @@ public abstract class WallpaperService extends Service {

    @Override
    public void onCreate() {
        Trace.beginSection("WPMS.onCreate");
        super.onCreate();
        Trace.endSection();
    }

    @Override
    public void onDestroy() {
        Trace.beginSection("WPMS.onDestroy");
        super.onDestroy();
        for (int i=0; i<mActiveEngines.size(); i++) {
            mActiveEngines.get(i).detach();
        }
        mActiveEngines.clear();
        Trace.endSection();
    }

    /**
+4 −1
Original line number Diff line number Diff line
@@ -29,10 +29,11 @@ import androidx.test.filters.SmallTest;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

/**
 * Test class for {@link ConstrainDisplayApisConfig}.
 * Test for {@link ConstrainDisplayApisConfig}.
 *
 * Build/Install/Run:
 * atest FrameworksCoreTests:ConstrainDisplayApisConfigTest
@@ -72,6 +73,7 @@ public final class ConstrainDisplayApisConfigTest {
        testNeverConstrainDisplayApis("com.android.test", /* version= */ 1, /* expected= */ false);
    }

    @Ignore("b/257375674")
    @Test
    public void neverConstrainDisplayApis_flagsHasSingleEntry_returnsTrueForPackageWithinRange() {
        setNeverConstrainDisplayApisFlag("com.android.test:1:1");
@@ -107,6 +109,7 @@ public final class ConstrainDisplayApisConfigTest {
        testNeverConstrainDisplayApis("com.android.test4", /* version= */ 9, /* expected= */ false);
    }

    @Ignore("b/257375674")
    @Test
    public void neverConstrainDisplayApis_flagHasInvalidEntries_ignoresInvalidEntries() {
        // We add a valid entry before and after the invalid ones to make sure they are applied.
Loading