Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd72c9ed authored by Ben Gruver's avatar Ben Gruver
Browse files

Improve the logic for determining whether the caller is a system app

Bug: 10024554
Change-Id: I742e918840a98dd83d713bdf7a43a919674e65fe
parent 40f5b63b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -102,6 +102,8 @@ interface IPackageManager {
    
    int getUidForSharedUser(String sharedUserName);

    int getFlagsForUid(int uid);

    ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);

    List<ResolveInfo> queryIntentActivities(in Intent intent, 
+2 −2
Original line number Diff line number Diff line
@@ -1154,8 +1154,8 @@ public final class ActivityStackSupervisor {
            throw new SecurityException(msg);
        }

        boolean abort = !mService.mIntentFirewall.checkStartActivity(intent,
                callerApp==null?null:callerApp.info, callingUid, callingPid, resolvedType, aInfo);
        boolean abort = !mService.mIntentFirewall.checkStartActivity(intent, callingUid,
                callingPid, resolvedType, aInfo);

        if (mService.mController != null) {
            try {
+3 −3
Original line number Diff line number Diff line
@@ -25,10 +25,10 @@ import java.io.IOException;

class AndFilter extends FilterList {
    @Override
    public boolean matches(IntentFirewall ifw, Intent intent, ApplicationInfo callerApp,
            int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) {
    public boolean matches(IntentFirewall ifw, Intent intent, int callerUid, int callerPid,
            String resolvedType, ApplicationInfo resolvedApp) {
        for (int i=0; i<children.size(); i++) {
            if (!children.get(i).matches(ifw, intent, callerApp, callerUid, callerPid, resolvedType,
            if (!children.get(i).matches(ifw, intent, callerUid, callerPid, resolvedType,
                    resolvedApp)) {
                return false;
            }
+2 −2
Original line number Diff line number Diff line
@@ -34,8 +34,8 @@ class CategoryFilter implements Filter {
    }

    @Override
    public boolean matches(IntentFirewall ifw, Intent intent, ApplicationInfo callerApp,
            int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp) {
    public boolean matches(IntentFirewall ifw, Intent intent, int callerUid, int callerPid,
            String resolvedType, ApplicationInfo resolvedApp) {
        Set<String> categories = intent.getCategories();
        if (categories == null) {
            return false;
+4 −8
Original line number Diff line number Diff line
@@ -25,15 +25,11 @@ interface Filter {
     *
     * @param ifw The IntentFirewall instance
     * @param intent The intent being started/bound/broadcast
     * @param callerApp An ApplicationInfo of an application in the caller's process. This may not
     *                  be the specific app that is actually sending the intent. This also may be
     *                  null, if the caller is the system process, or an unrecognized process (e.g.
     *                  am start)
     * @param callerUid
     * @param callerPid
     * @param callerUid The uid of the caller
     * @param callerPid The pid of the caller
     * @param resolvedType The resolved mime type of the intent
     * @param resolvedApp The application that contains the resolved component that the intent is
     */
    boolean matches(IntentFirewall ifw, Intent intent, ApplicationInfo callerApp,
            int callerUid, int callerPid, String resolvedType, ApplicationInfo resolvedApp);
    boolean matches(IntentFirewall ifw, Intent intent, int callerUid, int callerPid,
            String resolvedType, ApplicationInfo resolvedApp);
}
Loading