diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 0414de6eb7ca2..5f8df5a13ad1d 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1054,6 +1054,9 @@
This device belongs to %s
+
+ This device is provided by %s
+
Swipe from icon for phone
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 7e2d27ac728aa..a4e97a1dc6d54 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar;
+import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
@@ -41,6 +42,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.UserInfo;
import android.content.res.ColorStateList;
+import android.content.res.Resources;
import android.graphics.Color;
import android.hardware.biometrics.BiometricSourceType;
import android.hardware.face.FaceManager;
@@ -277,10 +279,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
// avoid calling this method since it has an IPC
if (whitelistIpcs(this::isOrganizationOwnedDevice)) {
final CharSequence organizationName = getOrganizationOwnedDeviceOrganizationName();
- final CharSequence disclosure = organizationName != null
- ? mContext.getResources().getString(R.string.do_disclosure_with_name,
- organizationName)
- : mContext.getResources().getText(R.string.do_disclosure_generic);
+ final CharSequence disclosure = getDisclosureText(organizationName);
mRotateTextViewController.updateIndication(
INDICATION_TYPE_DISCLOSURE,
new KeyguardIndication.Builder()
@@ -297,6 +296,22 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
}
}
+ private CharSequence getDisclosureText(@Nullable CharSequence organizationName) {
+ final Resources packageResources = mContext.getResources();
+ if (organizationName == null) {
+ return packageResources.getText(R.string.do_disclosure_generic);
+ } else if (mDevicePolicyManager.isDeviceManaged()
+ && mDevicePolicyManager.getDeviceOwnerType(
+ mDevicePolicyManager.getDeviceOwnerComponentOnAnyUser())
+ == DEVICE_OWNER_TYPE_FINANCED) {
+ return packageResources.getString(R.string.do_financed_disclosure_with_name,
+ organizationName);
+ } else {
+ return packageResources.getString(R.string.do_disclosure_with_name,
+ organizationName);
+ }
+ }
+
private void updateOwnerInfo() {
if (!isKeyguardLayoutEnabled()) {
mRotateTextViewController.hideIndication(INDICATION_TYPE_OWNER_INFO);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
index ce14bca081ab9..7ff056ead653d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
@@ -16,6 +16,8 @@
package com.android.systemui.statusbar;
+import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_DEFAULT;
+import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED;
import static android.content.pm.UserInfo.FLAG_MANAGED_PROFILE;
import static com.android.systemui.keyguard.KeyguardIndicationRotateTextViewController.INDICATION_TYPE_DISCLOSURE;
@@ -40,6 +42,7 @@ import android.app.Instrumentation;
import android.app.admin.DevicePolicyManager;
import android.app.trust.TrustManager;
import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.UserInfo;
@@ -94,8 +97,12 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
private static final String ORGANIZATION_NAME = "organization";
+ private static final ComponentName DEVICE_OWNER_COMPONENT = new ComponentName("com.android.foo",
+ "bar");
+
private String mDisclosureWithOrganization;
private String mDisclosureGeneric;
+ private String mFinancedDisclosureWithOrganization;
@Mock
private DevicePolicyManager mDevicePolicyManager;
@@ -156,6 +163,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
mDisclosureWithOrganization = mContext.getString(R.string.do_disclosure_with_name,
ORGANIZATION_NAME);
mDisclosureGeneric = mContext.getString(R.string.do_disclosure_generic);
+ mFinancedDisclosureWithOrganization = mContext.getString(
+ R.string.do_financed_disclosure_with_name, ORGANIZATION_NAME);
when(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
when(mKeyguardUpdateMonitor.isScreenOn()).thenReturn(true);
@@ -165,6 +174,11 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
.thenReturn(mIndicationAreaBottom);
when(mIndicationArea.findViewById(R.id.keyguard_indication_text)).thenReturn(mTextView);
+ when(mDevicePolicyManager.getDeviceOwnerComponentOnAnyUser())
+ .thenReturn(DEVICE_OWNER_COMPONENT);
+ when(mDevicePolicyManager.getDeviceOwnerType(DEVICE_OWNER_COMPONENT))
+ .thenReturn(DEVICE_OWNER_TYPE_DEFAULT);
+
mWakeLock = new WakeLockFake();
mWakeLockBuilder = new WakeLockFake.Builder(mContext);
mWakeLockBuilder.setWakeLock(mWakeLock);
@@ -371,6 +385,22 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
verify(mRotateTextViewController).hideIndication(INDICATION_TYPE_DISCLOSURE);
}
+ @Test
+ public void disclosure_deviceOwner_financedDeviceWithOrganizationName() {
+ createController();
+
+ when(mDevicePolicyManager.isDeviceManaged()).thenReturn(true);
+ when(mDevicePolicyManager.getDeviceOwnerOrganizationName()).thenReturn(ORGANIZATION_NAME);
+ when(mDevicePolicyManager.getDeviceOwnerType(DEVICE_OWNER_COMPONENT))
+ .thenReturn(DEVICE_OWNER_TYPE_FINANCED);
+ sendUpdateDisclosureBroadcast();
+
+ verify(mRotateTextViewController).updateIndication(eq(INDICATION_TYPE_DISCLOSURE),
+ mKeyguardIndicationCaptor.capture(), eq(false));
+ assertThat(mKeyguardIndicationCaptor.getValue().getMessage())
+ .isEqualTo(mFinancedDisclosureWithOrganization);
+ }
+
@Test
public void transientIndication_holdsWakeLock_whenDozing() {
createController();