Skip to content

Commit 03d668d

Browse files
committed
Merge tag 'android-security-13.0.0_r10' into cr-11.0
Android Security 13.0.0 Release 10 (10763433) Change-Id: I41479646e789839483fa2b47f8730c9882c9f6c5
2 parents 60678fb + 08f9c38 commit 03d668d

110 files changed

Lines changed: 356 additions & 77 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/java/android/app/Notification.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,8 +2858,9 @@ public void visitUris(@NonNull Consumer<Uri> visitor) {
28582858
visitor.accept(person.getIconUri());
28592859
}
28602860

2861-
final RemoteInputHistoryItem[] history = (RemoteInputHistoryItem[])
2862-
extras.getParcelableArray(Notification.EXTRA_REMOTE_INPUT_HISTORY_ITEMS);
2861+
final RemoteInputHistoryItem[] history = extras.getParcelableArray(
2862+
Notification.EXTRA_REMOTE_INPUT_HISTORY_ITEMS,
2863+
RemoteInputHistoryItem.class);
28632864
if (history != null) {
28642865
for (int i = 0; i < history.length; i++) {
28652866
RemoteInputHistoryItem item = history[i];

core/java/android/database/DatabaseUtils.java

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -511,17 +511,31 @@ public static void cursorFillWindow(final Cursor cursor,
511511
*/
512512
public static void appendEscapedSQLString(StringBuilder sb, String sqlString) {
513513
sb.append('\'');
514-
if (sqlString.indexOf('\'') != -1) {
515-
int length = sqlString.length();
516-
for (int i = 0; i < length; i++) {
517-
char c = sqlString.charAt(i);
518-
if (c == '\'') {
519-
sb.append('\'');
514+
int length = sqlString.length();
515+
for (int i = 0; i < length; i++) {
516+
char c = sqlString.charAt(i);
517+
if (Character.isHighSurrogate(c)) {
518+
if (i == length - 1) {
519+
continue;
520+
}
521+
if (Character.isLowSurrogate(sqlString.charAt(i + 1))) {
522+
// add them both
523+
sb.append(c);
524+
sb.append(sqlString.charAt(i + 1));
525+
continue;
526+
} else {
527+
// this is a lone surrogate, skip it
528+
continue;
520529
}
521-
sb.append(c);
522530
}
523-
} else
524-
sb.append(sqlString);
531+
if (Character.isLowSurrogate(c)) {
532+
continue;
533+
}
534+
if (c == '\'') {
535+
sb.append('\'');
536+
}
537+
sb.append(c);
538+
}
525539
sb.append('\'');
526540
}
527541

core/jni/android_view_InputDevice.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,22 @@ jobject android_view_InputDevice_create(JNIEnv* env, const InputDeviceInfo& devi
4242
return NULL;
4343
}
4444

45+
// b/274058082: Pass a copy of the key character map to avoid concurrent
46+
// access
47+
std::shared_ptr<KeyCharacterMap> map = deviceInfo.getKeyCharacterMap();
48+
if (map != nullptr) {
49+
map = std::make_shared<KeyCharacterMap>(*map);
50+
}
51+
4552
ScopedLocalRef<jstring> descriptorObj(env,
4653
env->NewStringUTF(deviceInfo.getIdentifier().descriptor.c_str()));
4754
if (!descriptorObj.get()) {
4855
return NULL;
4956
}
5057

5158
ScopedLocalRef<jobject> kcmObj(env,
52-
android_view_KeyCharacterMap_create(env, deviceInfo.getId(),
53-
deviceInfo.getKeyCharacterMap()));
59+
android_view_KeyCharacterMap_create(env, deviceInfo.getId(),
60+
map));
5461
if (!kcmObj.get()) {
5562
return NULL;
5663
}

libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import android.graphics.Color;
4646
import android.graphics.Rect;
4747
import android.graphics.drawable.Drawable;
48+
import android.graphics.drawable.Icon;
4849
import android.net.Uri;
4950
import android.os.Bundle;
5051
import android.os.Handler;
@@ -513,13 +514,19 @@ private void updateActionViews(int menuState, Rect stackBounds) {
513514
final boolean isCloseAction = mCloseAction != null && Objects.equals(
514515
mCloseAction.getActionIntent(), action.getActionIntent());
515516

516-
// TODO: Check if the action drawable has changed before we reload it
517-
action.getIcon().loadDrawableAsync(mContext, d -> {
518-
if (d != null) {
519-
d.setTint(Color.WHITE);
520-
actionView.setImageDrawable(d);
521-
}
522-
}, mMainHandler);
517+
final int iconType = action.getIcon().getType();
518+
if (iconType == Icon.TYPE_URI || iconType == Icon.TYPE_URI_ADAPTIVE_BITMAP) {
519+
// Disallow loading icon from content URI
520+
actionView.setImageDrawable(null);
521+
} else {
522+
// TODO: Check if the action drawable has changed before we reload it
523+
action.getIcon().loadDrawableAsync(mContext, d -> {
524+
if (d != null) {
525+
d.setTint(Color.WHITE);
526+
actionView.setImageDrawable(d);
527+
}
528+
}, mMainHandler);
529+
}
523530
actionView.setCustomCloseBackgroundVisibility(
524531
isCloseAction ? View.VISIBLE : View.GONE);
525532
actionView.setContentDescription(action.getContentDescription());

media/java/android/media/RingtoneManager.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ public static Uri getActualDefaultRingtoneUriBySlot(Context context, int type, i
837837

838838
return ringtoneUri;
839839
}
840-
840+
841841
/**
842842
* Sets the {@link Uri} of the default sound for a given sound type.
843843
*
@@ -875,6 +875,21 @@ public static void setActualDefaultRingtoneUriBySlot(Context context, int type,
875875
if(!isInternalRingtoneUri(ringtoneUri)) {
876876
ringtoneUri = ContentProvider.maybeAddUserId(ringtoneUri, context.getUserId());
877877
}
878+
879+
if (ringtoneUri != null) {
880+
final String mimeType = resolver.getType(ringtoneUri);
881+
if (mimeType == null) {
882+
Log.e(TAG, "setActualDefaultRingtoneUri for URI:" + ringtoneUri
883+
+ " ignored: failure to find mimeType (no access from this context?)");
884+
return;
885+
}
886+
if (!(mimeType.startsWith("audio/") || mimeType.equals("application/ogg"))) {
887+
Log.e(TAG, "setActualDefaultRingtoneUri for URI:" + ringtoneUri
888+
+ " ignored: associated mimeType:" + mimeType + " is not an audio type");
889+
return;
890+
}
891+
}
892+
878893
Settings.System.putStringForUser(resolver, setting,
879894
ringtoneUri != null ? ringtoneUri.toString() : null, context.getUserId());
880895

packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,6 +3106,15 @@ public Setting getSettingLocked(int type, int userId, String name) {
31063106
return settingsState.getSettingLocked(name);
31073107
}
31083108

3109+
private boolean shouldExcludeSettingFromReset(Setting setting, String prefix) {
3110+
// If a prefix was specified, exclude settings whose names don't start with it.
3111+
if (prefix != null && !setting.getName().startsWith(prefix)) {
3112+
return true;
3113+
}
3114+
// Never reset SECURE_FRP_MODE, as it could be abused to bypass FRP via RescueParty.
3115+
return Secure.SECURE_FRP_MODE.equals(setting.getName());
3116+
}
3117+
31093118
public void resetSettingsLocked(int type, int userId, String packageName, int mode,
31103119
String tag) {
31113120
resetSettingsLocked(type, userId, packageName, mode, tag, /*prefix=*/
@@ -3128,7 +3137,7 @@ public void resetSettingsLocked(int type, int userId, String packageName, int mo
31283137
Setting setting = settingsState.getSettingLocked(name);
31293138
if (packageName.equals(setting.getPackageName())) {
31303139
if ((tag != null && !tag.equals(setting.getTag()))
3131-
|| (prefix != null && !setting.getName().startsWith(prefix))) {
3140+
|| shouldExcludeSettingFromReset(setting, prefix)) {
31323141
continue;
31333142
}
31343143
if (settingsState.resetSettingLocked(name)) {
@@ -3148,7 +3157,7 @@ public void resetSettingsLocked(int type, int userId, String packageName, int mo
31483157
Setting setting = settingsState.getSettingLocked(name);
31493158
if (!SettingsState.isSystemPackage(getContext(),
31503159
setting.getPackageName())) {
3151-
if (prefix != null && !setting.getName().startsWith(prefix)) {
3160+
if (shouldExcludeSettingFromReset(setting, prefix)) {
31523161
continue;
31533162
}
31543163
if (settingsState.resetSettingLocked(name)) {
@@ -3168,7 +3177,7 @@ public void resetSettingsLocked(int type, int userId, String packageName, int mo
31683177
Setting setting = settingsState.getSettingLocked(name);
31693178
if (!SettingsState.isSystemPackage(getContext(),
31703179
setting.getPackageName())) {
3171-
if (prefix != null && !setting.getName().startsWith(prefix)) {
3180+
if (shouldExcludeSettingFromReset(setting, prefix)) {
31723181
continue;
31733182
}
31743183
if (setting.isDefaultFromSystem()) {
@@ -3191,7 +3200,7 @@ public void resetSettingsLocked(int type, int userId, String packageName, int mo
31913200
for (String name : settingsState.getSettingNamesLocked()) {
31923201
Setting setting = settingsState.getSettingLocked(name);
31933202
boolean someSettingChanged = false;
3194-
if (prefix != null && !setting.getName().startsWith(prefix)) {
3203+
if (shouldExcludeSettingFromReset(setting, prefix)) {
31953204
continue;
31963205
}
31973206
if (setting.isDefaultFromSystem()) {

packages/SettingsProvider/test/src/com/android/providers/settings/SettingsProviderTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,31 @@ private void testResetModeTrustedDefaultsCommon(int type) throws Exception {
464464
}
465465
}
466466

467+
// To prevent FRP bypasses, the SECURE_FRP_MODE setting should not be reset when all other
468+
// settings are reset. But it should still be possible to explicitly set its value.
469+
@Test
470+
public void testSecureFrpModeSettingCannotBeReset() throws Exception {
471+
final String name = Settings.Secure.SECURE_FRP_MODE;
472+
final String origValue = getSetting(SETTING_TYPE_GLOBAL, name);
473+
setSettingViaShell(SETTING_TYPE_GLOBAL, name, "1", false);
474+
try {
475+
assertEquals("1", getSetting(SETTING_TYPE_GLOBAL, name));
476+
for (int type : new int[] { SETTING_TYPE_GLOBAL, SETTING_TYPE_SECURE }) {
477+
resetSettingsViaShell(type, Settings.RESET_MODE_UNTRUSTED_DEFAULTS);
478+
resetSettingsViaShell(type, Settings.RESET_MODE_UNTRUSTED_CHANGES);
479+
resetSettingsViaShell(type, Settings.RESET_MODE_TRUSTED_DEFAULTS);
480+
}
481+
// The value should still be "1". It should not have been reset to null.
482+
assertEquals("1", getSetting(SETTING_TYPE_GLOBAL, name));
483+
// It should still be possible to explicitly set the value to "0".
484+
setSettingViaShell(SETTING_TYPE_GLOBAL, name, "0", false);
485+
assertEquals("0", getSetting(SETTING_TYPE_GLOBAL, name));
486+
} finally {
487+
setSettingViaShell(SETTING_TYPE_GLOBAL, name, origValue, false);
488+
assertEquals(origValue, getSetting(SETTING_TYPE_GLOBAL, name));
489+
}
490+
}
491+
467492
private void doTestQueryStringInBracketsViaProviderApiForType(int type) {
468493
// Make sure we have a clean slate.
469494
deleteStringViaProviderApi(type, FAKE_SETTING_NAME);

packages/SystemUI/res/values-af/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@
870870
<string name="media_ttt_default_device_type" msgid="4457646436153370169">"tablet"</string>
871871
<string name="media_transfer_receiver_content_description_unknown_app" msgid="7381771464846263667">"Saai jou media uit"</string>
872872
<string name="media_transfer_receiver_content_description_with_app_name" msgid="8555975056850659389">"Saai tans <xliff:g id="APP_LABEL">%1$s</xliff:g> uit"</string>
873+
<string name="controls_media_empty_title" msgid="8296102892421573325">"<xliff:g id="APP_NAME">%1$s</xliff:g> loop tans"</string>
873874
<string name="controls_error_timeout" msgid="794197289772728958">"Onaktief, gaan program na"</string>
874875
<string name="controls_error_removed" msgid="6675638069846014366">"Nie gekry nie"</string>
875876
<string name="controls_error_removed_title" msgid="1207794911208047818">"Kontrole is nie beskikbaar nie"</string>

packages/SystemUI/res/values-am/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@
870870
<string name="media_ttt_default_device_type" msgid="4457646436153370169">"ጡባዊ"</string>
871871
<string name="media_transfer_receiver_content_description_unknown_app" msgid="7381771464846263667">"የእርስዎን ሚዲያ cast በማድረግ ላይ"</string>
872872
<string name="media_transfer_receiver_content_description_with_app_name" msgid="8555975056850659389">"<xliff:g id="APP_LABEL">%1$s</xliff:g>ን Cast በማድረግ ላይ"</string>
873+
<string name="controls_media_empty_title" msgid="8296102892421573325">"<xliff:g id="APP_NAME">%1$s</xliff:g> እያሄደ ነው"</string>
873874
<string name="controls_error_timeout" msgid="794197289772728958">"ንቁ ያልኾነ፣ መተግበሪያን ይፈትሹ"</string>
874875
<string name="controls_error_removed" msgid="6675638069846014366">"አልተገኘም"</string>
875876
<string name="controls_error_removed_title" msgid="1207794911208047818">"መቆጣጠሪያ አይገኝም"</string>

packages/SystemUI/res/values-ar/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@
870870
<string name="media_ttt_default_device_type" msgid="4457646436153370169">"جهاز لوحي"</string>
871871
<string name="media_transfer_receiver_content_description_unknown_app" msgid="7381771464846263667">"بثّ الوسائط"</string>
872872
<string name="media_transfer_receiver_content_description_with_app_name" msgid="8555975056850659389">"جارٍ بثّ \"<xliff:g id="APP_LABEL">%1$s</xliff:g>\""</string>
873+
<string name="controls_media_empty_title" msgid="8296102892421573325">"\"<xliff:g id="APP_NAME">%1$s</xliff:g>\" قيد التشغيل"</string>
873874
<string name="controls_error_timeout" msgid="794197289772728958">"غير نشط، تحقّق من التطبيق."</string>
874875
<string name="controls_error_removed" msgid="6675638069846014366">"لم يتم العثور عليه."</string>
875876
<string name="controls_error_removed_title" msgid="1207794911208047818">"عنصر التحكّم غير متوفّر"</string>

0 commit comments

Comments
 (0)