Prevent HTML Injection on the Device Admin request screen am: 52f9039d5c am: 6ac45a7ceb

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14167797

Change-Id: I4dd08163fb97a16c88aa23bdc39851b327034940
This commit is contained in:
Tsung-Mao Fang
2021-04-27 12:30:50 +00:00
committed by Automerger Merge Worker

View File

@@ -102,7 +102,7 @@ public class DeviceAdminAdd extends Activity {
DevicePolicyManager mDPM;
AppOpsManager mAppOps;
DeviceAdminInfo mDeviceAdmin;
CharSequence mAddMsgText;
String mAddMsgText;
String mProfileOwnerName;
ImageView mAdminIcon;
@@ -274,7 +274,11 @@ public class DeviceAdminAdd extends Activity {
}
}
mAddMsgText = getIntent().getCharSequenceExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION);
final CharSequence addMsgCharSequence = getIntent().getCharSequenceExtra(
DevicePolicyManager.EXTRA_ADD_EXPLANATION);
if (addMsgCharSequence != null) {
mAddMsgText = addMsgCharSequence.toString();
}
if (mAddingProfileOwner) {
// If we're trying to add a profile owner and user setup hasn't completed yet, no
@@ -628,7 +632,7 @@ public class DeviceAdminAdd extends Activity {
} catch (Resources.NotFoundException e) {
mAdminDescription.setVisibility(View.GONE);
}
if (mAddMsgText != null) {
if (!TextUtils.isEmpty(mAddMsgText)) {
mAddMsg.setText(mAddMsgText);
mAddMsg.setVisibility(View.VISIBLE);
} else {