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

Commit cf0a1159 authored by Adam Powell's avatar Adam Powell Committed by Android Git Automerger
Browse files

am 43a372f3: Keyguard transport controls: fullscreen art

* commit '43a372f3':
  Keyguard transport controls: fullscreen art
parents aaee139c 43a372f3
Loading
Loading
Loading
Loading
+8 −14
Original line number Diff line number Diff line
@@ -22,12 +22,6 @@
    android:gravity="center_horizontal"
    android:id="@+id/keyguard_transport_control">

    <!-- FrameLayout used as scrim to show between album art and buttons -->
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:foreground="@drawable/ic_lockscreen_player_background"
        android:contentDescription="@string/keygaurd_accessibility_media_controls">
    <!-- Use ImageView for its cropping features; otherwise could be android:background -->
    <ImageView
        android:id="@+id/albumart"
@@ -36,8 +30,8 @@
        android:layout_gravity="fill"
        android:scaleType="centerCrop"
        android:adjustViewBounds="false"
        />
    </FrameLayout>
        android:contentDescription="@string/keygaurd_accessibility_media_controls" />


    <LinearLayout
        android:orientation="vertical"
+1 −0
Original line number Diff line number Diff line
@@ -1483,6 +1483,7 @@ public class KeyguardHostView extends KeyguardViewBase {
            if (DEBUGXPORT) Log.v(TAG, "remove transport");
            mAppWidgetContainer.removeWidget(getOrCreateTransportControl());
            mTransportControl = null;
            KeyguardUpdateMonitor.getInstance(getContext()).dispatchSetBackground(null);
        }
    }

+7 −6
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.text.Spannable;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
@@ -98,11 +99,9 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick

            case MSG_SET_ARTWORK:
                if (mClientGeneration == msg.arg1) {
                    if (mMetadata.bitmap != null) {
                        mMetadata.bitmap.recycle();
                    }
                    mMetadata.bitmap = (Bitmap) msg.obj;
                    mAlbumArt.setImageBitmap(mMetadata.bitmap);
                    KeyguardUpdateMonitor.getInstance(getContext()).dispatchSetBackground(
                            mMetadata.bitmap);
                }
                break;

@@ -223,7 +222,8 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick
    @Override
    protected void onSizeChanged (int w, int h, int oldw, int oldh) {
        if (mAttached) {
            int dim = Math.min(512, Math.max(w, h));
            final DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
            int dim = Math.max(dm.widthPixels, dm.heightPixels);
            if (DEBUG) Log.v(TAG, "TCV uses bitmap size=" + dim);
            mAudioManager.remoteControlDisplayUsesBitmapSize(mIRCD, dim, dim);
        }
@@ -300,7 +300,8 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick
                    Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }

        mAlbumArt.setImageBitmap(mMetadata.bitmap);
        KeyguardUpdateMonitor.getInstance(getContext()).dispatchSetBackground(
                mMetadata.bitmap);
        final int flags = mTransportControlFlags;
        setVisibilityBasedOnFlag(mBtnPrev, flags, RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS);
        setVisibilityBasedOnFlag(mBtnNext, flags, RemoteControlClient.FLAG_KEY_MEDIA_NEXT);
+14 −0
Original line number Diff line number Diff line
@@ -407,6 +407,20 @@ public class KeyguardUpdateMonitor {
        return sInstance;
    }

    /**
     * IMPORTANT: Must be called from UI thread.
     */
    public void dispatchSetBackground(Bitmap bmp) {
        if (DEBUG) Log.d(TAG, "dispatchSetBackground");
        final int count = mCallbacks.size();
        for (int i = 0; i < count; i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
                cb.onSetBackground(bmp);
            }
        }
    }

    protected void handleSetGenerationId(int clientGeneration, boolean clearing, PendingIntent p) {
        mDisplayClientState.clientGeneration = clientGeneration;
        mDisplayClientState.clearing = clearing;
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.keyguard;

import android.app.PendingIntent;
import android.app.admin.DevicePolicyManager;
import android.graphics.Bitmap;
import android.media.AudioManager;

import com.android.internal.telephony.IccCardConstants;
@@ -135,4 +136,8 @@ class KeyguardUpdateMonitorCallback {
     * Called when the emergency call button is pressed.
     */
    void onEmergencyCallAction() { }

    public void onSetBackground(Bitmap bitmap) {
        // THIS SPACE FOR RENT
    }
}
Loading