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

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

Change-Id: I80b527b2bb891b3944a11ceecf296fdefaefff72
This commit is contained in:
Tsung-Mao Fang
2021-04-27 12:15:53 +00:00
committed by Automerger Merge Worker

View File

@@ -102,7 +102,7 @@ public class DeviceAdminAdd extends Activity {
DevicePolicyManager mDPM; DevicePolicyManager mDPM;
AppOpsManager mAppOps; AppOpsManager mAppOps;
DeviceAdminInfo mDeviceAdmin; DeviceAdminInfo mDeviceAdmin;
CharSequence mAddMsgText; String mAddMsgText;
String mProfileOwnerName; String mProfileOwnerName;
ImageView mAdminIcon; 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 (mAddingProfileOwner) {
// If we're trying to add a profile owner and user setup hasn't completed yet, no // If we're trying to add a profile owner and user setup hasn't completed yet, no
@@ -622,7 +626,7 @@ public class DeviceAdminAdd extends Activity {
} catch (Resources.NotFoundException e) { } catch (Resources.NotFoundException e) {
mAdminDescription.setVisibility(View.GONE); mAdminDescription.setVisibility(View.GONE);
} }
if (mAddMsgText != null) { if (!TextUtils.isEmpty(mAddMsgText)) {
mAddMsg.setText(mAddMsgText); mAddMsg.setText(mAddMsgText);
mAddMsg.setVisibility(View.VISIBLE); mAddMsg.setVisibility(View.VISIBLE);
} else { } else {