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

Commit cd37e57a authored by Sandeep Gutta's avatar Sandeep Gutta Committed by Amit Mahajan
Browse files

Allow injection jar to be located in system_ext folder

Bug: 164680051
Test: basic sanity
Merged-in: I732cf3e91cc85053c139e6385c3b12c9796ae69e
Change-Id: I732cf3e91cc85053c139e6385c3b12c9796ae69e
(cherry picked from commit f1778fc7)
parent 183fb8ea
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ public class TelephonyComponentFactory {
        private static final String TAG_COMPONENT = "component";
        private static final String SYSTEM = "/system/";
        private static final String PRODUCT = "/product/";
        private static final String SYSTEM_EXT = "/system_ext/";

        private final Set<String> mComponentNames = new HashSet<>();
        private TelephonyComponentFactory mInjectedInstance;
@@ -88,7 +89,7 @@ public class TelephonyComponentFactory {
        /**
         * @return paths correctly configured to inject.
         * 1) PackageName and JarPath mustn't be empty.
         * 2) JarPath is restricted under /system or /product only.
         * 2) JarPath is restricted under /system or /product or /system_ext only.
         * 3) JarPath is on a READ-ONLY partition.
         */
        private @Nullable String getValidatedPaths() {
@@ -97,7 +98,8 @@ public class TelephonyComponentFactory {
            }
            // filter out invalid paths
            return Arrays.stream(mJarPath.split(File.pathSeparator))
                    .filter(s -> (s.startsWith(SYSTEM) || s.startsWith(PRODUCT)))
                    .filter(s -> (s.startsWith(SYSTEM) || s.startsWith(PRODUCT)
                            || s.startsWith(SYSTEM_EXT)))
                    .filter(s -> {
                        try {
                            // This will also throw an error if the target doesn't exist.