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

Commit eb2e4e10 authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan Committed by Ricardo Cerqueira
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 b0be6b6c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1372,4 +1372,7 @@
    <!-- Integer to configure panel auto brightness mode when changed -->
    <integer name="config_panelAutoBrightnessValue">-1</integer>

    <!-- The list of components which should be automatically disabled. -->
    <string-array name="config_disabledComponents" translatable="false">
    </string-array>
</resources>
+3 −0
Original line number Diff line number Diff line
@@ -1831,4 +1831,7 @@
  <!-- Electron Beam -->
  <java-symbol type="bool" name="config_screenOffAnimation" />

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

</resources>
+15 −0
Original line number Diff line number Diff line
@@ -1459,6 +1459,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);
            }

            // can downgrade to reader
            mSettings.writeLPr();