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

Commit f3fcf5ab authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge "Fixed keyguard inflation problem" into oc-mr1-dev am: 3163ba74

am: 85844688

Change-Id: I57474e7da639afb306b98fe75f462d6d5d72c332
parents fa3da602 85844688
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;

import com.android.internal.widget.LockPatternUtils;
@@ -247,12 +248,16 @@ public class KeyguardBouncer {
        removeView();
        mHandler.removeCallbacks(mRemoveViewRunnable);
        mRoot = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.keyguard_bouncer, null);
        mKeyguardView = (KeyguardHostView) mRoot.findViewById(R.id.keyguard_host_view);
        mKeyguardView = mRoot.findViewById(R.id.keyguard_host_view);
        mKeyguardView.setLockPatternUtils(mLockPatternUtils);
        mKeyguardView.setViewMediatorCallback(mCallback);
        mContainer.addView(mRoot, mContainer.getChildCount());
        mRoot.setVisibility(View.INVISIBLE);
        mRoot.dispatchApplyWindowInsets(mRoot.getRootWindowInsets());

        final WindowInsets rootInsets = mRoot.getRootWindowInsets();
        if (rootInsets != null) {
            mRoot.dispatchApplyWindowInsets(rootInsets);
        }
    }

    protected void removeView() {
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ public abstract class SysuiTestCase {
    @Before
    public void SysuiSetup() throws Exception {
        System.setProperty("dexmaker.share_classloader", "true");
        mContext.setTheme(R.style.Theme_SystemUI);
        SystemUIFactory.createFromConfig(mContext);

        mRealInstrumentation = InstrumentationRegistry.getInstrumentation();
+54 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package com.android.systemui.statusbar.phone;

import static org.mockito.Mockito.mock;

import android.content.Context;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
import android.test.UiThreadTest;
import android.view.ContextThemeWrapper;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.keyguard.DismissCallbackRegistry;

import org.junit.Test;
import org.junit.runner.RunWith;

@SmallTest
@RunWith(AndroidJUnit4.class)
public class KeyguardBouncerTest extends SysuiTestCase {

    @UiThreadTest
    @Test
    public void inflateDetached() {
        final ViewGroup container = new FrameLayout(getContext());
        final KeyguardBouncer bouncer = new KeyguardBouncer(getContext(),
                mock(ViewMediatorCallback.class), mock(LockPatternUtils.class), container, mock(
                DismissCallbackRegistry.class));

        // Detached bouncer should still be able to be inflated
        bouncer.inflateView();
    }

}