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

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

release-request-a2143a0f-bf92-4fa8-ad68-7346e7505126-for-git_oc-dr1-release-40...

release-request-a2143a0f-bf92-4fa8-ad68-7346e7505126-for-git_oc-dr1-release-4067638 snap-temp-L84900000070511178

Change-Id: Id7e8a8677c0fa8775b5531479073375d2afdf8ab
parents 58d31c8d 4b763aa8
Loading
Loading
Loading
Loading
+36 −27
Original line number Diff line number Diff line
@@ -56,20 +56,8 @@ import java.util.concurrent.TimeUnit;
@LargeTest
@RunWith(AndroidJUnit4.class)
public class UserLifecycleTest {
    private final int TIMEOUT_REMOVE_USER_MS = 4 * 1000; // 4 sec
    private final int CHECK_USER_REMOVED_INTERVAL_MS = 200; // 0.2 sec

    private final int TIMEOUT_USER_START_SEC = 4; // 4 sec

    private final int TIMEOUT_USER_SWITCH_SEC = 8; // 8 sec

    private final int TIMEOUT_USER_STOP_SEC = 1; // 1 sec

    private final int TIMEOUT_MANAGED_PROFILE_UNLOCK_SEC = 2; // 2 sec

    private final int TIMEOUT_LOCKED_BOOT_COMPLETE_MS = 5 * 1000; // 5 sec

    private final int TIMEOUT_EPHERMAL_USER_STOP_SEC = 6; // 6 sec
    private final int TIMEOUT_IN_SECOND = 10;
    private final int CHECK_USER_REMOVED_INTERVAL_MS = 200;

    private UserManager mUm;
    private ActivityManager mAm;
@@ -109,7 +97,7 @@ public class UserLifecycleTest {
            final CountDownLatch latch = new CountDownLatch(1);
            registerBroadcastReceiver(Intent.ACTION_USER_STARTED, latch, userInfo.id);
            mIam.startUserInBackground(userInfo.id);
            latch.await(TIMEOUT_USER_START_SEC, TimeUnit.SECONDS);
            latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);

            mState.pauseTiming();
            removeUser(userInfo.id);
@@ -142,10 +130,10 @@ public class UserLifecycleTest {
            final CountDownLatch latch = new CountDownLatch(1);
            registerBroadcastReceiver(Intent.ACTION_USER_STARTED, latch, userInfo.id);
            mIam.startUserInBackground(userInfo.id);
            latch.await(TIMEOUT_USER_START_SEC, TimeUnit.SECONDS);
            latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
            mState.resumeTiming();

            stopUser(userInfo.id);
            stopUser(userInfo.id, false);

            mState.pauseTiming();
            removeUser(userInfo.id);
@@ -164,7 +152,7 @@ public class UserLifecycleTest {
            mState.resumeTiming();

            mAm.switchUser(userInfo.id);
            latch.await(TIMEOUT_LOCKED_BOOT_COMPLETE_MS, TimeUnit.SECONDS);
            latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);

            mState.pauseTiming();
            switchUser(startUser);
@@ -184,7 +172,7 @@ public class UserLifecycleTest {
            mState.resumeTiming();

            mIam.startUserInBackground(userInfo.id);
            latch.await(TIMEOUT_MANAGED_PROFILE_UNLOCK_SEC, TimeUnit.SECONDS);
            latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);

            mState.pauseTiming();
            removeUser(userInfo.id);
@@ -215,10 +203,30 @@ public class UserLifecycleTest {
            mState.resumeTiming();

            mAm.switchUser(startUser);
            latch.await(TIMEOUT_EPHERMAL_USER_STOP_SEC, TimeUnit.SECONDS);
            latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);

            mState.pauseTiming();
            switchLatch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
            removeUser(userInfo.id);
            mState.resumeTiming();
        }
    }

    @Test
    public void managedProfileStoppedPerf() throws Exception {
        while (mState.keepRunning()) {
            mState.pauseTiming();
            final UserInfo userInfo = mUm.createProfileForUser("TestUser",
                    UserInfo.FLAG_MANAGED_PROFILE, mAm.getCurrentUser());
            final CountDownLatch latch = new CountDownLatch(1);
            registerBroadcastReceiver(Intent.ACTION_USER_UNLOCKED, latch, userInfo.id);
            mIam.startUserInBackground(userInfo.id);
            latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
            mState.resumeTiming();

            stopUser(userInfo.id, true);

            mState.pauseTiming();
            switchLatch.await(TIMEOUT_USER_SWITCH_SEC, TimeUnit.SECONDS);
            removeUser(userInfo.id);
            mState.resumeTiming();
        }
@@ -228,12 +236,12 @@ public class UserLifecycleTest {
        final CountDownLatch latch = new CountDownLatch(1);
        registerUserSwitchObserver(latch, null, userId);
        mAm.switchUser(userId);
        latch.await(TIMEOUT_USER_SWITCH_SEC, TimeUnit.SECONDS);
        latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
    }

    private void stopUser(int userId) throws Exception {
    private void stopUser(int userId, boolean force) throws Exception {
        final CountDownLatch latch = new CountDownLatch(1);
        mIam.stopUser(userId, false /* force */, new IStopUserCallback.Stub() {
        mIam.stopUser(userId, force /* force */, new IStopUserCallback.Stub() {
            @Override
            public void userStopped(int userId) throws RemoteException {
                latch.countDown();
@@ -243,7 +251,7 @@ public class UserLifecycleTest {
            public void userStopAborted(int userId) throws RemoteException {
            }
        });
        latch.await(TIMEOUT_USER_STOP_SEC, TimeUnit.SECONDS);
        latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
    }

    private void registerUserSwitchObserver(final CountDownLatch switchLatch,
@@ -283,9 +291,10 @@ public class UserLifecycleTest {
        try {
            mUm.removeUser(userId);
            final long startTime = System.currentTimeMillis();
            final long timeoutInMs = TIMEOUT_IN_SECOND * 1000;
            while (mUm.getUserInfo(userId) != null &&
                    System.currentTimeMillis() - startTime < TIMEOUT_REMOVE_USER_MS) {
                Thread.sleep(CHECK_USER_REMOVED_INTERVAL_MS);
                    System.currentTimeMillis() - startTime < timeoutInMs) {
                TimeUnit.MILLISECONDS.sleep(CHECK_USER_REMOVED_INTERVAL_MS);
            }
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
+5 −0
Original line number Diff line number Diff line
@@ -44874,10 +44874,13 @@ package android.view {
  public final class KeyboardShortcutGroup implements android.os.Parcelable {
    ctor public KeyboardShortcutGroup(java.lang.CharSequence, java.util.List<android.view.KeyboardShortcutInfo>);
    ctor public KeyboardShortcutGroup(java.lang.CharSequence);
    ctor public KeyboardShortcutGroup(java.lang.CharSequence, java.util.List<android.view.KeyboardShortcutInfo>, boolean);
    ctor public KeyboardShortcutGroup(java.lang.CharSequence, boolean);
    method public void addItem(android.view.KeyboardShortcutInfo);
    method public int describeContents();
    method public java.util.List<android.view.KeyboardShortcutInfo> getItems();
    method public java.lang.CharSequence getLabel();
    method public boolean isSystemGroup();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.view.KeyboardShortcutGroup> CREATOR;
  }
@@ -47156,6 +47159,7 @@ package android.view {
    method public void setColorMode(int);
    method public final void setTitle(java.lang.CharSequence);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ACCESSIBILITY_TITLE_CHANGED = 33554432; // 0x2000000
    field public static final int ALPHA_CHANGED = 128; // 0x80
    field public static final int ANIMATION_CHANGED = 16; // 0x10
    field public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
@@ -47257,6 +47261,7 @@ package android.view {
    field public static final deprecated int TYPE_SYSTEM_OVERLAY = 2006; // 0x7d6
    field public static final deprecated int TYPE_TOAST = 2005; // 0x7d5
    field public static final int TYPE_WALLPAPER = 2013; // 0x7dd
    field public java.lang.CharSequence accessibilityTitle;
    field public float alpha;
    field public float buttonBrightness;
    field public float dimAmount;
+38 −1
Original line number Diff line number Diff line
@@ -33,17 +33,24 @@
#include <ui/DisplayInfo.h>
#include <ui/PixelFormat.h>

#include <system/graphics.h>

// TODO: Fix Skia.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <SkImageEncoder.h>
#include <SkData.h>
#include <SkColorSpace.h>
#pragma GCC diagnostic pop

using namespace android;

static uint32_t DEFAULT_DISPLAY_ID = ISurfaceComposer::eDisplayIdMain;

#define COLORSPACE_UNKNOWN    0
#define COLORSPACE_SRGB       1
#define COLORSPACE_DISPLAY_P3 2

static void usage(const char* pname)
{
    fprintf(stderr,
@@ -67,6 +74,31 @@ static SkColorType flinger2skia(PixelFormat f)
    }
}

static sk_sp<SkColorSpace> dataSpaceToColorSpace(android_dataspace d)
{
    switch (d) {
        case HAL_DATASPACE_V0_SRGB:
            return SkColorSpace::MakeSRGB();
        case HAL_DATASPACE_DISPLAY_P3:
            return SkColorSpace::MakeRGB(
                    SkColorSpace::kSRGB_RenderTargetGamma, SkColorSpace::kDCIP3_D65_Gamut);
        default:
            return nullptr;
    }
}

static uint32_t dataSpaceToInt(android_dataspace d)
{
    switch (d) {
        case HAL_DATASPACE_V0_SRGB:
            return COLORSPACE_SRGB;
        case HAL_DATASPACE_DISPLAY_P3:
            return COLORSPACE_DISPLAY_P3;
        default:
            return COLORSPACE_UNKNOWN;
    }
}

static status_t notifyMediaScanner(const char* fileName) {
    String8 cmd("am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://");
    String8 fileUrl("\"");
@@ -139,6 +171,7 @@ int main(int argc, char** argv)

    void const* base = NULL;
    uint32_t w, s, h, f;
    android_dataspace d;
    size_t size = 0;

    // Maps orientations from DisplayInfo to ISurfaceComposer
@@ -177,13 +210,15 @@ int main(int argc, char** argv)
        h = screenshot.getHeight();
        s = screenshot.getStride();
        f = screenshot.getFormat();
        d = screenshot.getDataSpace();
        size = screenshot.getSize();
    }

    if (base != NULL) {
        if (png) {
            const SkImageInfo info =
                SkImageInfo::Make(w, h, flinger2skia(f), kPremul_SkAlphaType);
                SkImageInfo::Make(w, h, flinger2skia(f), kPremul_SkAlphaType,
                    dataSpaceToColorSpace(d));
            SkPixmap pixmap(info, base, s * bytesPerPixel(f));
            struct FDWStream final : public SkWStream {
              size_t fBytesWritten = 0;
@@ -200,9 +235,11 @@ int main(int argc, char** argv)
                notifyMediaScanner(fn);
            }
        } else {
            uint32_t c = dataSpaceToInt(d);
            write(fd, &w, 4);
            write(fd, &h, 4);
            write(fd, &f, 4);
            write(fd, &c, 4);
            size_t Bpp = bytesPerPixel(f);
            for (size_t y=0 ; y<h ; y++) {
                write(fd, base, w*Bpp);
+21 −4
Original line number Diff line number Diff line
@@ -300,6 +300,19 @@ public class ActivityManager {
     */
    public static final int START_INTENT_NOT_RESOLVED = FIRST_START_FATAL_ERROR_CODE + 9;

    /**
     * Result for IActivityManager.startAssistantActivity: active session is currently hidden.
     * @hide
     */
    public static final int START_ASSISTANT_HIDDEN_SESSION = FIRST_START_FATAL_ERROR_CODE + 10;

    /**
     * Result for IActivityManager.startAssistantActivity: active session does not match
     * the requesting token.
     * @hide
     */
    public static final int START_ASSISTANT_NOT_ACTIVE_SESSION = FIRST_START_FATAL_ERROR_CODE + 11;

    /**
     * Result for IActivityManaqer.startActivity: the activity was started
     * successfully as normal.
@@ -1155,8 +1168,12 @@ public class ActivityManager {
     * E.g. freeform, split-screen, picture-in-picture.
     * @hide
     */
    static public boolean supportsMultiWindow() {
        return !isLowRamDeviceStatic()
    static public boolean supportsMultiWindow(Context context) {
        // On watches, multi-window is used to present essential system UI, and thus it must be
        // supported regardless of device memory characteristics.
        boolean isWatch = context.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_WATCH);
        return (!isLowRamDeviceStatic() || isWatch)
                && Resources.getSystem().getBoolean(
                    com.android.internal.R.bool.config_supportsMultiWindow);
    }
@@ -1165,8 +1182,8 @@ public class ActivityManager {
     * Returns true if the system supports split screen multi-window.
     * @hide
     */
    static public boolean supportsSplitScreenMultiWindow() {
        return supportsMultiWindow()
    static public boolean supportsSplitScreenMultiWindow(Context context) {
        return supportsMultiWindow(context)
                && Resources.getSystem().getBoolean(
                    com.android.internal.R.bool.config_supportsSplitScreenMultiWindow);
    }
+7 −5
Original line number Diff line number Diff line
@@ -932,7 +932,7 @@ public class ActivityOptions {
     * @hide
     */
    public GraphicBuffer getThumbnail() {
        return mThumbnail.createGraphicBufferHandle();
        return mThumbnail != null ? mThumbnail.createGraphicBufferHandle() : null;
    }

    /** @hide */
@@ -1243,11 +1243,13 @@ public class ActivityOptions {
            case ANIM_THUMBNAIL_ASPECT_SCALE_DOWN:
                // Once we parcel the thumbnail for transfering over to the system, create a copy of
                // the bitmap to a hardware bitmap and pass through the GraphicBuffer
                if (mThumbnail == null) {
                    b.putParcelable(KEY_ANIM_THUMBNAIL, null);
                } else {
                if (mThumbnail != null) {
                    final Bitmap hwBitmap = mThumbnail.copy(Config.HARDWARE, true /* immutable */);
                    if (hwBitmap != null) {
                        b.putParcelable(KEY_ANIM_THUMBNAIL, hwBitmap.createGraphicBufferHandle());
                    } else {
                        Slog.w(TAG, "Failed to copy thumbnail");
                    }
                }
                b.putInt(KEY_ANIM_START_X, mStartX);
                b.putInt(KEY_ANIM_START_Y, mStartY);
Loading