Add missing settings strings.
Also re-enable and fix tests. Test: manual Fixes: 226183482 Fixes: 218799125 Fixes: 219375624 Change-Id: I9605f1f4e2e834baf63e015e96639567c5481b5f
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.display;
|
||||
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.OTHER_OPTIONS_DISABLED_BY_ADMIN;
|
||||
|
||||
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
|
||||
import android.app.Dialog;
|
||||
@@ -24,7 +26,9 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog.Builder;
|
||||
|
||||
@@ -52,13 +56,26 @@ public class TimeoutListPreference extends RestrictedListPreference {
|
||||
DialogInterface.OnClickListener listener) {
|
||||
super.onPrepareDialogBuilder(builder, listener);
|
||||
if (mAdmin != null) {
|
||||
builder.setView(R.layout.admin_disabled_other_options_footer);
|
||||
// TODO: replace Text on textview with admin_disabled_other_options
|
||||
updateTextOnDialog(builder);
|
||||
} else {
|
||||
builder.setView(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTextOnDialog(Builder builder) {
|
||||
LayoutInflater inflater = getContext().getSystemService(LayoutInflater.class);
|
||||
DevicePolicyManager devicePolicyManager = getContext()
|
||||
.getSystemService(DevicePolicyManager.class);
|
||||
View v = inflater.inflate(R.layout.admin_disabled_other_options_footer, null);
|
||||
builder.setView(v);
|
||||
TextView textView = v.findViewById(R.id.admin_disabled_other_options_text);
|
||||
String replacementText = devicePolicyManager.getResources().getString(
|
||||
OTHER_OPTIONS_DISABLED_BY_ADMIN, () -> null);
|
||||
if (replacementText != null) {
|
||||
textView.setText(replacementText);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDialogCreated(Dialog dialog) {
|
||||
super.onDialogCreated(dialog);
|
||||
|
Reference in New Issue
Block a user