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

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

Merge cherrypicks of ['googleplex-android-review.googlesource.com/23877262',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/23877262', 'googleplex-android-review.googlesource.com/23875484', 'googleplex-android-review.googlesource.com/23907042', 'googleplex-android-review.googlesource.com/23912844'] into udc-release.

Change-Id: I6de57a74166f0c5b04cb2d2b908f9a4150a74b0f
parents f36c0f29 2f708883
Loading
Loading
Loading
Loading
+16 −19
Original line number Diff line number Diff line
@@ -90,8 +90,8 @@ public:
                                           requireUnpremul, prefColorSpace);
    }

    bool decodeGainmapRegion(sp<uirenderer::Gainmap>* outGainmap, const SkIRect& desiredSubset,
                             int sampleSize, bool requireUnpremul) {
    bool decodeGainmapRegion(sp<uirenderer::Gainmap>* outGainmap, int outWidth, int outHeight,
                             const SkIRect& desiredSubset, int sampleSize, bool requireUnpremul) {
        SkColorType decodeColorType = mGainmapBRD->computeOutputColorType(kN32_SkColorType);
        sk_sp<SkColorSpace> decodeColorSpace =
                mGainmapBRD->computeOutputColorSpace(decodeColorType, nullptr);
@@ -109,9 +109,8 @@ public:
        // kPremul_SkAlphaType is used just as a placeholder as it doesn't change the underlying
        // allocation type. RecyclingClippingPixelAllocator will populate this with the
        // actual alpha type in either allocPixelRef() or copyIfNecessary()
        sk_sp<Bitmap> nativeBitmap = Bitmap::allocateHeapBitmap(
                SkImageInfo::Make(desiredSubset.width(), desiredSubset.height(), decodeColorType,
                                  kPremul_SkAlphaType, decodeColorSpace));
        sk_sp<Bitmap> nativeBitmap = Bitmap::allocateHeapBitmap(SkImageInfo::Make(
                outWidth, outHeight, decodeColorType, kPremul_SkAlphaType, decodeColorSpace));
        if (!nativeBitmap) {
            ALOGE("OOM allocating Bitmap for Gainmap");
            return false;
@@ -134,9 +133,12 @@ public:
        return true;
    }

    SkIRect calculateGainmapRegion(const SkIRect& mainImageRegion) {
    SkIRect calculateGainmapRegion(const SkIRect& mainImageRegion, int* inOutWidth,
                                   int* inOutHeight) {
        const float scaleX = ((float)mGainmapBRD->width()) / mMainImageBRD->width();
        const float scaleY = ((float)mGainmapBRD->height()) / mMainImageBRD->height();
        *inOutWidth *= scaleX;
        *inOutHeight *= scaleY;
        // TODO: Account for rounding error?
        return SkIRect::MakeLTRB(mainImageRegion.left() * scaleX, mainImageRegion.top() * scaleY,
                                 mainImageRegion.right() * scaleX,
@@ -328,21 +330,16 @@ static jobject nativeDecodeRegion(JNIEnv* env, jobject, jlong brdHandle, jint in
    sp<uirenderer::Gainmap> gainmap;
    bool hasGainmap = brd->hasGainmap();
    if (hasGainmap) {
        SkIRect adjustedSubset{};
        int gainmapWidth = bitmap.width();
        int gainmapHeight = bitmap.height();
        if (javaBitmap) {
            // Clamp to the width/height of the recycled bitmap in case the reused bitmap
            // was too small for the specified rectangle, in which case we need to clip
            adjustedSubset = SkIRect::MakeXYWH(inputX, inputY,
                                               std::min(subset.width(), recycledBitmap->width()),
                                               std::min(subset.height(), recycledBitmap->height()));
        } else {
            // We are not recycling, so use the decoded width/height for calculating the gainmap
            // subset instead to ensure the gainmap region proportionally matches
            adjustedSubset = SkIRect::MakeXYWH(std::max(0, inputX), std::max(0, inputY),
                                               bitmap.width(), bitmap.height());
            // If we are recycling we must match the inBitmap's relative dimensions
            gainmapWidth = recycledBitmap->width();
            gainmapHeight = recycledBitmap->height();
        }
        SkIRect gainmapSubset = brd->calculateGainmapRegion(adjustedSubset);
        if (!brd->decodeGainmapRegion(&gainmap, gainmapSubset, sampleSize, requireUnpremul)) {
        SkIRect gainmapSubset = brd->calculateGainmapRegion(subset, &gainmapWidth, &gainmapHeight);
        if (!brd->decodeGainmapRegion(&gainmap, gainmapWidth, gainmapHeight, gainmapSubset,
                                      sampleSize, requireUnpremul)) {
            // If there is an error decoding Gainmap - we don't fail. We just don't provide Gainmap
            hasGainmap = false;
        }
+12 −2
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor;
import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor;
import com.android.systemui.keyguard.shared.model.TransitionStep;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -112,6 +113,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
    @NonNull private final VibratorHelper mVibrator;
    @Nullable private final AuthRippleController mAuthRippleController;
    @NonNull private final FeatureFlags mFeatureFlags;
    @NonNull private final PrimaryBouncerInteractor mPrimaryBouncerInteractor;
    @NonNull private final KeyguardTransitionInteractor mTransitionInteractor;
    @NonNull private final KeyguardInteractor mKeyguardInteractor;

@@ -180,7 +182,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
            @NonNull @Main Resources resources,
            @NonNull KeyguardTransitionInteractor transitionInteractor,
            @NonNull KeyguardInteractor keyguardInteractor,
            @NonNull FeatureFlags featureFlags
            @NonNull FeatureFlags featureFlags,
            PrimaryBouncerInteractor primaryBouncerInteractor
    ) {
        super(view);
        mStatusBarStateController = statusBarStateController;
@@ -197,6 +200,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
        mTransitionInteractor = transitionInteractor;
        mKeyguardInteractor = keyguardInteractor;
        mFeatureFlags = featureFlags;
        mPrimaryBouncerInteractor = primaryBouncerInteractor;

        mMaxBurnInOffsetX = resources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_x);
        mMaxBurnInOffsetY = resources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_y);
@@ -325,8 +329,14 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
            mView.setContentDescription(null);
        }

        boolean accessibilityEnabled =
                !mPrimaryBouncerInteractor.isAnimatingAway() && mView.isVisibleToUser();
        mView.setImportantForAccessibility(
                accessibilityEnabled ? View.IMPORTANT_FOR_ACCESSIBILITY_YES
                        : View.IMPORTANT_FOR_ACCESSIBILITY_NO);

        if (!Objects.equals(prevContentDescription, mView.getContentDescription())
                && mView.getContentDescription() != null && mView.isVisibleToUser()) {
                && mView.getContentDescription() != null && accessibilityEnabled) {
            mView.announceForAccessibility(mView.getContentDescription());
        }
    }
+7 −1
Original line number Diff line number Diff line
@@ -589,6 +589,13 @@ public class UdfpsController implements DozeReceiver, Dumpable {

                // Pilfer if valid overlap, don't allow following events to reach keyguard
                shouldPilfer = true;

                // Touch is a valid UDFPS touch. Inform the falsing manager so that the touch
                // isn't counted against the falsing algorithm as an accidental touch.
                // We do this on the DOWN event instead of CANCEL/UP because the CANCEL/UP events
                // get sent too late to this receiver (after the actual cancel/up motions occur),
                // and therefore wouldn't end up being used as part of the falsing algo.
                mFalsingManager.isFalseTouch(UDFPS_AUTHENTICATION);
                break;

            case UP:
@@ -608,7 +615,6 @@ public class UdfpsController implements DozeReceiver, Dumpable {
                        data.getTime(),
                        data.getGestureStart(),
                        mStatusBarStateController.isDozing());
                mFalsingManager.isFalseTouch(UDFPS_AUTHENTICATION);
                break;

            case UNCHANGED:
+7 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings.Global;
@@ -122,7 +123,12 @@ public class ZenModeControllerImpl implements ZenModeController, Dumpable {
                userTracker.getUserId()) {
            @Override
            protected void handleValueChanged(int value, boolean observedChange) {
                try {
                    Trace.beginSection("updateZenModeConfig");
                    updateZenModeConfig();
                } finally {
                    Trace.endSection();
                }
            }
        };
        mNoMan = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
+5 −1
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository;
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor;
import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.CommandQueue;
@@ -95,6 +96,8 @@ public class LockIconViewControllerBaseTest extends SysuiTestCase {
    protected @Mock KeyguardTransitionRepository mTransitionRepository;
    protected @Mock CommandQueue mCommandQueue;
    protected FakeExecutor mDelayableExecutor = new FakeExecutor(new FakeSystemClock());
    protected @Mock PrimaryBouncerInteractor mPrimaryBouncerInteractor;


    protected LockIconViewController mUnderTest;

@@ -167,7 +170,8 @@ public class LockIconViewControllerBaseTest extends SysuiTestCase {
                        mFeatureFlags,
                        new FakeKeyguardBouncerRepository()
                ),
                mFeatureFlags
                mFeatureFlags,
                mPrimaryBouncerInteractor
        );
    }

Loading