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

Commit fd8c388f authored by Michael Jurka's avatar Michael Jurka Committed by Android (Google) Code Review
Browse files

Merge "Fix bug where newly added widget wasn't always shown" into jb-mr1-lockscreen-dev

parents 3e66286f 14138895
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -790,6 +790,9 @@ public class KeyguardHostView extends KeyguardViewBase {
        // Once the screen turns off, we no longer consider this to be first boot and we want the
        // biometric unlock to start next time keyguard is shown.
        KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
        // We use mAppWidgetToShow to show a particular widget after you add it-- once the screen
        // turns off we reset that behavior
        clearAppWidgetToShow();
        checkAppWidgetConsistency();
        showPrimarySecurityScreen(true);
        getSecurityView(mCurrentSecuritySelection).onPause();
@@ -799,6 +802,10 @@ public class KeyguardHostView extends KeyguardViewBase {
        }
    }

    public void clearAppWidgetToShow() {
        mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
    }

    @Override
    public void show() {
        if (DEBUG) Log.d(TAG, "show()");
@@ -1176,6 +1183,7 @@ public class KeyguardHostView extends KeyguardViewBase {

    static class SavedState extends BaseSavedState {
        int transportState;
        int appWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;

        SavedState(Parcelable superState) {
            super(superState);
@@ -1184,12 +1192,14 @@ public class KeyguardHostView extends KeyguardViewBase {
        private SavedState(Parcel in) {
            super(in);
            this.transportState = in.readInt();
            this.appWidgetToShow = in.readInt();
        }

        @Override
        public void writeToParcel(Parcel out, int flags) {
            super.writeToParcel(out, flags);
            out.writeInt(this.transportState);
            out.writeInt(this.appWidgetToShow);
        }

        public static final Parcelable.Creator<SavedState> CREATOR
@@ -1210,6 +1220,7 @@ public class KeyguardHostView extends KeyguardViewBase {
        Parcelable superState = super.onSaveInstanceState();
        SavedState ss = new SavedState(superState);
        ss.transportState = mViewStateManager.getTransportState();
        ss.appWidgetToShow = mAppWidgetToShow;
        return ss;
    }

@@ -1223,6 +1234,7 @@ public class KeyguardHostView extends KeyguardViewBase {
        SavedState ss = (SavedState) state;
        super.onRestoreInstanceState(ss.getSuperState());
        mViewStateManager.setTransportState(ss.transportState);
        mAppWidgetToShow = ss.appWidgetToShow;
        post(mSwitchPageRunnable);
    }

@@ -1275,7 +1287,6 @@ public class KeyguardHostView extends KeyguardViewBase {
            for (int i = 0; i < childCount; i++) {
                if (mAppWidgetContainer.getWidgetPageAt(i).getContentAppWidgetId()
                        == mAppWidgetToShow) {
                    mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
                    return i;
                }
            }
+6 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.internal.policy.impl.keyguard;

import android.appwidget.AppWidgetManager;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
@@ -115,6 +116,11 @@ public class KeyguardViewStateManager implements
            scl.fadeOutChallenge();
            mPageIndexOnPageBeginMoving = mKeyguardWidgetPager.getCurrentPage();
        }
        // We use mAppWidgetToShow to show a particular widget after you add it--
        // once the user swipes a page we clear that behavior
        if (mKeyguardHostView != null) {
            mKeyguardHostView.clearAppWidgetToShow();
        }
        if (mHideHintsRunnable != null) {
            mMainQueue.removeCallbacks(mHideHintsRunnable);
            mHideHintsRunnable = null;