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

Commit 11af33ee authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Fix several test failures for the new starting window.(10/N)

1. Register TestStartingWindowOrganizer to mock add/remove starting
window.
2. Do not show starting window if not occluded.
3. Add ReadFrameBuffer permission so Car can get TaskSnapshot.
4. Correct package path for shell.startingsurface.
5. Do not show starting window for home type.

Bug: 73289295
Bug: 131311659

Test: atest TaplTestsLauncher3
Test: atest WmTests StartingSurfaceDrawerTests TaskSnapshotWindowTest
Test: atest CtsWindowManagerDeviceTestCases
Change-Id: I89930d2e8a05cca6197c36c780ee1843fe454354
parent d52e491d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -126,6 +126,12 @@ public final class StartingWindowInfo implements Parcelable {
     */
    public int splashScreenThemeResId;

    /**
     * Is keyguard occluded on default display.
     * @hide
     */
    public boolean isKeyguardOccluded = false;

    public StartingWindowInfo() {

    }
@@ -147,6 +153,7 @@ public final class StartingWindowInfo implements Parcelable {
        dest.writeTypedObject(topOpaqueWindowLayoutParams, flags);
        dest.writeTypedObject(mainWindowLayoutParams, flags);
        dest.writeInt(splashScreenThemeResId);
        dest.writeBoolean(isKeyguardOccluded);
    }

    void readFromParcel(@NonNull Parcel source) {
@@ -157,6 +164,7 @@ public final class StartingWindowInfo implements Parcelable {
                WindowManager.LayoutParams.CREATOR);
        mainWindowLayoutParams = source.readTypedObject(WindowManager.LayoutParams.CREATOR);
        splashScreenThemeResId = source.readInt();
        isKeyguardOccluded = source.readBoolean();
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -18,4 +18,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.wm.shell">
    <uses-permission android:name="android.permission.ROTATE_SURFACE_FLINGER" />
    <uses-permission android:name="android.permission.READ_FRAME_BUFFER" />
</manifest>
+1 −7
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ public class StartingSurfaceDrawer {
        // the keyguard is being hidden. This is okay because starting windows never show
        // secret information.
        // TODO(b/113840485): Occluded may not only happen on default display
        if (displayId == DEFAULT_DISPLAY) {
        if (displayId == DEFAULT_DISPLAY && windowInfo.isKeyguardOccluded) {
            windowFlags |= WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
        }

@@ -343,12 +343,6 @@ public class StartingSurfaceDrawer {
            Slog.w(TAG, appToken + " already running, starting window not displayed. "
                    + e.getMessage());
            shouldSaveView = false;
        } catch (RuntimeException e) {
            // don't crash if something else bad happens, for example a
            // failure loading resources because we are loading from an app
            // on external storage that has been unmounted.
            Slog.w(TAG, appToken + " failed creating starting window", e);
            shouldSaveView = false;
        } finally {
            if (view != null && view.getParent() == null) {
                Slog.w(TAG, "view not successfully added to wm, removing view");
+2 −1
Original line number Diff line number Diff line
@@ -123,7 +123,8 @@ public class StartingWindowController {
                        + " allowTaskSnapshot " + allowTaskSnapshot
                        + " activityCreated " + activityCreated);
            }
            if (newTask || !processRunning || (taskSwitch && !activityCreated)) {
            if ((newTask || !processRunning || (taskSwitch && !activityCreated))
                    && windowInfo.taskInfo.topActivityType != ACTIVITY_TYPE_HOME) {
                return STARTING_WINDOW_TYPE_SPLASH_SCREEN;
            }
            if (taskSwitch && allowTaskSnapshot) {
+1 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package unittest.src.com.android.wm.shell.startingsurface;
package com.android.wm.shell.startingsurface;

import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
@@ -51,7 +51,6 @@ import androidx.test.platform.app.InstrumentationRegistry;
import com.android.wm.shell.common.HandlerExecutor;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.TransactionPool;
import com.android.wm.shell.startingsurface.StartingSurfaceDrawer;

import org.junit.Before;
import org.junit.Test;
Loading