Allow System to by-pass verifyShortcutInfoPackage

SystemUI needs to be able to modify shortcuts defined by other System Apps. A clear use case is Note Task shortcut which needs to be updated based on the notes role app which is observed from SystemUI.

Test: manual

Fixes: b/278724068
Change-Id: Iaca0e6a13ecb68f856334fd83947ac721d45ff81
This commit is contained in:
Marcello Galhardo
2023-04-18 16:13:38 +00:00
parent 5e48604691
commit 90664488b4

View File

@@ -1716,6 +1716,11 @@ public class ShortcutService extends IShortcutService.Stub {
if (si == null) {
return;
}
if (isCallerSystem()) {
return; // no check
}
if (!Objects.equals(callerPackage, si.getPackage())) {
android.util.EventLog.writeEvent(0x534e4554, "109824443", -1, "");
throw new SecurityException("Shortcut package name mismatch");