Merge "[Security] resolve CRLF attack on RequestIgnoreBatteryOptimizations" into sc-v2-dev

This commit is contained in:
YUKAI HUNG
2021-09-24 02:09:08 +00:00
committed by Android (Google) Code Review

View File

@@ -19,6 +19,7 @@ package com.android.settings.fuelgauge;
import android.Manifest; import android.Manifest;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@@ -85,8 +86,11 @@ public class RequestIgnoreBatteryOptimizations extends AlertActivity implements
} }
final AlertController.AlertParams p = mAlertParams; final AlertController.AlertParams p = mAlertParams;
final CharSequence appLabel = ai.loadSafeLabel(getPackageManager(),
PackageItemInfo.DEFAULT_MAX_LABEL_SIZE_PX, PackageItemInfo.SAFE_LABEL_FLAG_TRIM
| PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE);
p.mTitle = getText(R.string.high_power_prompt_title); p.mTitle = getText(R.string.high_power_prompt_title);
p.mMessage = getString(R.string.high_power_prompt_body, ai.loadLabel(getPackageManager())); p.mMessage = getString(R.string.high_power_prompt_body, appLabel);
p.mPositiveButtonText = getText(R.string.allow); p.mPositiveButtonText = getText(R.string.allow);
p.mNegativeButtonText = getText(R.string.deny); p.mNegativeButtonText = getText(R.string.deny);
p.mPositiveButtonListener = this; p.mPositiveButtonListener = this;