Skip to content

Commit ad6abb5

Browse files
libxzrhungphan2001
authored andcommitted
am: Block MEDIA_MOUNTED broadcast for restricted apps
This blocks ACTION_MEDIA_MOUNTED for victims of "strict standby" and "force background freezer". Some apps e.g. MobileQQ are using this for boot completed notification, which could block the process of serialized broadcast for quite a while. Also move `=` to `.equals()` because the latter one is the proper way for comparing strings, although the former one is just working fine statically within system server context. Change-Id: I46a85e7d9f386b10e6001697cf98f77ff058c3e7 Signed-off-by: LibXZR <i@xzr.moe> Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> Signed-off-by: Dmitrii <bankersenator@gmail.com> Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
1 parent 068dd4b commit ad6abb5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

services/core/java/com/android/server/am/BroadcastQueue.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,8 +1147,9 @@ static String broadcastDescription(BroadcastRecord r, ComponentName component) {
11471147
}
11481148

11491149
private boolean isBootCompletedIntent(Intent intent) {
1150-
return intent.getAction() == Intent.ACTION_BOOT_COMPLETED ||
1151-
intent.getAction() == Intent.ACTION_LOCKED_BOOT_COMPLETED;
1150+
return Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) ||
1151+
Intent.ACTION_LOCKED_BOOT_COMPLETED.equals(intent.getAction()) ||
1152+
Intent.ACTION_MEDIA_MOUNTED.equals(intent.getAction());
11521153
}
11531154

11541155
final void processNextBroadcastLocked(boolean fromMsg, boolean skipOomAdj) {
@@ -1530,7 +1531,7 @@ final void processNextBroadcastLocked(boolean fromMsg, boolean skipOomAdj) {
15301531
if (isBootCompletedIntent(r.intent) &&
15311532
mService.shouldSkipBootCompletedBroadcastForPackage(
15321533
info.activityInfo.applicationInfo)) {
1533-
Slog.i(TAG, "BOOT_COMPLETED broadcast skipped because of strict standby for "
1534+
Slog.i(TAG, "Boot broadcast skipped because of strict standby for "
15341535
+ info.activityInfo.applicationInfo.packageName);
15351536
skip = true;
15361537
}

0 commit comments

Comments
 (0)