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

Commit cfe54652 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Automerger Merge Worker
Browse files

Merge "Revert "Introduce Windowless starting window."" into udc-dev am: f515de95

parents 864eaaad f515de95
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -34,8 +34,9 @@ oneway interface ITaskOrganizer {
     * has create a starting window for the Task.
     *
     * @param info The information about the Task that's available
     * @param appToken Token of the application being started.
     */
    void addStartingWindow(in StartingWindowInfo info);
    void addStartingWindow(in StartingWindowInfo info, IBinder appToken);

    /**
     * Called when the Task want to remove the starting window.
+0 −29
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.window;

import android.view.SurfaceControl;

/**
 * Interface to be invoked when a windowless starting surface added.
 *
 * @param addedSurface The starting surface.
 * {@hide}
 */
interface IWindowlessStartingSurfaceCallback {
    void onSurfaceAdded(in SurfaceControl addedSurface);
}
+7 −17
Original line number Diff line number Diff line
@@ -328,21 +328,6 @@ public class SnapshotDrawerUtils {
                        - ((float) frame.width() / frame.height())) <= 0.01f;
    }

    /**
     * Get or create a TaskDescription from a RunningTaskInfo.
     */
    public static ActivityManager.TaskDescription getOrCreateTaskDescription(
            ActivityManager.RunningTaskInfo runningTaskInfo) {
        final ActivityManager.TaskDescription taskDescription;
        if (runningTaskInfo.taskDescription != null) {
            taskDescription = runningTaskInfo.taskDescription;
        } else {
            taskDescription = new ActivityManager.TaskDescription();
            taskDescription.setBackgroundColor(WHITE);
        }
        return taskDescription;
    }

    /**
     * Help method to draw the snapshot on a surface.
     */
@@ -359,8 +344,13 @@ public class SnapshotDrawerUtils {

        final WindowManager.LayoutParams attrs = info.topOpaqueWindowLayoutParams;
        final ActivityManager.RunningTaskInfo runningTaskInfo = info.taskInfo;
        final ActivityManager.TaskDescription taskDescription =
                getOrCreateTaskDescription(runningTaskInfo);
        final ActivityManager.TaskDescription taskDescription;
        if (runningTaskInfo.taskDescription != null) {
            taskDescription = runningTaskInfo.taskDescription;
        } else {
            taskDescription = new ActivityManager.TaskDescription();
            taskDescription.setBackgroundColor(WHITE);
        }
        drawSurface.initiateSystemBarPainter(lp.flags, lp.privateFlags,
                attrs.insetsFlags.appearance, taskDescription, info.requestedVisibleTypes);
        final Rect systemBarInsets = getSystemBarInsets(windowBounds, topWindowInsetsState);
+2 −48
Original line number Diff line number Diff line
@@ -22,12 +22,9 @@ import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.TaskInfo;
import android.content.pm.ActivityInfo;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.view.InsetsState;
import android.view.SurfaceControl;
import android.view.WindowInsets;
import android.view.WindowInsets.Type.InsetsType;
import android.view.WindowManager;
@@ -62,8 +59,6 @@ public final class StartingWindowInfo implements Parcelable {
    /** @hide **/
    public static final int STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN = 4;

    public static final int STARTING_WINDOW_TYPE_WINDOWLESS = 5;

    /**
     * @hide
     */
@@ -72,8 +67,7 @@ public final class StartingWindowInfo implements Parcelable {
            STARTING_WINDOW_TYPE_SPLASH_SCREEN,
            STARTING_WINDOW_TYPE_SNAPSHOT,
            STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN,
            STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN,
            STARTING_WINDOW_TYPE_WINDOWLESS
            STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN
    })
    public @interface StartingWindowType {}

@@ -124,7 +118,6 @@ public final class StartingWindowInfo implements Parcelable {
            TYPE_PARAMETER_ACTIVITY_CREATED,
            TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN,
            TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN,
            TYPE_PARAMETER_WINDOWLESS,
            TYPE_PARAMETER_LEGACY_SPLASH_SCREEN
    })
    public @interface StartingTypeParams {}
@@ -158,12 +151,6 @@ public final class StartingWindowInfo implements Parcelable {
     * @hide
     */
    public static final int TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN = 0x00000080;

    /**
     * Windowless surface
     */
    public static final int TYPE_PARAMETER_WINDOWLESS = 0x00000100;

    /**
     * Application is allowed to use the legacy splash screen
     * @hide
@@ -195,33 +182,7 @@ public final class StartingWindowInfo implements Parcelable {
     */
    public TaskSnapshot taskSnapshot;

    @InsetsType public int requestedVisibleTypes = WindowInsets.Type.defaultVisible();

    /**
     * App token where the starting window should add to.
     */
    public IBinder appToken;

    public IWindowlessStartingSurfaceCallback windowlessStartingSurfaceCallback;

    /**
     * The root surface where windowless surface should attach on.
     */
    public SurfaceControl rootSurface;

    /**
     * Notify windowless surface is created.
     * @param addedSurface Created surface.
     */
    public void notifyAddComplete(SurfaceControl addedSurface) {
        if (windowlessStartingSurfaceCallback != null) {
            try {
                windowlessStartingSurfaceCallback.onSurfaceAdded(addedSurface);
            } catch (RemoteException e) {
                //
            }
        }
    }
    public @InsetsType int requestedVisibleTypes = WindowInsets.Type.defaultVisible();

    public StartingWindowInfo() {

@@ -255,9 +216,6 @@ public final class StartingWindowInfo implements Parcelable {
        dest.writeBoolean(isKeyguardOccluded);
        dest.writeTypedObject(taskSnapshot, flags);
        dest.writeInt(requestedVisibleTypes);
        dest.writeStrongBinder(appToken);
        dest.writeStrongInterface(windowlessStartingSurfaceCallback);
        dest.writeTypedObject(rootSurface, flags);
    }

    void readFromParcel(@NonNull Parcel source) {
@@ -272,10 +230,6 @@ public final class StartingWindowInfo implements Parcelable {
        isKeyguardOccluded = source.readBoolean();
        taskSnapshot = source.readTypedObject(TaskSnapshot.CREATOR);
        requestedVisibleTypes = source.readInt();
        appToken = source.readStrongBinder();
        windowlessStartingSurfaceCallback = IWindowlessStartingSurfaceCallback.Stub
                .asInterface(source.readStrongBinder());
        rootSurface = source.readTypedObject(SurfaceControl.CREATOR);
    }

    @Override
+1 −17
Original line number Diff line number Diff line
@@ -67,16 +67,6 @@ public final class StartingWindowRemovalInfo implements Parcelable {
     */
    public float roundedCornerRadius;

    /**
     * Remove windowless surface.
     */
    public boolean windowlessSurface;

    /**
     * Remove immediately.
     */
    public boolean removeImmediately;

    public StartingWindowRemovalInfo() {

    }
@@ -97,8 +87,6 @@ public final class StartingWindowRemovalInfo implements Parcelable {
        playRevealAnimation = source.readBoolean();
        deferRemoveForIme = source.readBoolean();
        roundedCornerRadius = source.readFloat();
        windowlessSurface = source.readBoolean();
        removeImmediately = source.readBoolean();
    }

    @Override
@@ -109,8 +97,6 @@ public final class StartingWindowRemovalInfo implements Parcelable {
        dest.writeBoolean(playRevealAnimation);
        dest.writeBoolean(deferRemoveForIme);
        dest.writeFloat(roundedCornerRadius);
        dest.writeBoolean(windowlessSurface);
        dest.writeBoolean(removeImmediately);
    }

    @Override
@@ -119,9 +105,7 @@ public final class StartingWindowRemovalInfo implements Parcelable {
                + " frame=" + mainFrame
                + " playRevealAnimation=" + playRevealAnimation
                + " roundedCornerRadius=" + roundedCornerRadius
                + " deferRemoveForIme=" + deferRemoveForIme
                + " windowlessSurface=" + windowlessSurface
                + " removeImmediately=" + removeImmediately + "}";
                + " deferRemoveForIme=" + deferRemoveForIme + "}";
    }

    public static final @android.annotation.NonNull Creator<StartingWindowRemovalInfo> CREATOR =
Loading