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

Commit f64a468b authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan Committed by Steve Kondik
Browse files

PackageManager: allow build-time disabling of components

Allow components to be specified as disabled at build time
(applied on boot).

This allows stock OTA components to be marked as disabled in
CM builds.

Change-Id: I6e4499cc40a779792a5ea97a10137399dad7d69f
parent 847b02e0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2134,4 +2134,8 @@
    <string-array translatable="false" name="config_sms_convert_destination_number_support">
        <item>false</item>
    </string-array>

    <!-- The list of components which should be automatically disabled. -->
    <string-array name="config_disabledComponents" translatable="false">
    </string-array>
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -2227,4 +2227,8 @@
  <java-symbol type="string" name="adb_active_generic_notification_message" />

  <java-symbol type="bool" name="config_fetch_apn_from_omh_card" />

  <!-- Package Manager -->
  <java-symbol type="array" name="config_disabledComponents" />

</resources>
+15 −0
Original line number Diff line number Diff line
@@ -1791,6 +1791,21 @@ public class PackageManagerService extends IPackageManager.Stub {
                mSettings.readDefaultPreferredAppsLPw(this, 0);
            }
            // Disable components marked for disabling at build-time
            for (String name : mContext.getResources().getStringArray(
                    com.android.internal.R.array.config_disabledComponents)) {
                ComponentName cn = ComponentName.unflattenFromString(name);
                Slog.v(TAG, "Disabling " + name);
                String className = cn.getClassName();
                PackageSetting pkgSetting = mSettings.mPackages.get(cn.getPackageName());
                if (pkgSetting == null || pkgSetting.pkg == null
                        || !pkgSetting.pkg.hasComponentClassName(className)) {
                    Slog.w(TAG, "Unable to disable " + name);
                    continue;
                }
                pkgSetting.disableComponentLPw(className, UserHandle.USER_OWNER);
            }
            // If this is first boot after an OTA, and a normal boot, then
            // we need to clear code cache directories.
            if (!Build.FINGERPRINT.equals(mSettings.mFingerprint) && !onlyCore) {