Merge "Shorten trampoline toast text" into sc-dev am: 689a571110
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13816785 Change-Id: Id9c5379bc9f74d5fec03522886cbbe9728844b11
This commit is contained in:
@@ -10635,17 +10635,17 @@ public class NotificationManagerService extends SystemService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String toastMessage = "Indirect activity start from " + packageName;
|
|
||||||
String logcatMessage =
|
String logcatMessage =
|
||||||
"Indirect notification activity start (trampoline) from " + packageName;
|
"Indirect notification activity start (trampoline) from " + packageName;
|
||||||
|
// Call to toast() method is posted to mHandler below to offload PM lookup from the
|
||||||
|
// activity start path
|
||||||
if (CompatChanges.isChangeEnabled(NOTIFICATION_TRAMPOLINE_BLOCK, uid)) {
|
if (CompatChanges.isChangeEnabled(NOTIFICATION_TRAMPOLINE_BLOCK, uid)) {
|
||||||
toast(toastMessage + " blocked.");
|
mHandler.post(() -> toast(packageName, uid, /* blocked */ true));
|
||||||
Slog.e(TAG, logcatMessage + " blocked");
|
Slog.e(TAG, logcatMessage + " blocked");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (mPackagesShown.add(packageName)) {
|
if (mPackagesShown.add(packageName)) {
|
||||||
toast(toastMessage + ". This will be blocked in S.");
|
mHandler.post(() -> toast(packageName, uid, /* blocked */ false));
|
||||||
}
|
}
|
||||||
Slog.w(TAG, logcatMessage + ", this should be avoided for performance reasons");
|
Slog.w(TAG, logcatMessage + ", this should be avoided for performance reasons");
|
||||||
return true;
|
return true;
|
||||||
@@ -10661,10 +10661,19 @@ public class NotificationManagerService extends SystemService {
|
|||||||
&& !CompatChanges.isChangeEnabled(NOTIFICATION_TRAMPOLINE_BLOCK, uid);
|
&& !CompatChanges.isChangeEnabled(NOTIFICATION_TRAMPOLINE_BLOCK, uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toast(String message) {
|
private void toast(String packageName, int uid, boolean blocked) {
|
||||||
mUiHandler.post(() ->
|
final CharSequence label;
|
||||||
Toast.makeText(getUiContext(), message + "\nSee g.co/dev/trampolines.",
|
try {
|
||||||
Toast.LENGTH_LONG).show());
|
label = mPackageManagerClient.getApplicationLabel(
|
||||||
|
mPackageManager.getApplicationInfo(packageName, 0,
|
||||||
|
UserHandle.getUserId(uid)));
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Unexpected exception obtaining app label from PackageManager", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mUiHandler.post(() -> Toast.makeText(getUiContext(),
|
||||||
|
label + " launch " + (blocked ? "blocked" : "will be blocked")
|
||||||
|
+ "\ng.co/dev/trampolines", Toast.LENGTH_LONG).show());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user