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

Commit 27927342 authored by Yanting Yang's avatar Yanting Yang Committed by Automerger Merge Worker
Browse files

Merge "Add mainline module utils function into AppUtils" into rvc-dev am:...

Merge "Add mainline module utils function into AppUtils" into rvc-dev am: a1461542 am: 8c53e8bf am: cec34ba6 am: 05843518

Change-Id: Ib9ef4228150dc6bd4471b473607d2b0eab602386
parents 1a873379 05843518
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -140,4 +140,15 @@ public class AppUtils {
                .isSystemModule(packageName);
                .isSystemModule(packageName);
    }
    }


    /**
     * Returns a boolean indicating whether a given package is a mainline module.
     */
    public static boolean isMainlineModule(Context context, String packageName) {
        final PackageManager pm = context.getPackageManager();
        try {
            return pm.getModuleInfo(packageName, 0 /* flags */) != null;
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }
    }
}
}