Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +7 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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() { Loading packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java +1 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java 0 → 100644 +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(); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +7 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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() { Loading
packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java +1 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java 0 → 100644 +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(); } }