Merge "Remove enterprise disclosure from lock screen"

This commit is contained in:
Lucas Dupin
2019-09-16 15:52:04 +00:00
committed by Android (Google) Code Review
4 changed files with 0 additions and 129 deletions

View File

@@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.systemui.statusbar.phone.KeyguardIndicationTextView
android:id="@+id/keyguard_indication_enterprise_disclosure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingStart="@dimen/keyguard_indication_text_padding"
android:paddingEnd="@dimen/keyguard_indication_text_padding"
android:textAppearance="@style/TextAppearance.Keyguard.BottomArea"
android:visibility="gone"/>
<com.android.systemui.statusbar.phone.KeyguardIndicationTextView
android:id="@+id/keyguard_indication_text"
android:layout_width="match_parent"

View File

@@ -16,8 +16,6 @@
package com.android.systemui.statusbar;
import static com.android.systemui.DejankUtils.whitelistIpcs;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.admin.DevicePolicyManager;
@@ -93,7 +91,6 @@ public class KeyguardIndicationController implements StateListener,
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private ViewGroup mIndicationArea;
private KeyguardIndicationTextView mTextView;
private KeyguardIndicationTextView mDisclosure;
private final UserManager mUserManager;
private final IBatteryStats mBatteryInfo;
private final SettableWakeLock mWakeLock;
@@ -180,7 +177,6 @@ public class KeyguardIndicationController implements StateListener,
mDevicePolicyManager = (DevicePolicyManager) context.getSystemService(
Context.DEVICE_POLICY_SERVICE);
setIndicationArea(indicationArea);
updateDisclosure();
mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback());
mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
@@ -193,7 +189,6 @@ public class KeyguardIndicationController implements StateListener,
mTextView = indicationArea.findViewById(R.id.keyguard_indication_text);
mInitialTextColorState = mTextView != null ?
mTextView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
mDisclosure = indicationArea.findViewById(R.id.keyguard_indication_enterprise_disclosure);
updateIndication(false /* animate */);
}
@@ -231,27 +226,6 @@ public class KeyguardIndicationController implements StateListener,
return mUpdateMonitorCallback;
}
private void updateDisclosure() {
if (mDevicePolicyManager == null) {
return;
}
// TODO(b/140053632)
if (!mDozing && whitelistIpcs(mDevicePolicyManager::isDeviceManaged)) {
final CharSequence organizationName =
mDevicePolicyManager.getDeviceOwnerOrganizationName();
if (organizationName != null) {
mDisclosure.switchIndication(mContext.getResources().getString(
R.string.do_disclosure_with_name, organizationName));
} else {
mDisclosure.switchIndication(R.string.do_disclosure_generic);
}
mDisclosure.setVisibility(View.VISIBLE);
} else {
mDisclosure.setVisibility(View.GONE);
}
}
public void setVisible(boolean visible) {
mVisible = visible;
mIndicationArea.setVisibility(visible ? View.VISIBLE : View.GONE);
@@ -580,7 +554,6 @@ public class KeyguardIndicationController implements StateListener,
}
mDozing = dozing;
updateIndication(false);
updateDisclosure();
}
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
@@ -639,13 +612,6 @@ public class KeyguardIndicationController implements StateListener,
}
}
@Override
public void onKeyguardVisibilityChanged(boolean showing) {
if (showing) {
updateDisclosure();
}
}
@Override
public void onBiometricHelp(int msgId, String helpString,
BiometricSourceType biometricSourceType) {

View File

@@ -120,7 +120,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private KeyguardAffordanceView mRightAffordanceView;
private KeyguardAffordanceView mLeftAffordanceView;
private ViewGroup mIndicationArea;
private TextView mEnterpriseDisclosure;
private TextView mIndicationText;
private ViewGroup mPreviewContainer;
private ViewGroup mOverlayContainer;
@@ -234,8 +233,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
mRightAffordanceView = findViewById(R.id.camera_button);
mLeftAffordanceView = findViewById(R.id.left_button);
mIndicationArea = findViewById(R.id.keyguard_indication_area);
mEnterpriseDisclosure = findViewById(
R.id.keyguard_indication_enterprise_disclosure);
mIndicationText = findViewById(R.id.keyguard_indication_text);
mIndicationBottomMargin = getResources().getDimensionPixelSize(
R.dimen.keyguard_indication_margin_bottom);
@@ -312,9 +309,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
}
// Respect font size setting.
mEnterpriseDisclosure.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimensionPixelSize(
com.android.internal.R.dimen.text_size_small_material));
mIndicationText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimensionPixelSize(
com.android.internal.R.dimen.text_size_small_material));

View File

@@ -27,7 +27,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import android.app.Instrumentation;
@@ -46,7 +45,6 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -68,17 +66,11 @@ import org.mockito.MockitoAnnotations;
@RunWith(AndroidJUnit4.class)
public class KeyguardIndicationControllerTest extends SysuiTestCase {
private final String ORGANIZATION_NAME = "organization";
private String mDisclosureWithOrganization;
@Mock
private DevicePolicyManager mDevicePolicyManager;
@Mock
private ViewGroup mIndicationArea;
@Mock
private KeyguardIndicationTextView mDisclosure;
@Mock
private LockIcon mLockIcon;
@Mock
private LockPatternUtils mLockPatternUtils;
@@ -107,11 +99,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
mContext.addMockSystemService(Context.DEVICE_POLICY_SERVICE, mDevicePolicyManager);
mContext.addMockSystemService(Context.TRUST_SERVICE, mock(TrustManager.class));
mContext.addMockSystemService(Context.FINGERPRINT_SERVICE, mock(FingerprintManager.class));
mDisclosureWithOrganization = mContext.getString(R.string.do_disclosure_with_name,
ORGANIZATION_NAME);
when(mIndicationArea.findViewById(R.id.keyguard_indication_enterprise_disclosure))
.thenReturn(mDisclosure);
when(mIndicationArea.findViewById(R.id.keyguard_indication_text)).thenReturn(mTextView);
mWakeLock = new WakeLockFake();
@@ -126,72 +114,6 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
mUnlockMethodCache, mStatusBarStateController, mKeyguardUpdateMonitor);
}
@Test
public void unmanaged() {
when(mDevicePolicyManager.isDeviceManaged()).thenReturn(false);
createController();
verify(mDisclosure).setVisibility(View.GONE);
verifyNoMoreInteractions(mDisclosure);
}
@Test
public void managedNoOwnerName() {
when(mDevicePolicyManager.isDeviceManaged()).thenReturn(true);
when(mDevicePolicyManager.getDeviceOwnerOrganizationName()).thenReturn(null);
createController();
verify(mDisclosure).setVisibility(View.VISIBLE);
verify(mDisclosure).switchIndication(R.string.do_disclosure_generic);
verifyNoMoreInteractions(mDisclosure);
}
@Test
public void managedOwnerName() {
when(mDevicePolicyManager.isDeviceManaged()).thenReturn(true);
when(mDevicePolicyManager.getDeviceOwnerOrganizationName()).thenReturn(ORGANIZATION_NAME);
createController();
verify(mDisclosure).setVisibility(View.VISIBLE);
verify(mDisclosure).switchIndication(mDisclosureWithOrganization);
verifyNoMoreInteractions(mDisclosure);
}
@Test
public void updateOnTheFly() {
when(mDevicePolicyManager.isDeviceManaged()).thenReturn(false);
createController();
final KeyguardUpdateMonitorCallback monitor = mController.getKeyguardCallback();
reset(mDisclosure);
when(mDevicePolicyManager.isDeviceManaged()).thenReturn(true);
when(mDevicePolicyManager.getDeviceOwnerOrganizationName()).thenReturn(null);
monitor.onKeyguardVisibilityChanged(true);
verify(mDisclosure).setVisibility(View.VISIBLE);
verify(mDisclosure).switchIndication(R.string.do_disclosure_generic);
verifyNoMoreInteractions(mDisclosure);
reset(mDisclosure);
when(mDevicePolicyManager.isDeviceManaged()).thenReturn(true);
when(mDevicePolicyManager.getDeviceOwnerOrganizationName()).thenReturn(ORGANIZATION_NAME);
monitor.onKeyguardVisibilityChanged(false);
monitor.onKeyguardVisibilityChanged(true);
verify(mDisclosure).setVisibility(View.VISIBLE);
verify(mDisclosure).switchIndication(mDisclosureWithOrganization);
verifyNoMoreInteractions(mDisclosure);
reset(mDisclosure);
when(mDevicePolicyManager.isDeviceManaged()).thenReturn(false);
monitor.onKeyguardVisibilityChanged(false);
monitor.onKeyguardVisibilityChanged(true);
verify(mDisclosure).setVisibility(View.GONE);
verifyNoMoreInteractions(mDisclosure);
}
@Test
public void transientIndication_holdsWakeLock_whenDozing() {
createController();