Snap for 5199742 from eb5e435dc6 to qt-release

Change-Id: I9eb9cfe1a6c45eca4ddc9db67cfaa345ce98e3e4
This commit is contained in:
android-build-team Robot
2018-12-25 04:09:09 +00:00
9 changed files with 32 additions and 27 deletions

View File

@@ -21,7 +21,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:icon="@drawable/ic_lock"
android:layout="@layout/suw_glif_blank_template"
android:layout="@layout/sud_glif_blank_template"
settings:suwHeaderText="@string/lock_settings_picker_title">
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient

View File

@@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:icon="@drawable/ic_lock"
android:layout="@layout/suw_glif_blank_template">
android:layout="@layout/sud_glif_blank_template">
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
android:id="@+id/topLayout"

View File

@@ -20,7 +20,7 @@
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/suw_glif_blank_template"
android:layout="@layout/sud_glif_blank_template"
style="?attr/fingerprint_layout_theme">
<ScrollView

View File

@@ -20,7 +20,7 @@
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/suw_glif_blank_template"
android:layout="@layout/sud_glif_blank_template"
style="?attr/fingerprint_layout_theme">
<LinearLayout

View File

@@ -20,7 +20,7 @@
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/suw_glif_blank_template"
android:layout="@layout/sud_glif_blank_template"
style="?attr/fingerprint_layout_theme">
<ScrollView

View File

@@ -22,7 +22,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:icon="@drawable/ic_lock"
android:layout="@layout/suw_glif_blank_template"
android:layout="@layout/sud_glif_blank_template"
settings:sucFooter="@layout/choose_lock_pattern_common_footer"
settings:suwHeaderText="@string/lockpassword_choose_your_screen_lock_header">

View File

@@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:icon="@drawable/ic_lock"
android:layout="@layout/suw_glif_blank_template">
android:layout="@layout/sud_glif_blank_template">
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
android:id="@+id/topLayout"

View File

@@ -43,7 +43,6 @@ import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.ScrollView;
@@ -51,7 +50,6 @@ import android.widget.ScrollView;
import androidx.fragment.app.FragmentActivity;
import com.android.settings.testutils.shadow.ShadowUtils;
import com.google.android.setupcompat.item.FooterButton;
import org.junit.Before;
import org.junit.Test;
@@ -387,7 +385,7 @@ public class MasterClearTest {
public void testOnGlobalLayout_shouldNotRemoveListener() {
final ViewTreeObserver viewTreeObserver = mock(ViewTreeObserver.class);
mMasterClear.mScrollView = mScrollView;
mMasterClear.mInitiateButton = mock(FooterButton.class);
doNothing().when(mMasterClear).onGlobalLayout();
doReturn(true).when(mMasterClear).hasReachedBottom(any());
when(mScrollView.getViewTreeObserver()).thenReturn(viewTreeObserver);

View File

@@ -18,13 +18,13 @@ package com.android.settings.applications.appinfo;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.robolectric.Shadows.shadowOf;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.UserManager;
import androidx.preference.Preference;
@@ -40,12 +40,15 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowActivity;
import org.robolectric.shadows.ShadowUserManager;
@RunWith(RobolectricTestRunner.class)
@Config(shadows = ShadowUserManager.class)
public class DefaultAppShortcutPreferenceControllerBaseTest {
@Mock
private UserManager mUserManager;
private ShadowUserManager mShadowUserManager;
@Mock
private AppInfoDashboardFragment mFragment;
@Mock
@@ -57,8 +60,8 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mActivity = spy(Robolectric.setupActivity(Activity.class));
when(mActivity.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
mActivity = Robolectric.setupActivity(Activity.class);
mShadowUserManager = shadowOf(mActivity.getSystemService(UserManager.class));
mController = new TestPreferenceController(mActivity, mFragment);
final String key = mController.getPreferenceKey();
when(mPreference.getKey()).thenReturn(key);
@@ -66,7 +69,7 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
@Test
public void getAvailabilityStatus_managedProfile_shouldReturnDisabled() {
when(mUserManager.isManagedProfile()).thenReturn(true);
mShadowUserManager.setManagedProfile(true);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(DefaultAppShortcutPreferenceControllerBase.DISABLED_FOR_USER);
@@ -75,7 +78,7 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
@Test
public void getAvailabilityStatus_hasAppCapability_shouldReturnAvailable() {
mController.capable = true;
when(mUserManager.isManagedProfile()).thenReturn(false);
mShadowUserManager.setManagedProfile(false);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(DefaultAppShortcutPreferenceControllerBase.AVAILABLE);
@@ -84,7 +87,7 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
@Test
public void getAvailabilityStatus_noAppCapability_shouldReturnDisabled() {
mController.capable = false;
when(mUserManager.isManagedProfile()).thenReturn(false);
mShadowUserManager.setManagedProfile(false);
assertThat(mController.getAvailabilityStatus()).isEqualTo(
DefaultAppShortcutPreferenceControllerBase.UNSUPPORTED_ON_DEVICE);
@@ -111,13 +114,17 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
@Test
public void handlePreferenceTreeClick_shouldStartDefaultAppSettings() {
final ShadowActivity shadowActivity = shadowOf(mActivity);
mController.handlePreferenceTreeClick(mPreference);
verify(mActivity).startActivity(argThat(intent -> intent != null
&& intent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT).equals(
DefaultAppSettings.class.getName())
&& intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS)
.getString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY).equals("TestKey")));
final Intent nextIntent = shadowActivity.getNextStartedActivity();
assertThat(nextIntent).isNotNull();
assertThat(nextIntent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT)).isEqualTo(
DefaultAppSettings.class.getName());
assertThat(
nextIntent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS).getString(
SettingsActivity.EXTRA_FRAGMENT_ARG_KEY)).isEqualTo("TestKey");
}
private class TestPreferenceController extends DefaultAppShortcutPreferenceControllerBase {