From cc8d37a4c6c60840c37dbd9108d786cdc60c3ff9 Mon Sep 17 00:00:00 2001 From: Benjamin Franz Date: Mon, 18 Jan 2016 17:31:26 +0000 Subject: [PATCH] Read work challenge background color from device policy Call into DevicePolicyManager to retrieve the background color that should be used for the work challenge on the user whose credential screen we're about to show. Change-Id: I612dd96020ce8932b49b21e6ff6faaddd39f957d --- .../settings/ConfirmDeviceCredentialBaseFragment.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java index d1ea8be74cb..86c9fca221f 100644 --- a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java +++ b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java @@ -21,11 +21,13 @@ import android.app.ActivityManager; import android.app.ActivityManagerNative; import android.app.ActivityOptions; import android.app.IActivityManager; +import android.app.admin.DevicePolicyManager; import android.content.Context; import android.content.Intent; import android.content.IntentSender; import android.graphics.Point; import android.graphics.PorterDuff; +import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.RemoteException; @@ -92,7 +94,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr getActivity(), getActivity().getIntent().getExtras())); if (Utils.isManagedProfile(UserManager.get(getActivity()), credentialOwnerUserId)) { - setWorkChallengeBackground(view); + setWorkChallengeBackground(view, credentialOwnerUserId); } } @@ -170,7 +172,10 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr } } - private void setWorkChallengeBackground(View baseView) { + private void setWorkChallengeBackground(View baseView, int userId) { + DevicePolicyManager dpm = (DevicePolicyManager) getActivity().getSystemService( + Context.DEVICE_POLICY_SERVICE); + baseView.setBackground(new ColorDrawable(dpm.getOrganizationColorForUser(userId))); ImageView imageView = (ImageView) baseView.findViewById(R.id.background_image); if (imageView != null) { Drawable image = getResources().getDrawable(R.drawable.work_challenge_background);